{ 0x3302, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x05,0x00,0x00,0x00}}, /* Horizontal Subsampling */
{ 0x3308, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x01,0x10,0x00,0x00,0x00}}, /* Vertical Subsampling */
{ 0x3303, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x06,0x00,0x00,0x00}}, /* Color Siting */
+ { 0x3304, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x03,0x03,0x00,0x00,0x00}}, /* Black Ref level */
+ { 0x3305, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x03,0x04,0x00,0x00,0x00}}, /* White Ref level */
+ { 0x3306, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x03,0x05,0x00,0x00,0x00}}, /* Color Range */
// Generic Sound Essence Descriptor
{ 0x3D02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x01,0x04,0x00,0x00,0x00}}, /* Locked/Unlocked */
{ 0x3D03, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x01,0x01,0x01,0x00,0x00}}, /* Audio sampling rate */
desc_size += 5;
if (sc->v_chroma_sub_sample)
desc_size += 8;
+ if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED)
+ desc_size += 8 * 3;
mxf_write_generic_desc(s, st, key, desc_size);
mxf_write_local_tag(pb, 1, 0x3303);
avio_w8(pb, sc->color_siting);
+ if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED) {
+ int black = 0,
+ white = (1<<sc->component_depth) - 1,
+ color = (1<<sc->component_depth) - 1;
+ if (st->codecpar->color_range == AVCOL_RANGE_MPEG) {
+ black = 1 << (sc->component_depth - 4);
+ white = 235 << (sc->component_depth - 8);
+ color = (14 << (sc->component_depth - 4)) + 1;
+ }
+ mxf_write_local_tag(pb, 4, 0x3304);
+ avio_wb32(pb, black);
+ mxf_write_local_tag(pb, 4, 0x3305);
+ avio_wb32(pb, white);
+ mxf_write_local_tag(pb, 4, 0x3306);
+ avio_wb32(pb, color);
+ }
+
if (sc->signal_standard) {
mxf_write_local_tag(pb, 1, 0x3215);
avio_w8(pb, sc->signal_standard);