summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-29 13:49:39 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-30 03:10:27 -0800
commit1d5991ef306f5a0306f79ba99ae5a919357b18ff (patch)
tree755afc22d3261c7bb14f2d8ccb2c94507c7eeb0a /video/mp_image.c
parent3d367e009c22e390c021bd6b2be32adc641222e7 (diff)
downloadmpv-1d5991ef306f5a0306f79ba99ae5a919357b18ff.tar.bz2
mpv-1d5991ef306f5a0306f79ba99ae5a919357b18ff.tar.xz
mp_image: preserve AVFrame closed captions data
This is preparation for a change in vd_lavc.c: it should not have to access the demuxer (to pass along closed captions), so the idea is to make them part of mp_image, and to let the layer above vd_lavc propagate the buffer. Don't bother with preserving them for mp_image->AVFrame, because we don't need this.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 0c07fd3098..f6b6045c6d 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -208,6 +208,7 @@ static void mp_image_destructor(void *ptr)
av_buffer_unref(&mpi->bufs[p]);
av_buffer_unref(&mpi->hwctx);
av_buffer_unref(&mpi->icc_profile);
+ av_buffer_unref(&mpi->a53_cc);
}
int mp_chroma_div_up(int size, int shift)
@@ -326,6 +327,7 @@ struct mp_image *mp_image_new_ref(struct mp_image *img)
fail |= !ref_buffer(&new->hwctx);
fail |= !ref_buffer(&new->icc_profile);
+ fail |= !ref_buffer(&new->a53_cc);
if (!fail)
@@ -891,6 +893,10 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
if (mdm->has_luminance)
dst->params.color.sig_peak = av_q2d(mdm->max_luminance) / MP_REF_WHITE;
}
+
+ sd = av_frame_get_side_data(src, AV_FRAME_DATA_A53_CC);
+ if (sd)
+ dst->a53_cc = av_buffer_ref(sd->buf);
#endif
if (dst->hwctx) {