From 3eceac2eab0b42ee082a0b615ebf40a21f0fb915 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 7 Dec 2016 19:44:29 +0100 Subject: Remove compatibility things Possible with bumped FFmpeg/Libav. These are just the simple cases. --- common/av_common.c | 5 ----- common/av_common.h | 9 --------- common/av_log.c | 2 -- common/encode_lavc.c | 18 ------------------ 4 files changed, 34 deletions(-) (limited to 'common') diff --git a/common/av_common.c b/common/av_common.c index 27a331927a..f2f43498e3 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -77,13 +77,8 @@ void mp_copy_lav_codec_headers(AVCodecContext *avctx, AVCodecContext *st) // other demuxers must be handled manually. void mp_set_lav_codec_headers(AVCodecContext *avctx, struct mp_codec_params *c) { -#if HAVE_AVCODEC_HAS_CODECPAR if (c->lav_codecpar) avcodec_parameters_to_context(avctx, c->lav_codecpar); -#else - if (c->lav_headers) - mp_copy_lav_codec_headers(avctx, c->lav_headers); -#endif } // Pick a "good" timebase, which will be used to convert double timestamps diff --git a/common/av_common.h b/common/av_common.h index b5ca034def..4b13dcdd0c 100644 --- a/common/av_common.h +++ b/common/av_common.h @@ -46,13 +46,4 @@ void mp_set_avdict(struct AVDictionary **dict, char **kv); void mp_avdict_print_unset(struct mp_log *log, int msgl, struct AVDictionary *d); int mp_set_avopts(struct mp_log *log, void *avobj, char **kv); -#if (LIBAVCODEC_VERSION_MICRO >= 100 && \ - LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 61, 100)) || \ - (LIBAVCODEC_VERSION_MICRO < 100 && \ - LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 24, 0)) -#define MP_AVFRAME_DEC_PTS(frame) ((frame)->pts) -#else -#define MP_AVFRAME_DEC_PTS(frame) ((frame)->pkt_pts) -#endif - #endif diff --git a/common/av_log.c b/common/av_log.c index 64ce26d853..e2a4c3316e 100644 --- a/common/av_log.c +++ b/common/av_log.c @@ -218,9 +218,7 @@ bool print_libav_versions(struct mp_log *log, int v) mp_msg(log, v, "\n"); } -#if HAVE_AV_VERSION_INFO mp_msg(log, v, "%s version: %s\n", LIB_PREFIX, av_version_info()); -#endif return !mismatch; } diff --git a/common/encode_lavc.c b/common/encode_lavc.c index d0523857ee..7e116e3b0c 100644 --- a/common/encode_lavc.c +++ b/common/encode_lavc.c @@ -595,12 +595,7 @@ int encode_lavc_alloc_stream(struct encode_lavc_context *ctx, } return -1; } -#if HAVE_AVCODEC_HAS_CODECPAR ctx->vcc = avcodec_alloc_context3(ctx->vc); -#else - avcodec_get_context_defaults3(ctx->vst->codec, ctx->vc); - ctx->vcc = ctx->vst->codec; -#endif // Using codec->time_base is deprecated, but needed for older lavf. ctx->vst->time_base = ctx->timebase; @@ -635,12 +630,7 @@ int encode_lavc_alloc_stream(struct encode_lavc_context *ctx, } return -1; } -#if HAVE_AVCODEC_HAS_CODECPAR ctx->acc = avcodec_alloc_context3(ctx->ac); -#else - avcodec_get_context_defaults3(ctx->ast->codec, ctx->ac); - ctx->acc = ctx->ast->codec; -#endif // Using codec->time_base is deprecated, but needed for older lavf. ctx->ast->time_base = ctx->timebase; @@ -708,10 +698,8 @@ int encode_lavc_open_codec(struct encode_lavc_context *ctx, } ret = avcodec_open2(codec, ctx->vc, &ctx->voptions); -#if HAVE_AVCODEC_HAS_CODECPAR if (ret >= 0) ret = avcodec_parameters_from_context(ctx->vst->codecpar, codec); -#endif // complain about all remaining options, then free the dict for (de = NULL; (de = av_dict_get(ctx->voptions, "", de, @@ -747,10 +735,8 @@ int encode_lavc_open_codec(struct encode_lavc_context *ctx, } ret = avcodec_open2(codec, ctx->ac, &ctx->aoptions); -#if HAVE_AVCODEC_HAS_CODECPAR if (ret >= 0) ret = avcodec_parameters_from_context(ctx->ast->codecpar, codec); -#endif // complain about all remaining options, then free the dict for (de = NULL; (de = av_dict_get(ctx->aoptions, "", de, @@ -826,11 +812,7 @@ int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVStream *stream, (int)packet->size); -#if HAVE_AVCODEC_HAS_CODECPAR switch (stream->codecpar->codec_type) { -#else - switch (stream->codec->codec_type) { -#endif case AVMEDIA_TYPE_VIDEO: ctx->vbytes += packet->size; ++ctx->frames; -- cgit v1.2.3