yading@11
|
1 /*
|
yading@11
|
2 * audio interleaving prototypes and declarations
|
yading@11
|
3 *
|
yading@11
|
4 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
|
yading@11
|
5 *
|
yading@11
|
6 * This file is part of FFmpeg.
|
yading@11
|
7 *
|
yading@11
|
8 * FFmpeg is free software; you can redistribute it and/or
|
yading@11
|
9 * modify it under the terms of the GNU Lesser General Public
|
yading@11
|
10 * License as published by the Free Software Foundation; either
|
yading@11
|
11 * version 2.1 of the License, or (at your option) any later version.
|
yading@11
|
12 *
|
yading@11
|
13 * FFmpeg is distributed in the hope that it will be useful,
|
yading@11
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@11
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@11
|
16 * Lesser General Public License for more details.
|
yading@11
|
17 *
|
yading@11
|
18 * You should have received a copy of the GNU Lesser General Public
|
yading@11
|
19 * License along with FFmpeg; if not, write to the Free Software
|
yading@11
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@11
|
21 */
|
yading@11
|
22
|
yading@11
|
23 #ifndef AVFORMAT_AUDIOINTERLEAVE_H
|
yading@11
|
24 #define AVFORMAT_AUDIOINTERLEAVE_H
|
yading@11
|
25
|
yading@11
|
26 #include "libavutil/fifo.h"
|
yading@11
|
27 #include "avformat.h"
|
yading@11
|
28
|
yading@11
|
29 typedef struct AudioInterleaveContext {
|
yading@11
|
30 AVFifoBuffer *fifo;
|
yading@11
|
31 unsigned fifo_size; ///< size of currently allocated FIFO
|
yading@11
|
32 uint64_t dts; ///< current dts
|
yading@11
|
33 int sample_size; ///< size of one sample all channels included
|
yading@11
|
34 const int *samples_per_frame; ///< must be 0-terminated
|
yading@11
|
35 const int *samples; ///< current samples per frame, pointer to samples_per_frame
|
yading@11
|
36 AVRational time_base; ///< time base of output audio packets
|
yading@11
|
37 } AudioInterleaveContext;
|
yading@11
|
38
|
yading@11
|
39 int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base);
|
yading@11
|
40 void ff_audio_interleave_close(AVFormatContext *s);
|
yading@11
|
41
|
yading@11
|
42 /**
|
yading@11
|
43 * Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame
|
yading@11
|
44 * and interleave them correctly.
|
yading@11
|
45 * The first element of AVStream->priv_data must be AudioInterleaveContext
|
yading@11
|
46 * when using this function.
|
yading@11
|
47 *
|
yading@11
|
48 * @param get_packet function will output a packet when streams are correctly interleaved.
|
yading@11
|
49 * @param compare_ts function will compare AVPackets and decide interleaving order.
|
yading@11
|
50 */
|
yading@11
|
51 int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,
|
yading@11
|
52 int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),
|
yading@11
|
53 int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *));
|
yading@11
|
54
|
yading@11
|
55 #endif /* AVFORMAT_AUDIOINTERLEAVE_H */
|