[FFmpeg-devel,12/13] avformat/mxfenc: Add Stored F2 Offset / Image Start/End Offset for D10

Submitted by Michael Niedermayer on May 7, 2018, 10:38 a.m.

Details

Message ID 20180507103817.8320-12-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer May 7, 2018, 10:38 a.m.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mxfenc.c            | 18 ++++++++++++++++++
 tests/ref/fate/copy-trac4914    |  2 +-
 tests/ref/fate/mxf-reel_name    |  2 +-
 tests/ref/fate/time_base        |  2 +-
 tests/ref/lavf/mxf              |  6 +++---
 tests/ref/lavf/mxf_d10          |  2 +-
 tests/ref/lavf/mxf_dv25         |  2 +-
 tests/ref/lavf/mxf_dvcpro50     |  2 +-
 tests/ref/lavf/mxf_opatom       |  2 +-
 tests/ref/lavf/mxf_opatom_audio |  2 +-
 10 files changed, 29 insertions(+), 11 deletions(-)

Comments

Tomas Härdin May 8, 2018, 10:58 a.m.
mån 2018-05-07 klockan 12:38 +0200 skrev Michael Niedermayer:
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>          desc_size += 8;
>      if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED)
>          desc_size += 8 * 3;
> +    if (s->oformat == &ff_mxf_d10_muxer)
> +        desc_size += 8 + 8 + 8;
>  
>      mxf_write_generic_desc(s, st, key, desc_size);
>  
> @@ -1169,6 +1173,20 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
>      mxf_write_local_tag(pb, 4, 0x3202);
>      avio_wb32(pb, stored_height>>sc->interlaced);
>  
> +    if (s->oformat == &ff_mxf_d10_muxer) {
> +        //Stored F2 Offset
> +        mxf_write_local_tag(pb, 4, 0x3216);
> +        avio_wb32(pb, 0);
> +
> +        //Image Start Offset
> +        mxf_write_local_tag(pb, 4, 0x3213);
> +        avio_wb32(pb, 0);
> +
> +        //Image End Offset
> +        mxf_write_local_tag(pb, 4, 0x3214);
> +        avio_wb32(pb, 0);
> +    }

Looks OK, but of course I don't know what the spec says

/Tomas
Michael Niedermayer May 8, 2018, 6:18 p.m.
On Tue, May 08, 2018 at 12:58:09PM +0200, Tomas Härdin wrote:
> mån 2018-05-07 klockan 12:38 +0200 skrev Michael Niedermayer:
> > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> >          desc_size += 8;
> >      if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED)
> >          desc_size += 8 * 3;
> > +    if (s->oformat == &ff_mxf_d10_muxer)
> > +        desc_size += 8 + 8 + 8;
> >  
> >      mxf_write_generic_desc(s, st, key, desc_size);
> >  
> > @@ -1169,6 +1173,20 @@ static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
> >      mxf_write_local_tag(pb, 4, 0x3202);
> >      avio_wb32(pb, stored_height>>sc->interlaced);
> >  
> > +    if (s->oformat == &ff_mxf_d10_muxer) {
> > +        //Stored F2 Offset
> > +        mxf_write_local_tag(pb, 4, 0x3216);
> > +        avio_wb32(pb, 0);
> > +
> > +        //Image Start Offset
> > +        mxf_write_local_tag(pb, 4, 0x3213);
> > +        avio_wb32(pb, 0);
> > +
> > +        //Image End Offset
> > +        mxf_write_local_tag(pb, 4, 0x3214);
> > +        avio_wb32(pb, 0);
> > +    }
> 
> Looks OK, but of course I don't know what the spec says

double checked, "Table A1- CDCI (Picture) Essence Descriptor" lists 0 for these

will apply

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index d57f5372c6..eda26e1a3f 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -492,6 +492,8 @@  static const MXFLocalTagPair mxf_local_tag_batch[] = {
     { 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 */
+    { 0x3213, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x18,0x01,0x02,0x00,0x00,0x00,0x00}}, /* Image Start Offset */
+    { 0x3214, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x18,0x01,0x03,0x00,0x00,0x00,0x00}}, /* Image End Offset */
     { 0x3201, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x06,0x01,0x00,0x00,0x00,0x00}}, /* Picture Essence Coding */
     { 0x3212, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x03,0x01,0x06,0x00,0x00,0x00}}, /* Field Dominance (Opt) */
     { 0x3215, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x05,0x01,0x13,0x00,0x00,0x00,0x00}}, /* Signal Standard */
@@ -1160,6 +1162,8 @@  static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
         desc_size += 8;
     if (st->codecpar->color_range != AVCOL_RANGE_UNSPECIFIED)
         desc_size += 8 * 3;
+    if (s->oformat == &ff_mxf_d10_muxer)
+        desc_size += 8 + 8 + 8;
 
     mxf_write_generic_desc(s, st, key, desc_size);
 
