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. --- audio/decode/ad_lavc.c | 22 +--------------------- audio/decode/ad_spdif.c | 10 ---------- 2 files changed, 1 insertion(+), 31 deletions(-) (limited to 'audio/decode') diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index e28558414d..276ce69739 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -207,7 +207,6 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt, if (priv->needs_reset) control(da, ADCTRL_RESET, NULL); -#if HAVE_AVCODEC_NEW_CODEC_API int ret = avcodec_send_packet(avctx, &pkt); if (ret >= 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) { if (ret >= 0 && mpkt) @@ -220,24 +219,6 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt, if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) ret = 0; } -#else - int ret = avcodec_decode_audio4(avctx, priv->avframe, &got_frame, &pkt); - if (mpkt) { - // At least "shorten" decodes sub-frames, instead of the whole packet. - // At least "mpc8" can return 0 and wants the packet again next time. - if (ret >= 0) { - ret = FFMIN(ret, mpkt->len); // sanity check against decoder overreads - mpkt->buffer += ret; - mpkt->len -= ret; - mpkt->pts = MP_NOPTS_VALUE; // don't reset PTS next time - } - // LATM may need many packets to find mux info - if (ret == AVERROR(EAGAIN)) { - mpkt->len = 0; - return 0; - } - } -#endif if (ret < 0) { MP_ERR(da, "Error decoding audio.\n"); return -1; @@ -245,8 +226,7 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt, if (!got_frame) return 0; - double out_pts = mp_pts_from_av(MP_AVFRAME_DEC_PTS(priv->avframe), - &priv->codec_timebase); + double out_pts = mp_pts_from_av(priv->avframe->pts, &priv->codec_timebase); struct mp_audio *mpframe = mp_audio_from_avframe(priv->avframe); if (!mpframe) diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c index 56e4a8102d..e15aca5c53 100644 --- a/audio/decode/ad_spdif.c +++ b/audio/decode/ad_spdif.c @@ -116,16 +116,10 @@ static int determine_codec_profile(struct dec_audio *da, AVPacket *pkt) goto done; } -#if HAVE_AVCODEC_NEW_CODEC_API if (avcodec_send_packet(ctx, pkt) < 0) goto done; if (avcodec_receive_frame(ctx, frame) < 0) goto done; -#else - int got_frame = 0; - if (avcodec_decode_audio4(ctx, frame, &got_frame, pkt) < 1 || !got_frame) - goto done; -#endif profile = ctx->profile; @@ -178,11 +172,7 @@ static int init_filter(struct dec_audio *da, AVPacket *pkt) if (!stream) goto fail; -#if HAVE_AVCODEC_HAS_CODECPAR stream->codecpar->codec_id = spdif_ctx->codec_id; -#else - stream->codec->codec_id = spdif_ctx->codec_id; -#endif AVDictionary *format_opts = NULL; -- cgit v1.2.3