Statistics
| Branch: | Revision:

ffmpeg / libavformat / audiointerleave.h @ 56a10009

History | View | Annotate | Download (2.33 KB)

1 f1544e79 Baptiste Coudurier
/*
2 fbd7ddf4 Diego Biurrun
 * audio interleaving prototypes and declarations
3 f1544e79 Baptiste Coudurier
 *
4
 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
5
 *
6 2912e87a Mans Rullgard
 * This file is part of Libav.
7 f1544e79 Baptiste Coudurier
 *
8 2912e87a Mans Rullgard
 * Libav is free software; you can redistribute it and/or
9 f1544e79 Baptiste Coudurier
 * 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 2912e87a Mans Rullgard
 * Libav is distributed in the hope that it will be useful,
14 f1544e79 Baptiste Coudurier
 * 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 2912e87a Mans Rullgard
 * License along with Libav; if not, write to the Free Software
20 f1544e79 Baptiste Coudurier
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
 */
22
23
#ifndef AVFORMAT_AUDIOINTERLEAVE_H
24
#define AVFORMAT_AUDIOINTERLEAVE_H
25
26
#include "libavutil/fifo.h"
27
#include "avformat.h"
28
29
typedef struct {
30 41dd680d Michael Niedermayer
    AVFifoBuffer *fifo;
31 fbd7ddf4 Diego Biurrun
    unsigned fifo_size;           ///< size of currently allocated FIFO
32 f1544e79 Baptiste Coudurier
    uint64_t dts;                 ///< current dts
33
    int sample_size;              ///< size of one sample all channels included
34 fbd7ddf4 Diego Biurrun
    const int *samples_per_frame; ///< must be 0-terminated
35 f1544e79 Baptiste Coudurier
    const int *samples;           ///< current samples per frame, pointer to samples_per_frame
36
    AVRational time_base;         ///< time base of output audio packets
37
} AudioInterleaveContext;
38
39
int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base);
40
void ff_audio_interleave_close(AVFormatContext *s);
41
42 94027d3b Baptiste Coudurier
/**
43 fbd7ddf4 Diego Biurrun
 * Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame
44 94027d3b Baptiste Coudurier
 * and interleave them correctly.
45 fbd7ddf4 Diego Biurrun
 * The first element of AVStream->priv_data must be AudioInterleaveContext
46 94027d3b Baptiste Coudurier
 * when using this function.
47
 *
48
 * @param get_packet function will output a packet when streams are correctly interleaved.
49
 * @param compare_ts function will compare AVPackets and decide interleaving order.
50
 */
51 16e3b0b3 Baptiste Coudurier
int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,
52 f1544e79 Baptiste Coudurier
                        int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),
53
                        int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *));
54
55 fbd7ddf4 Diego Biurrun
#endif /* AVFORMAT_AUDIOINTERLEAVE_H */