@@ -90,6 +90,23 @@ has a fixed framerate. Ignored if @option{tick_rate} is not also set.
@item delete_padding
Deletes Padding OBUs.
+@item hdr_cll
+@item hdr_mdcv
+Manipulate content light level (see AV1 section 6.7.3) and mastering
+display colour volume (see AV1 section 6.7.4) metadata messages in the
+stream.
+
+Possible actions:
+@table @samp
+@item insert
+Insert this type of message, taking the values from packet side-data.
+@item remove
+Remove all instances of this message.
+@item extract
+Extract the content of this type of message, attaching it to the packets
+as side-data.
+@end table
+
@end table
@section chomp
@@ -23,6 +23,7 @@
#include "cbs.h"
#include "cbs_bsf.h"
#include "cbs_av1.h"
+#include "cbs_metadata.h"
typedef struct AV1MetadataContext {
CBSBSFContext common;
@@ -40,6 +41,9 @@ typedef struct AV1MetadataContext {
int num_ticks_per_picture;
int delete_padding;
+
+ int hdr_cll;
+ int hdr_mdcv;
} AV1MetadataContext;
@@ -143,6 +147,20 @@ static int av1_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt,
}
}
+ if (pkt) {
+ err = ff_cbs_bsf_apply_metadata(bsf, pkt, frag,
+ CBS_METADATA_CONTENT_LIGHT_LEVEL,
+ ctx->hdr_mdcv);
+ if (err < 0)
+ return err;
+
+ err = ff_cbs_bsf_apply_metadata(bsf, pkt, frag,
+ CBS_METADATA_MASTERING_DISPLAY,
+ ctx->hdr_mdcv);
+ if (err < 0)
+ return err;
+ }
+
return 0;
}
@@ -203,6 +221,14 @@ static const AVOption av1_metadata_options[] = {
OFFSET(delete_padding), AV_OPT_TYPE_BOOL,
{ .i64 = 0 }, 0, 1, FLAGS},
+ BSF_ELEMENT_OPTIONS_PIRE("hdr_cll",
+ "HDR content light level metadata",
+ hdr_cll, FLAGS),
+
+ BSF_ELEMENT_OPTIONS_PIRE("hdr_mdcv",
+ "HDR mastering display colour volume metadata",
+ hdr_mdcv, FLAGS),
+
{ NULL }
};