mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
30e94fa711
commit
b34befbab8
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue