1 /* ffmpeg compatibility wrappers
3 * Copyright 2012,2013 Robin Gareus <robin@gareus.org>
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * 1. Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <libavcodec/avcodec.h>
33 #include <libavformat/avformat.h>
34 #include <libavutil/avutil.h>
36 #ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
37 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
40 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50, 0, 0)
41 #define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
44 #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 2, 0)
45 static inline int avformat_open_input(AVFormatContext
**ps
, const char *filename
, void *fmt
, void **options
)
47 return av_open_input_file(ps
, filename
, NULL
, 0, NULL
);
49 #endif /* avformat < 53.2.0 */
51 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 5, 0)
52 static inline AVCodecContext
*
53 avcodec_alloc_context3(AVCodec
*codec
__attribute__((unused
)))
55 return avcodec_alloc_context();
58 static inline AVStream
*
59 avformat_new_stream(AVFormatContext
*s
, AVCodec
*c
) {
60 return av_new_stream(s
,0);
64 avcodec_get_context_defaults3(AVCodecContext
*s
, AVCodec
*codec
)
66 avcodec_get_context_defaults(s
);
72 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 5, 6)
74 avcodec_open2(AVCodecContext
*avctx
, AVCodec
*codec
, void **options
__attribute__((unused
)))
76 return avcodec_open(avctx
, codec
);
78 #endif /* <= 53.5.6 */
80 #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 5, 0)
82 avformat_find_stream_info(AVFormatContext
*ic
, void **options
)
84 return av_find_stream_info(ic
);
88 avformat_close_input(AVFormatContext
**s
)
90 av_close_input_file(*s
);
95 #endif /* FFCOMPAT_H */