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. --- demux/demux_lavf.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'demux/demux_lavf.c') diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 94bcd3fff6..124956378c 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -577,13 +577,8 @@ static void handle_new_stream(demuxer_t *demuxer, int i) AVFormatContext *avfc = priv->avfc; AVStream *st = avfc->streams[i]; struct sh_stream *sh = NULL; -#if HAVE_AVCODEC_HAS_CODECPAR AVCodecParameters *codec = st->codecpar; int lavc_delay = codec->initial_padding; -#else - AVCodecContext *codec = st->codec; - int lavc_delay = codec->delay; -#endif switch (codec->codec_type) { case AVMEDIA_TYPE_AUDIO: { @@ -679,17 +674,9 @@ static void handle_new_stream(demuxer_t *demuxer, int i) sh->ff_index = st->index; sh->codec->codec = mp_codec_from_av_codec_id(codec->codec_id); sh->codec->codec_tag = codec->codec_tag; -#if HAVE_AVCODEC_HAS_CODECPAR sh->codec->lav_codecpar = avcodec_parameters_alloc(); if (sh->codec->lav_codecpar) avcodec_parameters_copy(sh->codec->lav_codecpar, codec); -#else - sh->codec->codec = mp_codec_from_av_codec_id(codec->codec_id); - sh->codec->codec_tag = codec->codec_tag; - sh->codec->lav_headers = avcodec_alloc_context3(NULL); - if (sh->codec->lav_headers) - mp_copy_lav_codec_headers(sh->codec->lav_headers, codec); -#endif sh->codec->native_tb_num = st->time_base.num; sh->codec->native_tb_den = st->time_base.den; @@ -864,11 +851,9 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) .opaque = demuxer, }; -#if HAVE_AVFORMAT_IOOPEN avfc->opaque = demuxer; if (!demuxer->access_references) avfc->io_open = block_io_open; -#endif mp_set_avdict(&dopts, lavfdopts->avopts); @@ -953,14 +938,9 @@ static int demux_lavf_fill_buffer(demuxer_t *demux) if (pkt->dts != AV_NOPTS_VALUE) dp->dts = pkt->dts * av_q2d(st->time_base); dp->duration = pkt->duration * av_q2d(st->time_base); -#if !HAVE_AV_AVPACKET_INT64_DURATION - if (pkt->convergence_duration > 0) - dp->duration = pkt->convergence_duration * av_q2d(st->time_base); -#endif dp->pos = pkt->pos; dp->keyframe = pkt->flags & AV_PKT_FLAG_KEY; -#if LIBAVFORMAT_VERSION_MICRO >= 100 && \ - LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 50, 100) +#if LIBAVFORMAT_VERSION_MICRO >= 100 if (pkt->flags & AV_PKT_FLAG_DISCARD) MP_ERR(demux, "Edit lists are not correctly supported (FFmpeg issue).\n"); #endif @@ -1141,12 +1121,8 @@ static void demux_close_lavf(demuxer_t *demuxer) av_freep(&priv->pb->buffer); av_freep(&priv->pb); for (int n = 0; n < priv->num_streams; n++) { - if (priv->streams[n]) { - avcodec_free_context(&priv->streams[n]->codec->lav_headers); -#if HAVE_AVCODEC_HAS_CODECPAR + if (priv->streams[n]) avcodec_parameters_free(&priv->streams[n]->codec->lav_codecpar); -#endif - } } if (priv->own_stream) free_stream(priv->stream); -- cgit v1.2.3