]> git.sesse.net Git - ffmpeg/blob - libavformat/retimeinterleave.h
avformat/audiointerleave: only keep the retime functionality of the audio interleaver
[ffmpeg] / libavformat / retimeinterleave.h
1 /*
2  * audio interleaving prototypes and declarations
3  *
4  * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22
23 #ifndef AVFORMAT_RETIMEINTERLEAVE_H
24 #define AVFORMAT_RETIMEINTERLEAVE_H
25
26 #include "avformat.h"
27
28 typedef struct RetimeInterleaveContext {
29     uint64_t dts;                 ///< current dts
30     AVRational time_base;         ///< time base of output packets
31 } RetimeInterleaveContext;
32
33 /**
34  * Init the retime interleave context
35  */
36 void ff_retime_interleave_init(RetimeInterleaveContext *aic, AVRational time_base);
37
38 /**
39  * Retime packets per RetimeInterleaveContext->time_base and interleave them
40  * correctly.
41  * The first element of AVStream->priv_data must be RetimeInterleaveContext
42  * when using this function.
43  *
44  * @param get_packet function will output a packet when streams are correctly interleaved.
45  * @param compare_ts function will compare AVPackets and decide interleaving order.
46  */
47 int ff_retime_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,
48                         int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),
49                         int (*compare_ts)(AVFormatContext *, const AVPacket *, const AVPacket *));
50
51 #endif /* AVFORMAT_AUDIOINTERLEAVE_H */