summaryrefslogtreecommitdiffstats
path: root/audio/decode/ad_lavc.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/decode/ad_lavc.c')
-rw-r--r--audio/decode/ad_lavc.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index e28558414d..c4d3a2ae7b 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -100,7 +100,6 @@ static int init(struct dec_audio *da, const char *decoder)
lavc_context = avcodec_alloc_context3(lavc_codec);
ctx->avctx = lavc_context;
ctx->avframe = av_frame_alloc();
- lavc_context->refcounted_frames = 1;
lavc_context->codec_type = AVMEDIA_TYPE_AUDIO;
lavc_context->codec_id = lavc_codec->id;
@@ -207,7 +206,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 +218,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 +225,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)