Miam-Player  0.8.0
A nice music player
AVCompat.h
Go to the documentation of this file.
1 /******************************************************************************
2  QtAV: Multimedia framework based on Qt and FFmpeg
3  solve the version problem and diffirent api in FFmpeg and libav
4  Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
5 
6 * This file is part of QtAV
7 
8  This library 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  This library 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 this library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ******************************************************************************/
22 #ifndef QTAV_COMPAT_H
23 #define QTAV_COMPAT_H
24 
28 #define QTAV_USE_FFMPEG(MODULE) (MODULE##_VERSION_MICRO >= 100)
29 #define QTAV_USE_LIBAV(MODULE) !QTAV_USE_FFMPEG(MODULE)
30 #define FFMPEG_MODULE_CHECK(MODULE, MAJOR, MINOR, MICRO) \
31  (QTAV_USE_FFMPEG(MODULE) && MODULE##_VERSION_INT >= AV_VERSION_INT(MAJOR, MINOR, MICRO))
32 #define LIBAV_MODULE_CHECK(MODULE, MAJOR, MINOR, MICRO) \
33  (QTAV_USE_LIBAV(MODULE) && MODULE##_VERSION_INT >= AV_VERSION_INT(MAJOR, MINOR, MICRO))
34 #define AV_MODULE_CHECK(MODULE, MAJOR, MINOR, MICRO, MINOR2, MICRO2) \
35  (LIBAV_MODULE_CHECK(MODULE, MAJOR, MINOR, MICRO) || FFMPEG_MODULE_CHECK(MODULE, MAJOR, MINOR2, MICRO2))
36 #define AV_ENSURE_OK(FUNC, ...) AV_RUN_CHECK(FUNC, return, __VA_ARGS__)
38 #define AV_ENSURE(FUNC, ...) AV_RUN_CHECK(FUNC, return, __VA_ARGS__)
39 #define AV_WARN(FUNC) AV_RUN_CHECK(FUNC, void)
40 
41 #include "QtAV/QtAV_Global.h"
42 #ifdef __cplusplus
43 extern "C"
44 {
45 /*UINT64_C: C99 math features, need -D__STDC_CONSTANT_MACROS in CXXFLAGS*/
46 #endif /*__cplusplus*/
47 #include <libavformat/avformat.h>
48 #include <libswscale/swscale.h>
49 #include <libavcodec/avcodec.h>
50 #include <libavutil/avutil.h>
51 #include <libavutil/avstring.h>
52 #include <libavutil/dict.h>
53 #include <libavutil/imgutils.h>
54 #include <libavutil/log.h>
55 #include <libavutil/mathematics.h> //AV_ROUND_UP, av_rescale_rnd for libav
56 #include <libavutil/cpu.h>
57 #include <libavutil/error.h>
58 #include <libavutil/opt.h>
59 #include <libavutil/parseutils.h>
60 #include <libavutil/pixdesc.h>
61 #include <libavutil/avstring.h>
62 
63 #if !FFMPEG_MODULE_CHECK(LIBAVUTIL, 51, 73, 101)
65 #endif
66 
67 /* TODO: how to check whether we have swresample or not? how to check avresample?*/
68 #include <libavutil/samplefmt.h>
69 #if QTAV_HAVE(SWRESAMPLE)
71 #ifndef LIBSWRESAMPLE_VERSION_INT //ffmpeg 0.9, swr 0.5
72 #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, LIBSWRESAMPLE_VERSION_MINOR, LIBSWRESAMPLE_VERSION_MICRO)
73 #endif //LIBSWRESAMPLE_VERSION_INT
74 //ffmpeg >= 0.11.x. swr0.6.100: ffmpeg-0.10.x
75 #define HAVE_SWR_GET_DELAY (LIBSWRESAMPLE_VERSION_INT > AV_VERSION_INT(0, 6, 100))
76 #endif //QTAV_HAVE(SWRESAMPLE)
77 #if QTAV_HAVE(AVRESAMPLE)
78 #include <libavresample/avresample.h>
79 #endif //QTAV_HAVE(AVRESAMPLE)
80 
81 #if QTAV_HAVE(AVFILTER)
82 #include <libavfilter/avfiltergraph.h> /*code is here for old version*/
83 #include <libavfilter/avfilter.h>
84 #include <libavfilter/buffersink.h>
85 #include <libavfilter/buffersrc.h>
86 #endif //QTAV_HAVE(AVFILTER)
87 
88 #if QTAV_HAVE(AVDEVICE)
89 #include <libavdevice/avdevice.h>
90 #endif
91 
92 #ifdef __cplusplus
93 }
94 #endif /*__cplusplus*/
95 
121 #ifndef AV_VERSION_INT
122 #define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
123 #endif /*AV_VERSION_INT*/
124 
125 void ffmpeg_version_print();
126 
127 #if !FFMPEG_MODULE_CHECK(LIBAVFORMAT, 56, 4, 101)
128 int avio_feof(AVIOContext *s);
129 #endif
130 #if QTAV_USE_LIBAV(LIBAVFORMAT)
131 int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename);
132 #endif
133 //TODO: always inline
134 /* --gnu option of the RVCT compiler also defines __GNUC__ */
135 #if defined(__GNUC__) && !(defined(__ARMCC__) || defined(__CC_ARM))
136 #define GCC_VERSION_AT_LEAST(major, minor, patch) \
137  (__GNUC__ > major || (__GNUC__ == major && (__GNUC_MINOR__ > minor \
138  || (__GNUC_MINOR__ == minor && __GNUC_PATCHLEVEL__ >= patch))))
139 #else
140 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
141 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0
142 #endif
143 
144 //FFmpeg2.0, Libav10 2013-03-08 - Reference counted buffers - lavu 52.19.100/52.8.0, lavc 55.0.100 / 55.0.0, lavf 55.0.100 / 55.0.0, lavd 54.4.100 / 54.0.0, lavfi 3.5.0
145 #define QTAV_HAVE_AVBUFREF AV_MODULE_CHECK(LIBAVUTIL, 52, 8, 0, 19, 100)
146 
147 #if defined(_MSC_VER) || !defined(av_err2str) || (GCC_VERSION_AT_LEAST(4, 7, 0) && __cplusplus)
148 #ifdef av_err2str
149 #undef av_err2str
150 /*#define av_make_error_string qtav_make_error_string*/
151 #else
152 
162 static av_always_inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
163 {
164  av_strerror(errnum, errbuf, errbuf_size);
165  return errbuf;
166 }
167 #endif /*av_err2str*/
168 
169 #define AV_ERROR_MAX_STRING_SIZE 64
170 #ifdef QT_CORE_LIB
171 #include <QtCore/QSharedPointer>
172 #define av_err2str(e) av_err2str_qsp(e).data()
173 av_always_inline QSharedPointer<char> av_err2str_qsp(int errnum)
174 {
175  QSharedPointer<char> str((char*)calloc(AV_ERROR_MAX_STRING_SIZE, 1), ::free);
176  av_strerror(errnum, str.data(), AV_ERROR_MAX_STRING_SIZE);
177  return str;
178 }
179 #else
180 av_always_inline char* av_err2str(int errnum)
181 {
182  static char str[AV_ERROR_MAX_STRING_SIZE];
183  memset(str, 0, sizeof(str));
184  return av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, errnum);
185 }
186 #endif /* QT_CORE_LIB */
187 #endif
189 #if (LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52,23,0))
190 #define avcodec_decode_audio3(avctx, samples, frame_size_ptr, avpkt) \
191  avcodec_decode_audio2(avctx, samples, frame_size_ptr, (*avpkt).data, (*avpkt).size);
192 
193 #endif /*AV_VERSION_INT(52,23,0)*/
194 
195 #if (LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52,101,0))
196 #define av_dump_format(...) dump_format(__VA_ARGS__)
197 #endif /*AV_VERSION_INT(52,101,0)*/
198 
199 #if QTAV_HAVE(SWRESAMPLE) && (LIBSWRESAMPLE_VERSION_INT <= AV_VERSION_INT(0, 5, 0))
200 #define swresample_version() LIBSWRESAMPLE_VERSION_INT //we can not know the runtime version, so just use build time version
201 #define swresample_configuration() "Not available."
202 #define swresample_license() "Not available."
203 #endif
204 
205 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 32, 0)
206 int64_t av_get_default_channel_layout(int nb_channels);
207 #endif
208 /*
209  * mapping avresample to swresample
210  * https://github.com/xbmc/xbmc/commit/274679d
211  */
212 #if (QTAV_HAVE(SWR_AVR_MAP) || !QTAV_HAVE(SWRESAMPLE)) && QTAV_HAVE(AVRESAMPLE)
213 #ifndef SWR_CH_MAX
214 #ifdef AVRESAMPLE_MAX_CHANNELS
215 #define SWR_CH_MAX AVRESAMPLE_MAX_CHANNELS
216 #else
217 #define SWR_CH_MAX 64
218 #endif //AVRESAMPLE_MAX_CHANNELS
219 #endif //SWR_CH_MAX
220 #define SwrContext AVAudioResampleContext
221 #define swr_init(ctx) avresample_open(ctx)
222 //free context and set pointer to null. see swresample
223 #define swr_free(ctx) \
224  if (ctx && *ctx) { \
225  avresample_close(*ctx); \
226  *ctx = 0; \
227  }
228 #define swr_get_class() avresample_get_class()
229 #define swr_alloc() avresample_alloc_context()
230 //#define swr_next_pts()
231 #define swr_set_compensation() avresample_set_compensation()
232 #define swr_set_channel_mapping(ctx, map) avresample_set_channel_mapping(ctx, map)
233 #define swr_set_matrix(ctx, matrix, stride) avresample_set_matrix(ctx, matrix, stride)
234 //#define swr_drop_output(ctx, count)
235 //#define swr_inject_silence(ctx, count)
236 #define swr_get_delay(ctx, ...) avresample_get_delay(ctx)
237 #if LIBAVRESAMPLE_VERSION_INT >= AV_VERSION_INT(1, 0, 0) //ffmpeg >= 1.1
238 #define swr_convert(ctx, out, out_count, in, in_count) \
239  avresample_convert(ctx, out, 0, out_count, const_cast<uint8_t**>(in), 0, in_count)
240 #else
241 #define swr_convert(ctx, out, out_count, in, in_count) \
242  avresample_convert(ctx, (void**)out, 0, out_count, (void**)in, 0, in_count)
243 #define HAVE_SWR_GET_DELAY 1
244 #define swr_get_delay(ctx, ...) avresample_get_delay(ctx)
245 #endif
246 struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx);
247 #define swresample_version() avresample_version()
248 #define swresample_configuration() avresample_configuration()
249 #define swresample_license() avresample_license()
250 #endif //MAP_SWR_AVR
251 
252 
253 /* For FFmpeg < 2.0
254  * FF_API_PIX_FMT macro?
255  * 51.42.0: PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat
256  * so I introduce QTAV_PIX_FMT_C(X) for internal use
257  * FFmpeg n1.1 AVPixelFormat
258  */
259 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 13, 100) //(51, 42, 0)
260 typedef enum PixelFormat AVPixelFormat; // so we must avoid using enum AVPixelFormat
261 #define QTAV_PIX_FMT_C(X) PIX_FMT_##X
262 #else //FFmpeg >= 2.0
263 typedef enum AVPixelFormat AVPixelFormat;
264 #define QTAV_PIX_FMT_C(X) AV_PIX_FMT_##X
265 #endif //AV_VERSION_INT(51, 42, 0)
266 // FF_API_PIX_FMT
267 #ifdef PixelFormat
268 #undef PixelFormat
269 #endif
270 
271 // AV_PIX_FMT_FLAG_XXX was PIX_FMT_XXX before FFmpeg 2.0
272 // AV_PIX_FMT_FLAG_ALPHA was added at 52.2.0. but version.h not changed
273 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 2, 1) //git cbe5a60c9d495df0fb4775b064f06719b70b9952
274 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 22, 1) //git 38d553322891c8e47182f05199d19888422167dc
275 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 19, 0) //git 6b0768e2021b90215a2ab55ed427bce91d148148
276 #define PIX_FMT_PLANAR 16
277 #define PIX_FMT_RGB 32
278 #endif //AV_VERSION_INT(51, 19, 0)
279 #define PIX_FMT_PSEUDOPAL 64 //why not defined in FFmpeg 0.9 lavu51.32.0 but git log says 51.22.1 defined it?
280 #endif //AV_VERSION_INT(51, 22, 1)
281 #define PIX_FMT_ALPHA 128
282 #endif //AV_VERSION_INT(52, 2, 1)
283 
284 #ifndef PIX_FMT_PLANAR
285 #define PIX_FMT_PLANAR 16
286 #endif //PIX_FMT_PLANAR
287 #ifndef PIX_FMT_RGB
288 #define PIX_FMT_RGB 32
289 #endif //PIX_FMT_RGB
290 #ifndef PIX_FMT_PSEUDOPAL
291 #define PIX_FMT_PSEUDOPAL 64
292 #endif //PIX_FMT_PSEUDOPAL
293 #ifndef PIX_FMT_ALPHA
294 #define PIX_FMT_ALPHA 128
295 #endif //PIX_FMT_ALPHA
296 
297 /*
298  * rename PIX_FMT_* flags to AV_PIX_FMT_FLAG_*. git e6c4ac7b5f038be56dfbb0171f5dd0cb850d9b28
299  */
300 //#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 11, 0)
301 #ifndef AV_PIX_FMT_FLAG_BE
302 #define AV_PIX_FMT_FLAG_BE PIX_FMT_BE
303 #define AV_PIX_FMT_FLAG_PAL PIX_FMT_PAL
304 #define AV_PIX_FMT_FLAG_BITSTREAM PIX_FMT_BITSTREAM
305 #define AV_PIX_FMT_FLAG_HWACCEL PIX_FMT_HWACCEL
306 
307 // FFmpeg >= 0.9, libav >= 0.8.8(51,22,1)
308 #define AV_PIX_FMT_FLAG_PLANAR PIX_FMT_PLANAR
309 #define AV_PIX_FMT_FLAG_RGB PIX_FMT_RGB
310 
311 // FFmpeg >= 1.0, libav >= 9.7
312 #define AV_PIX_FMT_FLAG_PSEUDOPAL PIX_FMT_PSEUDOPAL
313 // FFmpeg >= 1.1, libav >= 9.7
314 #define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_ALPHA
315 #endif //AV_PIX_FMT_FLAG_BE
316 //#endif //AV_VERSION_INT(52, 11, 0)
317 // FFmpeg >= 1.1, but use internal av_pix_fmt_descriptors. FFmpeg < 1.1 has extern av_pix_fmt_descriptors
318 // used by av_pix_fmt_count_planes
319 #if !AV_MODULE_CHECK(LIBAVUTIL, 52, 3, 0, 13, 100)
323 #endif // !AV_MODULE_CHECK(LIBAVUTIL, 52, 3, 0, 13, 100)
324 #if !FFMPEG_MODULE_CHECK(LIBAVUTIL, 52, 48, 101) // since ffmpeg2.1, libavutil53.16.0 (FF_API_AVFRAME_COLORSPACE), git 8c02adc
325 enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
327 #endif
328 /*
329  * lavu 52.9.0 git 2c328a907978b61949fd20f7c991803174337855
330  * FFmpeg >= 2.0.
331  */
332 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 38, 100)
334 #endif //AV_VERSION_INT(52, 38, 100)
335 
336 // FFmpeg < 1.0 has no av_samples_copy
337 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 73, 101)
338 
349 int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
350  int src_offset, int nb_samples, int nb_channels,
351  enum AVSampleFormat sample_fmt);
352 #endif //AV_VERSION_INT(51, 73, 101)
353 
354 // < ffmpeg 1.0
355 //#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 59, 100)
356 #if AV_MODULE_CHECK(LIBAVCODEC, 54, 25, 0, 51, 100)
357 #define QTAV_CODEC_ID(X) AV_CODEC_ID_##X
358 #else
359 typedef enum CodecID AVCodecID;
360 #define QTAV_CODEC_ID(X) CODEC_ID_##X
361 #endif
362 
363 /* av_frame_alloc
364  * since FFmpeg2.0: 2.0.4 avcodec-55.18.102, avutil-52.38.100 (1.2.7 avcodec-54.92.100,avutil-52.18.100)
365  * since libav10.0: 10.2 avcodec55.34.1, avutil-53.3.0
366  * the same as avcodec_alloc_frame() (deprecated since 2.2). AVFrame was in avcodec.h, now in avutil/frame.h
367  */
368 #if !AV_MODULE_CHECK(LIBAVCODEC, 55, 34, 0, 18, 100)
369 #define av_frame_alloc() avcodec_alloc_frame()
370 #if QTAV_USE_LIBAV(LIBAVCODEC) || FFMPEG_MODULE_CHECK(LIBAVCODEC, 54, 59, 100)
371 #define av_frame_free(f) avcodec_free_frame(f)
372 #else
373 #define av_frame_free(f) av_free(f)
374 #endif
375 #endif
376 
377 #if QTAV_USE_LIBAV(LIBAVCODEC)
378 const char *avcodec_get_name(enum AVCodecID id);
379 #endif
380 #if !AV_MODULE_CHECK(LIBAVCODEC, 55, 55, 0, 68, 100)
381 void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb);
382 #endif
383 // since libav-11, ffmpeg-2.1
384 #if !LIBAV_MODULE_CHECK(LIBAVCODEC, 56, 1, 0) && !FFMPEG_MODULE_CHECK(LIBAVCODEC, 55, 39, 100)
385 int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
386 #endif
387 // since libav-10, ffmpeg-2.1
388 #if !LIBAV_MODULE_CHECK(LIBAVCODEC, 55, 34, 1) && !FFMPEG_MODULE_CHECK(LIBAVCODEC, 55, 39, 100)
390 #endif
391 //ffmpeg2.1 libav10
392 #if !AV_MODULE_CHECK(LIBAVCODEC, 55, 34, 1, 39, 101)
393 int av_packet_ref(AVPacket *dst, const AVPacket *src);
394 #define av_packet_unref(pkt) av_free_packet(pkt)
395 #endif
396 
397 #if !AV_MODULE_CHECK(LIBAVCODEC, 55, 52, 0, 63, 100)
399 #endif
400 
401 #if QTAV_HAVE(AVFILTER)
402 // ffmpeg2.0 2013-07-03 - 838bd73 - lavfi 3.78.100 - avfilter.h
403 #if QTAV_USE_LIBAV(LIBAVFILTER)
404 #define avfilter_graph_parse_ptr(pGraph, pFilters, ppInputs, ppOutputs, pLog) avfilter_graph_parse(pGraph, pFilters, *ppInputs, *ppOutputs, pLog)
405 #elif !FFMPEG_MODULE_CHECK(LIBAVFILTER, 3, 78, 100)
406 #define avfilter_graph_parse_ptr(pGraph, pFilters, ppInputs, ppOutputs, pLog) avfilter_graph_parse(pGraph, pFilters, ppInputs, ppOutputs, pLog)
407 #endif //QTAV_USE_LIBAV(LIBAVFILTER)
408 
409 //ffmpeg1.0 2012-06-12 - c7b9eab / 84b9fbe - lavfi 2.79.100 / 2.22.0 - avfilter.h
410 #if !AV_MODULE_CHECK(LIBAVFILTER, 2, 22, 0, 79, 100) //FF_API_AVFILTERPAD_PUBLIC
411 const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx);
412 enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx);
413 #endif
414 #if QTAV_USE_FFMPEG(LIBAVFILTER)
416 #ifdef __cplusplus
417 extern "C" {
418 #endif /* __cplusplus */
419 struct AVFilterBufferRef;
420 int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
421 #ifdef __cplusplus
422 }
423 #endif /* __cplusplus */
424 #endif
425 #endif //QTAV_HAVE(AVFILTER)
426 
427 /* helper functions */
428 const char *get_codec_long_name(AVCodecID id);
429 
430 // AV_CODEC_ID_H265 is a macro defined as AV_CODEC_ID_HEVC in ffmpeg but not in libav. so we can use FF_PROFILE_HEVC_MAIN to avoid libavcodec version check. (from ffmpeg 2.1)
431 #ifndef FF_PROFILE_HEVC_MAIN //libav does not define it
432 #define AV_CODEC_ID_HEVC ((AVCodecID)0) //QTAV_CODEC_ID(NONE)
433 #define CODEC_ID_HEVC ((AVCodecID)0) //QTAV_CODEC_ID(NONE)
434 #define FF_PROFILE_HEVC_MAIN -1
435 #define FF_PROFILE_HEVC_MAIN_10 -1
436 #endif
437 #if !FFMPEG_MODULE_CHECK(LIBAVCODEC, 54, 92, 100) && !LIBAV_MODULE_CHECK(LIBAVCODEC, 55, 34, 1) //ffmpeg1.2 libav10
438 #define AV_CODEC_ID_VP9 ((AVCodecID)0) //QTAV_CODEC_ID(NONE)
439 #define CODEC_ID_VP9 ((AVCodecID)0) //QTAV_CODEC_ID(NONE)
440 #endif
441 #ifndef FF_PROFILE_VP9_0
442 #define FF_PROFILE_VP9_0 0
443 #define FF_PROFILE_VP9_1 1
444 #define FF_PROFILE_VP9_2 2
445 #define FF_PROFILE_VP9_3 3
446 #endif
447 
448 #define AV_RUN_CHECK(FUNC, RETURN, ...) do { \
449  int ret = FUNC; \
450  if (ret < 0) { \
451  char str[AV_ERROR_MAX_STRING_SIZE]; \
452  memset(str, 0, sizeof(str)); \
453  av_strerror(ret, str, sizeof(str)); \
454  av_log(NULL, AV_LOG_WARNING, "Error " #FUNC " @%d " __FILE__ ": (%#x) %s\n", __LINE__, ret, str); \
455  RETURN __VA_ARGS__; \
456  } } while(0)
457 
458 #endif //QTAV_COMPAT_H
Definition: avformat.h:523
int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
enum PixelFormat AVPixelFormat
Definition: AVCompat.h:260
int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename)
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
void av_packet_free_side_data(AVPacket *pkt)
Definition: frame.h:184
enum CodecID AVCodecID
Definition: AVCompat.h:359
void avcodec_free_context(AVCodecContext **avctx)
AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
AVColorSpace
Definition: pixfmt.h:436
void ffmpeg_version_print()
int av_packet_ref(AVPacket *dst, const AVPacket *src)
AVColorRange
Definition: pixfmt.h:457
AVCodecID
Definition: avcodec.h:191
Definition: avcodec.h:1578
const char * get_codec_long_name(AVCodecID id)
struct SwrContext SwrContext
Definition: swresample.h:186
void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
struct SwrContext * swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
const char * avcodec_get_name(enum AVCodecID id)
int avio_feof(AVIOContext *s)
AVSampleFormat
Definition: samplefmt.h:58
Definition: avcodec.h:1676
enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame)
av_always_inline char * av_err2str(int errnum)
Definition: AVCompat.h:180
AVMediaType
Definition: avutil.h:193
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Definition: rational.h:58
Definition: avformat.h:1338
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
int av_pix_fmt_count_planes(AVPixelFormat pix_fmt)
int64_t av_get_default_channel_layout(int nb_channels)
Definition: avio.h:147
Definition: pixdesc.h:81
const AVPixFmtDescriptor * av_pix_fmt_desc_get(AVPixelFormat pix_fmt)
struct AVFilterPad AVFilterPad
Definition: avfilter.h:69
#define AV_ERROR_MAX_STRING_SIZE
Definition: AVCompat.h:169
#define av_always_inline
Definition: attributes.h:43
enum AVColorRange av_frame_get_color_range(const AVFrame *frame)
AVPixelFormat
Definition: pixfmt.h:60