1 #pragma once 2 3 #include <libavcodec/avcodec.h> 4 5 /* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg 6 * a is the major version 7 * b and c the minor and micro versions of libav 8 * d and e the minor and micro versions of FFmpeg */ 9 #define LIBAVCODEC_VERSION_CHECK(a, b, c, d, e) \ 10 ((LIBAVCODEC_VERSION_MICRO < 100 && \ 11 LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, b, c)) || \ 12 (LIBAVCODEC_VERSION_MICRO >= 100 && \ 13 LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, d, e))) 14 15 #if !LIBAVCODEC_VERSION_CHECK(54, 28, 0, 59, 100) 16 #define avcodec_free_frame av_freep 17 #endif 18 19 #if LIBAVCODEC_VERSION_INT < 0x371c01 20 #define av_frame_alloc avcodec_alloc_frame 21 #define av_frame_unref avcodec_get_frame_defaults 22 #define av_frame_free avcodec_free_frame 23 #endif 24 25 #if LIBAVCODEC_VERSION_MAJOR >= 57 26 #define av_free_packet av_packet_unref 27 #endif 28 29 #if LIBAVCODEC_VERSION_MAJOR >= 58 30 #define CODEC_CAP_TRUNC AV_CODEC_CAP_TRUNCATED 31 #define CODEC_FLAG_TRUNC AV_CODEC_FLAG_TRUNCATED 32 #define CODEC_FLAG_GLOBAL_H AV_CODEC_FLAG_GLOBAL_HEADER 33 #else 34 #define CODEC_CAP_TRUNC CODEC_CAP_TRUNCATED 35 #define CODEC_FLAG_TRUNC CODEC_FLAG_TRUNCATED 36 #define CODEC_FLAG_GLOBAL_H CODEC_FLAG_GLOBAL_HEADER 37 #endif 38