metadata: more libav10 compatibility changes
Add a couple more compatibility wrappers.
This commit is contained in:
60
libav.h
60
libav.h
@ -78,6 +78,10 @@
|
||||
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT <= ((51<<16)+(50<<8)+1)
|
||||
#define CODEC_ID_WMAPRO CODEC_ID_NONE
|
||||
#endif
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 55
|
||||
#define AV_CODEC_ID_AAC CODEC_ID_AAC
|
||||
#define AV_CODEC_ID_AC3 CODEC_ID_AC3
|
||||
@ -103,3 +107,59 @@
|
||||
#define av_strerror(x, y, z) snprintf(y, z, "%d", x)
|
||||
#endif
|
||||
|
||||
#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(31<<8)+0)
|
||||
# if LIBAVUTIL_VERSION_INT < ((51<<16)+(5<<8)+0) && !defined(FF_API_OLD_METADATA2)
|
||||
#define AV_DICT_IGNORE_SUFFIX AV_METADATA_IGNORE_SUFFIX
|
||||
#define av_dict_get av_metadata_get
|
||||
typedef AVMetadataTag AVDictionaryEntry;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
lav_open(AVFormatContext **ctx, const char *filename)
|
||||
{
|
||||
int ret;
|
||||
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(17<<8)+0)
|
||||
ret = avformat_open_input(ctx, filename, NULL, NULL);
|
||||
if (ret == 0)
|
||||
avformat_find_stream_info(*ctx, NULL);
|
||||
#else
|
||||
ret = av_open_input_file(ctx, filename, NULL, 0, NULL);
|
||||
if (ret == 0)
|
||||
av_find_stream_info(*ctx);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
lav_close(AVFormatContext *ctx)
|
||||
{
|
||||
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(17<<8)+0)
|
||||
avformat_close_input(&ctx);
|
||||
#else
|
||||
av_close_input_file(ctx);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
lav_get_fps(AVStream *s)
|
||||
{
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
if (s->r_frame_rate.den)
|
||||
return s->r_frame_rate.num / s->r_frame_rate.den;
|
||||
#else
|
||||
if (s->avg_frame_rate.den)
|
||||
return s->avg_frame_rate.num / s->avg_frame_rate.den;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
lav_get_interlaced(AVCodecContext *vc, AVStream *s)
|
||||
{
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 54
|
||||
return (vc->time_base.den ? (s->r_frame_rate.num / vc->time_base.den) : 0);
|
||||
#else
|
||||
return (vc->time_base.den ? (s->avg_frame_rate.num / vc->time_base.den) : 0);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user