From f0febc35eb0bf7376e31e3d325a84b532aa2b886 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 24 Mar 2016 16:39:15 +0100 Subject: ad_lavc: add codec_timebase hack too vd_lavc.c had this, and soon I'll need it in ad_lavc.c too. For now it's unused. --- audio/decode/ad_lavc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'audio') diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index c30aff7fd5..0c61c03986 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -45,6 +45,7 @@ struct priv { uint32_t skip_samples, trim_samples; bool preroll_done; double next_pts; + AVRational codec_timebase; }; static void uninit(struct dec_audio *da); @@ -84,6 +85,8 @@ static int init(struct dec_audio *da, const char *decoder) struct priv *ctx = talloc_zero(NULL, struct priv); da->priv = ctx; + ctx->codec_timebase = (AVRational){0}; + ctx->force_channel_map = c->force_channels; lavc_codec = avcodec_find_decoder_by_name(decoder); @@ -185,7 +188,7 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt, int in_len = mpkt ? mpkt->len : 0; AVPacket pkt; - mp_set_av_packet(&pkt, mpkt, NULL); + mp_set_av_packet(&pkt, mpkt, &priv->codec_timebase); int got_frame = 0; av_frame_unref(priv->avframe); @@ -212,7 +215,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(priv->avframe->pkt_pts, NULL); + double out_pts = mp_pts_from_av(priv->avframe->pkt_pts, &priv->codec_timebase); struct mp_audio *mpframe = mp_audio_from_avframe(priv->avframe); if (!mpframe) -- cgit v1.2.3