From b34befbab8b7d42447592a3c6652fbf73d51f762 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 24 Mar 2016 16:38:14 +0100 Subject: vd_lavc: slightly improve codec_timebase hack The mp_set_av_packet()/mp_pts_from_av() functions check whether the timebase is set at all (i.e. AVRational.num!=0), so there's no need to fiddle with pointers. --- video/decode/vd_lavc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 7217b2b9e7..56633c0227 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -646,7 +646,6 @@ static void decode(struct dec_video *vd, struct demux_packet *packet, vd_ffmpeg_ctx *ctx = vd->priv; AVCodecContext *avctx = ctx->avctx; struct vd_lavc_params *opts = ctx->opts->vd_lavc_params; - AVRational *tb = ctx->codec_timebase.num ? &ctx->codec_timebase : NULL; AVPacket pkt; if (!avctx) @@ -660,7 +659,7 @@ static void decode(struct dec_video *vd, struct demux_packet *packet, avctx->skip_frame = ctx->skip_frame; } - mp_set_av_packet(&pkt, packet, tb); + mp_set_av_packet(&pkt, packet, &ctx->codec_timebase); ctx->flushing |= !pkt.data; // Reset decoder if hw state got reset, or new data comes during flushing. @@ -723,8 +722,8 @@ static void decode(struct dec_video *vd, struct demux_packet *packet, return; } assert(mpi->planes[0] || mpi->planes[3]); - mpi->pts = mp_pts_from_av(ctx->pic->pkt_pts, tb); - mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, tb); + mpi->pts = mp_pts_from_av(ctx->pic->pkt_pts, &ctx->codec_timebase); + mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, &ctx->codec_timebase); struct mp_image_params params; update_image_params(vd, ctx->pic, ¶ms); -- cgit v1.2.3