yading@11: /* yading@11: * audio interleaving prototypes and declarations yading@11: * yading@11: * Copyright (c) 2009 Baptiste Coudurier yading@11: * yading@11: * This file is part of FFmpeg. yading@11: * yading@11: * FFmpeg is free software; you can redistribute it and/or yading@11: * modify it under the terms of the GNU Lesser General Public yading@11: * License as published by the Free Software Foundation; either yading@11: * version 2.1 of the License, or (at your option) any later version. yading@11: * yading@11: * FFmpeg is distributed in the hope that it will be useful, yading@11: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@11: * Lesser General Public License for more details. yading@11: * yading@11: * You should have received a copy of the GNU Lesser General Public yading@11: * License along with FFmpeg; if not, write to the Free Software yading@11: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@11: */ yading@11: yading@11: #ifndef AVFORMAT_AUDIOINTERLEAVE_H yading@11: #define AVFORMAT_AUDIOINTERLEAVE_H yading@11: yading@11: #include "libavutil/fifo.h" yading@11: #include "avformat.h" yading@11: yading@11: typedef struct AudioInterleaveContext { yading@11: AVFifoBuffer *fifo; yading@11: unsigned fifo_size; ///< size of currently allocated FIFO yading@11: uint64_t dts; ///< current dts yading@11: int sample_size; ///< size of one sample all channels included yading@11: const int *samples_per_frame; ///< must be 0-terminated yading@11: const int *samples; ///< current samples per frame, pointer to samples_per_frame yading@11: AVRational time_base; ///< time base of output audio packets yading@11: } AudioInterleaveContext; yading@11: yading@11: int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base); yading@11: void ff_audio_interleave_close(AVFormatContext *s); yading@11: yading@11: /** yading@11: * Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame yading@11: * and interleave them correctly. yading@11: * The first element of AVStream->priv_data must be AudioInterleaveContext yading@11: * when using this function. yading@11: * yading@11: * @param get_packet function will output a packet when streams are correctly interleaved. yading@11: * @param compare_ts function will compare AVPackets and decide interleaving order. yading@11: */ yading@11: int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush, yading@11: int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int), yading@11: int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *)); yading@11: yading@11: #endif /* AVFORMAT_AUDIOINTERLEAVE_H */