History

mxfenc: write optional field dominance flag in picture description

Matthieu Bouron committed 14 years ago

Commit f6d952f1 parent 93147da3 files · +18 −5Browse files

Unified · Split

3 files
  1. libavformat/mxfenc.c +14 −1
  2. tests/ref/lavf/mxf +3 −3
  3. tests/ref/lavf/mxf_d10 +1 −1
libavformat/mxfenc.c+14−1
@@ -73,6 +73,7 @@ typedef struct { · 72 unmodified lines
73 const UID *codec_ul;73 const UID *codec_ul;
74 int order; ///< interleaving order if dts are equal74 int order; ///< interleaving order if dts are equal
75 int interlaced; ///< whether picture is interlaced75 int interlaced; ///< whether picture is interlaced
76 int field_dominance; ///< tff=1, bff=2
76 int temporal_reordering;77 int temporal_reordering;
77 AVRational aspect_ratio; ///< display aspect ratio78 AVRational aspect_ratio; ///< display aspect ratio
78 int closed_gop; ///< gop is closed, used in mpeg-2 frame parsing79 int closed_gop; ///< gop is closed, used in mpeg-2 frame parsing
@@ -284,6 +285,7 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = { · 205 unmodified lines
284 { 0x3208, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0B,0x00,0x00,0x00}}, /* Display Height */285 { 0x3208, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0B,0x00,0x00,0x00}}, /* Display Height */
285 { 0x320E, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x00,0x00,0x00}}, /* Aspect Ratio */286 { 0x320E, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x00,0x00,0x00}}, /* Aspect Ratio */
286 { 0x3201, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x06,0x01,0x00,0x00,0x00,0x00}}, /* Picture Essence Coding */287 { 0x3201, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x06,0x01,0x00,0x00,0x00,0x00}}, /* Picture Essence Coding */
288 { 0x3212, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x03,0x01,0x06,0x00,0x00,0x00}}, /* Field Dominance (Opt) */
287 // CDCI Picture Essence Descriptor289 // CDCI Picture Essence Descriptor
288 { 0x3301, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x03,0x0A,0x00,0x00,0x00}}, /* Component Depth */290 { 0x3301, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x03,0x0A,0x00,0x00,0x00}}, /* Component Depth */
289 { 0x3302, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x05,0x00,0x00,0x00}}, /* Horizontal Subsampling */291 { 0x3302, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x05,0x00,0x00,0x00}}, /* Horizontal Subsampling */
@@ -789,8 +791,11 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke · 499 unmodified lines
789 int stored_height = (st->codec->height+15)/16*16;791 int stored_height = (st->codec->height+15)/16*16;
790 int display_height;792 int display_height;
791 int f1, f2;793 int f1, f2;
794 unsigned desc_size = size+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20;
795 if (sc->interlaced && sc->field_dominance)
796 desc_size += 5;
792 797
793 mxf_write_generic_desc(s, st, key, size+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20);798 mxf_write_generic_desc(s, st, key, desc_size);
794 799
795 mxf_write_local_tag(pb, 4, 0x3203);800 mxf_write_local_tag(pb, 4, 0x3203);
796 avio_wb32(pb, st->codec->width);801 avio_wb32(pb, st->codec->width);
@@ -852,6 +857,12 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke · 55 unmodified lines
852 857
853 mxf_write_local_tag(pb, 16, 0x3201);858 mxf_write_local_tag(pb, 16, 0x3201);
854 avio_write(pb, *sc->codec_ul, 16);859 avio_write(pb, *sc->codec_ul, 16);
860
861 if (sc->interlaced && sc->field_dominance) {
862 mxf_write_local_tag(pb, 1, 0x3212);
863 avio_w8(pb, sc->field_dominance);
864 }
865
855}866}
856 867
857static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)868static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
@@ -1328,6 +1339,8 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, · 470 unmodified lines
1328 st->codec->level = pkt->data[i+2] >> 4;1339 st->codec->level = pkt->data[i+2] >> 4;
1329 } else if (i + 5 < pkt->size && (pkt->data[i+1] & 0xf0) == 0x80) { // pict coding ext1340 } else if (i + 5 < pkt->size && (pkt->data[i+1] & 0xf0) == 0x80) { // pict coding ext
1330 sc->interlaced = !(pkt->data[i+5] & 0x80); // progressive frame1341 sc->interlaced = !(pkt->data[i+5] & 0x80); // progressive frame
1342 if (sc->interlaced)
1343 sc->field_dominance = 1 + !(pkt->data[i+4] & 0x80); // top field first
1331 break;1344 break;
1332 }1345 }
1333 } else if (c == 0x1b8) { // gop1346 } else if (c == 0x1b8) { // gop
tests/ref/lavf/mxf+3−3
@@ -1,9 +1,9 @@
1785e38ddd2466046f30aa36399b8f8fa *./tests/data/lavf/lavf.mxf14cc269e1d2066fac03a3d7466f011c8e *./tests/data/lavf/lavf.mxf
2525881 ./tests/data/lavf/lavf.mxf2525881 ./tests/data/lavf/lavf.mxf
3./tests/data/lavf/lavf.mxf CRC=0x4ace08493./tests/data/lavf/lavf.mxf CRC=0x4ace0849
4ccaa42c75e653f71604fd28c7c83722d *./tests/data/lavf/lavf.mxf487eb6e0e51d31c8ffa414d02672edfa0 *./tests/data/lavf/lavf.mxf
5537657 ./tests/data/lavf/lavf.mxf5537657 ./tests/data/lavf/lavf.mxf
6./tests/data/lavf/lavf.mxf CRC=0x9b928d6b6./tests/data/lavf/lavf.mxf CRC=0x9b928d6b
7c78207030d57b48295b089916849d50d *./tests/data/lavf/lavf.mxf752c5b74ecfdc48bd77d79a6bbe62d2de *./tests/data/lavf/lavf.mxf
8525881 ./tests/data/lavf/lavf.mxf8525881 ./tests/data/lavf/lavf.mxf
9./tests/data/lavf/lavf.mxf CRC=0x4ace08499./tests/data/lavf/lavf.mxf CRC=0x4ace0849
tests/ref/lavf/mxf_d10+1−1
@@ -1,3 +1,3 @@
10d72247067569901a2e351586ddc0b82 *./tests/data/lavf/lavf.mxf_d10193237916962c1ecacc8ae3b9e97481fb *./tests/data/lavf/lavf.mxf_d10
25330989 ./tests/data/lavf/lavf.mxf_d1025330989 ./tests/data/lavf/lavf.mxf_d10
3./tests/data/lavf/lavf.mxf_d10 CRC=0x4474d4803./tests/data/lavf/lavf.mxf_d10 CRC=0x4474d480

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t