mirror of https://github.com/mpv-player/mpv
mp_image: add dolbyvision metadata
Co-authored-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
parent
777628e761
commit
0e5f7b48d2
|
@ -204,6 +204,7 @@ static void mp_image_destructor(void *ptr)
|
|||
av_buffer_unref(&mpi->hwctx);
|
||||
av_buffer_unref(&mpi->icc_profile);
|
||||
av_buffer_unref(&mpi->a53_cc);
|
||||
av_buffer_unref(&mpi->dovi);
|
||||
for (int n = 0; n < mpi->num_ff_side_data; n++)
|
||||
av_buffer_unref(&mpi->ff_side_data[n].buf);
|
||||
talloc_free(mpi->ff_side_data);
|
||||
|
@ -340,6 +341,7 @@ struct mp_image *mp_image_new_ref(struct mp_image *img)
|
|||
ref_buffer(&ok, &new->hwctx);
|
||||
ref_buffer(&ok, &new->icc_profile);
|
||||
ref_buffer(&ok, &new->a53_cc);
|
||||
ref_buffer(&ok, &new->dovi);
|
||||
|
||||
new->ff_side_data = talloc_memdup(NULL, new->ff_side_data,
|
||||
new->num_ff_side_data * sizeof(new->ff_side_data[0]));
|
||||
|
@ -381,6 +383,7 @@ struct mp_image *mp_image_new_dummy_ref(struct mp_image *img)
|
|||
new->hwctx = NULL;
|
||||
new->icc_profile = NULL;
|
||||
new->a53_cc = NULL;
|
||||
new->dovi = NULL;
|
||||
new->num_ff_side_data = 0;
|
||||
new->ff_side_data = NULL;
|
||||
return new;
|
||||
|
@ -530,6 +533,7 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
|
|||
}
|
||||
}
|
||||
assign_bufref(&dst->icc_profile, src->icc_profile);
|
||||
assign_bufref(&dst->dovi, src->dovi);
|
||||
assign_bufref(&dst->a53_cc, src->a53_cc);
|
||||
}
|
||||
|
||||
|
@ -1004,6 +1008,12 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
|
|||
if (sd)
|
||||
dst->a53_cc = sd->buf;
|
||||
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 16, 100)
|
||||
sd = av_frame_get_side_data(src, AV_FRAME_DATA_DOVI_METADATA);
|
||||
if (sd)
|
||||
dst->dovi = sd->buf;
|
||||
#endif
|
||||
|
||||
for (int n = 0; n < src->nb_side_data; n++) {
|
||||
sd = src->side_data[n];
|
||||
struct mp_ff_side_data mpsd = {
|
||||
|
|
|
@ -108,6 +108,8 @@ typedef struct mp_image {
|
|||
struct AVBufferRef *icc_profile;
|
||||
// Closed captions packet, if any (only after decoder)
|
||||
struct AVBufferRef *a53_cc;
|
||||
// Dolby Vision metadata, if any
|
||||
struct AVBufferRef *dovi;
|
||||
// Other side data we don't care about.
|
||||
struct mp_ff_side_data *ff_side_data;
|
||||
int num_ff_side_data;
|
||||
|
|
Loading…
Reference in New Issue