diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-04-05 22:53:22 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-05-08 23:02:58 +0200 |
commit | 6d0339096e10f6753049f2a5cbfd7ba69e5f8bcd (patch) | |
tree | ece703dfb3967274adccd65e95cf700ebccbfa46 /libavformat/mxfenc.c | |
parent | 2bee43b67dc5c35a853823c7c90d97f5cfec9559 (diff) | |
download | ffmpeg-6d0339096e10f6753049f2a5cbfd7ba69e5f8bcd.tar.gz |
avformat/mxfenc: add white/black ref /color range
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mxfenc.c')
-rw-r--r-- | libavformat/mxfenc.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index ce2f0ede1e..37121b97f8 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -493,6 +493,9 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = { { 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 */ @@ -1144,6 +1147,8 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke 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); @@ -1188,6 +1193,23 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke 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); |