summaryrefslogtreecommitdiffstats
path: root/libhb/muxavformat.c
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2021-02-01 09:51:10 +0100
committerDamiano Galassi <[email protected]>2021-02-01 09:51:56 +0100
commit876fe182643e21e0541602995a75c69d2773992c (patch)
treeb3ab7133243b618260cff9c676225312ef893cd9 /libhb/muxavformat.c
parentf8525c66f1666f3a2d09dfe6e0ae73f375bfd788 (diff)
libhb: passthru mastering display metadata and content light level metadata.
Diffstat (limited to 'libhb/muxavformat.c')
-rw-r--r--libhb/muxavformat.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c
index 9c8898c28..391782e80 100644
--- a/libhb/muxavformat.c
+++ b/libhb/muxavformat.c
@@ -154,9 +154,9 @@ static int avformatInit( hb_mux_object_t * m )
av_dict_set(&av_opts, "brand", "mp42", 0);
if (job->mp4_optimize)
- av_dict_set(&av_opts, "movflags", "faststart+disable_chpl", 0);
+ av_dict_set(&av_opts, "movflags", "faststart+disable_chpl+write_colr", 0);
else
- av_dict_set(&av_opts, "movflags", "+disable_chpl", 0);
+ av_dict_set(&av_opts, "movflags", "+disable_chpl+write_colr", 0);
break;
case HB_MUX_AV_MKV:
@@ -445,6 +445,42 @@ static int avformatInit( hb_mux_object_t * m )
track->st->codecpar->height = job->height;
track->st->disposition |= AV_DISPOSITION_DEFAULT;
+ track->st->codecpar->color_primaries = job->color_prim;
+ track->st->codecpar->color_trc = job->color_transfer;
+ track->st->codecpar->color_space = job->color_matrix;
+ track->st->codecpar->color_range = job->color_range;
+
+ if (job->color_transfer == HB_COLR_TRA_SMPTEST2084)
+ {
+ if (job->mastering.has_primaries || job->mastering.has_luminance)
+ {
+ AVMasteringDisplayMetadata mastering = hb_mastering_hb_to_ff(job->mastering);
+
+ uint8_t *mastering_data = av_malloc(sizeof(AVMasteringDisplayMetadata));
+ memcpy(mastering_data, &mastering, sizeof(AVMasteringDisplayMetadata));
+
+ av_stream_add_side_data(track->st,
+ AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
+ mastering_data,
+ sizeof(AVMasteringDisplayMetadata));
+ }
+
+ if (job->coll.max_cll && job->coll.max_fall)
+ {
+ AVContentLightMetadata coll;
+ coll.MaxCLL = job->coll.max_cll;
+ coll.MaxFALL = job->coll.max_fall;
+
+ uint8_t *coll_data = av_malloc(sizeof(AVContentLightMetadata));
+ memcpy(coll_data, &coll, sizeof(AVContentLightMetadata));
+
+ av_stream_add_side_data(track->st,
+ AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
+ coll_data,
+ sizeof(AVContentLightMetadata));
+ }
+ }
+
hb_rational_t vrate = job->vrate;
// If the vrate is the internal clock rate, there's a good chance