/*1* audio interleaving prototypes and declarations2*3* Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>4*5* This file is part of FFmpeg.6*7* FFmpeg is free software; you can redistribute it and/or8* modify it under the terms of the GNU Lesser General Public9* License as published by the Free Software Foundation; either10* version 2.1 of the License, or (at your option) any later version.11*12* FFmpeg is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU15* Lesser General Public License for more details.16*17* You should have received a copy of the GNU Lesser General Public18* License along with FFmpeg; if not, write to the Free Software19* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA20*/2122#ifndef AVFORMAT_AUDIOINTERLEAVE_H23#define AVFORMAT_AUDIOINTERLEAVE_H2425#include "libavutil/fifo.h"26#include "avformat.h"2728typedef struct AudioInterleaveContext {29AVFifoBuffer *fifo;30unsigned fifo_size; ///< size of currently allocated FIFO31uint64_t dts; ///< current dts32int sample_size; ///< size of one sample all channels included33const int *samples_per_frame; ///< must be 0-terminated34const int *samples; ///< current samples per frame, pointer to samples_per_frame35AVRational time_base; ///< time base of output audio packets36} AudioInterleaveContext;3738int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base);39void ff_audio_interleave_close(AVFormatContext *s);4041/**42* Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame43* and interleave them correctly.44* The first element of AVStream->priv_data must be AudioInterleaveContext45* when using this function.46*47* @param get_packet function will output a packet when streams are correctly interleaved.48* @param compare_ts function will compare AVPackets and decide interleaving order.49*/50int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,51int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),52int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *));5354#endif /* AVFORMAT_AUDIOINTERLEAVE_H */555657