@@ -1169,6 +1173,20 @@  static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID ke
     mxf_write_local_tag(pb, 4, 0x3202);
     avio_wb32(pb, stored_height>>sc->interlaced);
 
+    if (s->oformat == &ff_mxf_d10_muxer) {
+        //Stored F2 Offset
+        mxf_write_local_tag(pb, 4, 0x3216);
+        avio_wb32(pb, 0);
+
+        //Image Start Offset
+        mxf_write_local_tag(pb, 4, 0x3213);
+        avio_wb32(pb, 0);
+
+        //Image End Offset
+        mxf_write_local_tag(pb, 4, 0x3214);
+        avio_wb32(pb, 0);
+    }
+
     //Sampled width
     mxf_write_local_tag(pb, 4, 0x3205);
     avio_wb32(pb, st->codecpar->width);
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index 8bd8a23eef..4cadb21adc 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@ 
-0576133def482f672d56369bc945f9d2 *tests/data/fate/copy-trac4914.mxf
+ccce4918a1a4682cf431e7bb14b8120d *tests/data/fate/copy-trac4914.mxf
 561721 tests/data/fate/copy-trac4914.mxf
 #tb 0: 1001/30000
 #media_type 0: video
diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
index 8c3469de61..1a1731e431 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@ 
-a1a1e8df772ef28380ce95f12e7e8cb8
+1ab725f1bbf60e4ac127859727735784
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index aed683221d..9ba0e92b58 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@ 
-8149dfa839d55d7f0c127d66ebe86433
+bedb164d507d07714c2a908f4ddb240a
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index c2bc32bcf6..d20bded186 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@ 
-0e342e262c9ad13b3d4758e3666f453e *./tests/data/lavf/lavf.mxf
+b445776832c7deba50665282a5987f2c *./tests/data/lavf/lavf.mxf
 526393 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-9d30acfb4cd73cfa6e46a01eea625521 *./tests/data/lavf/lavf.mxf
+d130f0a9c7404fe4f2e7c975d8fd6a52 *./tests/data/lavf/lavf.mxf
 561721 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-76dfdb299f0ae2ed5094405dcd130d25 *./tests/data/lavf/lavf.mxf
+41cd471fe44cd27ec558980c20b71676 *./tests/data/lavf/lavf.mxf
 526393 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10
index fae3f40168..51f26c7b85 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@ 
-7bad01ac8e0f223477f89a7443708ca8 *./tests/data/lavf/lavf.mxf_d10
+d92737f65555cceeb61ec6a79dd7a054 *./tests/data/lavf/lavf.mxf_d10
 5332013 ./tests/data/lavf/lavf.mxf_d10
 ./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
diff --git a/tests/ref/lavf/mxf_dv25 b/tests/ref/lavf/mxf_dv25
index c54b556a4d..f6dc12e09b 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@ 
-10abfd24b120f93b79d3da0f0677c449 *./tests/data/lavf/lavf.mxf_dv25
+ac97dec181de5ca64d096bfc38924978 *./tests/data/lavf/lavf.mxf_dv25
 3834413 ./tests/data/lavf/lavf.mxf_dv25
 ./tests/data/lavf/lavf.mxf_dv25 CRC=0xbdaf7f52
diff --git a/tests/ref/lavf/mxf_dvcpro50 b/tests/ref/lavf/mxf_dvcpro50
index cd581528a1..e53ac45fc0 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@ 
-a1dc7489ca5fa12e58401ef00b511b0d *./tests/data/lavf/lavf.mxf_dvcpro50
+fd35b5adf7601ef08cda45d0124a284a *./tests/data/lavf/lavf.mxf_dvcpro50
 7431213 ./tests/data/lavf/lavf.mxf_dvcpro50
 ./tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xe3bbe4b4
diff --git a/tests/ref/lavf/mxf_opatom b/tests/ref/lavf/mxf_opatom
index 1a850133b5..5ace27e0fb 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@ 
-29023fcae1bcdb40982b0db26ec46a62 *./tests/data/lavf/lavf.mxf_opatom
+e4236ef5fb2948ad6b3985f2c48471d8 *./tests/data/lavf/lavf.mxf_opatom
 4717625 ./tests/data/lavf/lavf.mxf_opatom
 ./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a
diff --git a/tests/ref/lavf/mxf_opatom_audio b/tests/ref/lavf/mxf_opatom_audio
index b5e0bbe5ed..ab161b0ec6 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@ 
-81103a08d27122534790b33cf90b8125 *./tests/data/lavf/lavf.mxf_opatom_audio
+0bb1e7389b51c604ed5dd98d8826a55f *./tests/data/lavf/lavf.mxf_opatom_audio
 102969 ./tests/data/lavf/lavf.mxf_opatom_audio
 ./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff