diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-03-17 23:06:13 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-05-12 01:08:01 +0200 |
commit | d628caf54f57726e027433ccc83be3ed0b08efaf (patch) | |
tree | fa953934c300380bb045b387d5f05c74ce313ba4 /libavformat | |
parent | 66ba303c53698829e0b2c2d8f1c063fa35763fca (diff) | |
download | ffmpeg-d628caf54f57726e027433ccc83be3ed0b08efaf.tar.gz |
avformat/mxfenc: Add Sample width/height/x offset/y offset, Display x offset and F2 offset
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mxfenc.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 83b7fff42e..f955b50a66 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -481,9 +481,16 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = { { 0x320D, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x03,0x02,0x05,0x00,0x00,0x00}}, /* Video Line Map */ { 0x3203, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x02,0x02,0x00,0x00,0x00}}, /* Stored Width */ { 0x3202, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x02,0x01,0x00,0x00,0x00}}, /* Stored Height */ + { 0x3216, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x01,0x03,0x02,0x08,0x00,0x00,0x00}}, /* Stored F2 Offset */ + { 0x3205, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x08,0x00,0x00,0x00}}, /* Sampled Width */ + { 0x3204, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x07,0x00,0x00,0x00}}, /* Sampled Height */ + { 0x3206, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x09,0x00,0x00,0x00}}, /* Sampled X Offset */ + { 0x3207, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0A,0x00,0x00,0x00}}, /* Sampled Y Offset */ { 0x3209, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0C,0x00,0x00,0x00}}, /* Display Width */ { 0x3208, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0B,0x00,0x00,0x00}}, /* Display Height */ + { 0x320A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0D,0x00,0x00,0x00}}, /* Display X offset */ { 0x320B, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0E,0x00,0x00,0x00}}, /* Presentation Y offset */ + { 0x3217, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x01,0x03,0x02,0x07,0x00,0x00,0x00}}, /* Display F2 offset */ { 0x320E, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x00,0x00,0x00}}, /* Aspect Ratio */ { 0x3210, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x02,0x01,0x01,0x01,0x02,0x00}}, /* Transfer characteristic */ { 0x3213, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x18,0x01,0x02,0x00,0x00,0x00,0x00}}, /* Image Start Offset */ @@ -1173,13 +1180,15 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke int stored_height = (st->codecpar->height+15)/16*16; int display_height; int f1, f2; - unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5 + 6; + unsigned desc_size = size+8+8+8+8+8+8+8+5+16+4+12+20+5 + 5*8 + 6; UID transfer_ul = {0}; if (sc->interlaced && sc->field_dominance) desc_size += 5; if (sc->signal_standard) desc_size += 5; + if (sc->interlaced) + desc_size += 8; if (sc->v_chroma_sub_sample) desc_size += 8; if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED) @@ -1211,6 +1220,22 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke avio_wb32(pb, 0); } + //Sampled width + mxf_write_local_tag(pb, 4, 0x3205); + avio_wb32(pb, st->codecpar->width); + + //Samples height + mxf_write_local_tag(pb, 4, 0x3204); + avio_wb32(pb, st->codecpar->height>>sc->interlaced); + + //Sampled X Offset + mxf_write_local_tag(pb, 4, 0x3206); + avio_wb32(pb, 0); + + //Sampled Y Offset + mxf_write_local_tag(pb, 4, 0x3207); + avio_wb32(pb, 0); + mxf_write_local_tag(pb, 4, 0x3209); avio_wb32(pb, st->codecpar->width); @@ -1224,10 +1249,20 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke mxf_write_local_tag(pb, 4, 0x3208); avio_wb32(pb, display_height>>sc->interlaced); - // presentation Y offset + // display X offset + mxf_write_local_tag(pb, 4, 0x320A); + avio_wb32(pb, 0); + + // display Y offset mxf_write_local_tag(pb, 4, 0x320B); avio_wb32(pb, (st->codecpar->height - display_height)>>sc->interlaced); + if (sc->interlaced) { + //Display F2 Offset + mxf_write_local_tag(pb, 4, 0x3217); + avio_wb32(pb, -((st->codecpar->height - display_height)&1)); + } + // component depth mxf_write_local_tag(pb, 4, 0x3301); avio_wb32(pb, sc->component_depth); |