summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-25 20:47:13 +0100
committerwm4 <wm4@nowhere>2016-01-25 21:46:39 +0100
commit271cabe6a5bd8342b56ab855d033abba63dfead6 (patch)
treed56df2cfb236ecca5f70123aeb891bfdae15aab7 /video/decode/vd_lavc.c
parent7f300b4204d33e33308d24eea9107ff60db36cc8 (diff)
downloadmpv-271cabe6a5bd8342b56ab855d033abba63dfead6.tar.bz2
mpv-271cabe6a5bd8342b56ab855d033abba63dfead6.tar.xz
video: cleanup pts/dts passing between decoder components
Instead of using semi-public codec_pts/codec_dts fields in struct dec_video, pass them via mp_image fields.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 9677e4c079..f480d185b6 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -676,11 +676,6 @@ static void decode(struct dec_video *vd, struct demux_packet *packet,
ctx->hwdec_fail_count = 0;
- struct mp_image_params params;
- update_image_params(vd, ctx->pic, &params);
- vd->codec_pts = mp_pts_from_av(ctx->pic->pkt_pts, NULL);
- vd->codec_dts = mp_pts_from_av(ctx->pic->pkt_dts, NULL);
-
AVFrameSideData *sd = NULL;
sd = av_frame_get_side_data(ctx->pic, AV_FRAME_DATA_A53_CC);
if (sd) {
@@ -692,12 +687,20 @@ static void decode(struct dec_video *vd, struct demux_packet *packet,
}
struct mp_image *mpi = mp_image_from_av_frame(ctx->pic);
- av_frame_unref(ctx->pic);
- if (!mpi)
+ if (!mpi) {
+ av_frame_unref(ctx->pic);
return;
+ }
assert(mpi->planes[0] || mpi->planes[3]);
+ mpi->pts = mp_pts_from_av(ctx->pic->pkt_pts, NULL);
+ mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, NULL);
+
+ struct mp_image_params params;
+ update_image_params(vd, ctx->pic, &params);
mp_image_set_params(mpi, &params);
+ av_frame_unref(ctx->pic);
+
if (ctx->hwdec && ctx->hwdec->process_image)
mpi = ctx->hwdec->process_image(ctx, mpi);