[FFmpeg-devel,11/13] avformat/mxfenc: Write Audio Ref Level for D10

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

Details

Message ID 20180507103817.8320-11-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            | 8 ++++++++
 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, 19 insertions(+), 11 deletions(-)

Comments

Tomas Härdin May 8, 2018, 11:02 a.m.
mån 2018-05-07 klockan 12:38 +0200 skrev Michael Niedermayer:
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>      // 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 */
> +    { 0x3D04, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x02,0x01,0x01,0x03,0x00,0x00,0x00}}, /* Audio Ref Level */
>      { 0x3D07, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x01,0x01,0x04,0x00,0x00,0x00}}, /* ChannelCount */
>      { 0x3D01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x03,0x04,0x00,0x00,0x00}}, /* Quantization bits */
>      { 0x3D06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x02,0x04,0x02,0x00,0x00,0x00,0x00}}, /* Sound Essence Compression */
> @@ -1333,6 +1334,8 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
>  
>      if (s->oformat == &ff_mxf_opatom_muxer)
>          duration_size = 12;
> +    if (s->oformat == &ff_mxf_d10_muxer)
> +        size += 5;
>  
>      mxf_write_generic_desc(s, st, key, size+duration_size+5+12+8+8);
>  
> @@ -1350,6 +1353,11 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
>      avio_wb32(pb, st->codecpar->sample_rate);
>      avio_wb32(pb, 1);
>  
> +    if (s->oformat == &ff_mxf_d10_muxer) {
> +        mxf_write_local_tag(pb, 1, 0x3D04);
> +        avio_w8(pb, 0);
> +    }

Sizes and such look OK, but again I don't know what the D-10 spec says

/Tomas
Michael Niedermayer May 8, 2018, 5:51 p.m.
On Tue, May 08, 2018 at 01:02:19PM +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>
> >      // 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 */
> > +    { 0x3D04, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x02,0x01,0x01,0x03,0x00,0x00,0x00}}, /* Audio Ref Level */
> >      { 0x3D07, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x01,0x01,0x04,0x00,0x00,0x00}}, /* ChannelCount */
> >      { 0x3D01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x03,0x04,0x00,0x00,0x00}}, /* Quantization bits */
> >      { 0x3D06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x02,0x04,0x02,0x00,0x00,0x00,0x00}}, /* Sound Essence Compression */
> > @@ -1333,6 +1334,8 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
> >  
> >      if (s->oformat == &ff_mxf_opatom_muxer)
> >          duration_size = 12;
> > +    if (s->oformat == &ff_mxf_d10_muxer)
> > +        size += 5;
> >  
> >      mxf_write_generic_desc(s, st, key, size+duration_size+5+12+8+8);
> >  
> > @@ -1350,6 +1353,11 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
> >      avio_wb32(pb, st->codecpar->sample_rate);
> >      avio_wb32(pb, 1);
> >  
> > +    if (s->oformat == &ff_mxf_d10_muxer) {
> > +        mxf_write_local_tag(pb, 1, 0x3D04);
> > +        avio_w8(pb, 0);
> > +    }
> 
> Sizes and such look OK, but again I don't know what the D-10 spec says

double checked
Table A2 - Generic Sound Essence Descriptor in SMPTE 386M lists 0

will apply

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index adf5527534..d57f5372c6 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -507,6 +507,7 @@  static const MXFLocalTagPair mxf_local_tag_batch[] = {
     // 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 */
+    { 0x3D04, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x02,0x01,0x01,0x03,0x00,0x00,0x00}}, /* Audio Ref Level */
     { 0x3D07, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x01,0x01,0x04,0x00,0x00,0x00}}, /* ChannelCount */
     { 0x3D01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x03,0x04,0x00,0x00,0x00}}, /* Quantization bits */
     { 0x3D06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x02,0x04,0x02,0x00,0x00,0x00,0x00}}, /* Sound Essence Compression */
@@ -1333,6 +1334,8 @@  static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
 
     if (s->oformat == &ff_mxf_opatom_muxer)
         duration_size = 12;
+    if (s->oformat == &ff_mxf_d10_muxer)
+        size += 5;
 
     mxf_write_generic_desc(s, st, key, size+duration_size+5+12+8+8);
 
@@ -1350,6 +1353,11 @@  static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
     avio_wb32(pb, st->codecpar->sample_rate);
     avio_wb32(pb, 1);
 
+    if (s->oformat == &ff_mxf_d10_muxer) {
+        mxf_write_local_tag(pb, 1, 0x3D04);
+        avio_w8(pb, 0);
+    }
+
     mxf_write_local_tag(pb, 4, 0x3D07);
     if (mxf->channel_count == -1) {
         if (show_warnings && (s->oformat == &ff_mxf_d10_muxer) && (st->codecpar->channels != 4) && (st->codecpar->channels != 8))
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index e3266abeb9..8bd8a23eef 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,4 +1,4 @@ 
-298afac2f4ddfed331294981160023f0 *tests/data/fate/copy-trac4914.mxf
+0576133def482f672d56369bc945f9d2 *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 b9beffef66..8c3469de61 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@ 
-471e8a7d012fb2b00835aadd5fe648c7
+a1a1e8df772ef28380ce95f12e7e8cb8
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index acda7c5fcf..aed683221d 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@ 
-68608a7f54b8fe3a85cd387e64bab764
+8149dfa839d55d7f0c127d66ebe86433
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 9f5818e0af..c2bc32bcf6 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@ 
-408b3758c11af3210c722a52d2754d8c *./tests/data/lavf/lavf.mxf
+0e342e262c9ad13b3d4758e3666f453e *./tests/data/lavf/lavf.mxf
 526393 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-76d3bec8f170e389da50a82075c8bf83 *./tests/data/lavf/lavf.mxf
+9d30acfb4cd73cfa6e46a01eea625521 *./tests/data/lavf/lavf.mxf
 561721 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-caa15603349cb79d11b75a7c6ad633ab *./tests/data/lavf/lavf.mxf
+76dfdb299f0ae2ed5094405dcd130d25 *./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 e73cd5d24f..fae3f40168 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@ 
-eb9412edd406c02e4d2ac2380748186b *./tests/data/lavf/lavf.mxf_d10
+7bad01ac8e0f223477f89a7443708ca8 *./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 8635484f17..c54b556a4d 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@ 
-eddb23aba03c1c0499928bca27d43795 *./tests/data/lavf/lavf.mxf_dv25
+10abfd24b120f93b79d3da0f0677c449 *./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 5df967054c..cd581528a1 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@ 
-cfbd162ecd9fa35f9f81d0b721f965e3 *./tests/data/lavf/lavf.mxf_dvcpro50
+a1dc7489ca5fa12e58401ef00b511b0d *./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 57829f0ebd..1a850133b5 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@ 
-062eb7acb97409a91791ca11374a4b5d *./tests/data/lavf/lavf.mxf_opatom
+29023fcae1bcdb40982b0db26ec46a62 *./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 db90cf2718..b5e0bbe5ed 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@ 
-b05d38be5e3e40bfe9a9de775370a7ed *./tests/data/lavf/lavf.mxf_opatom_audio
+81103a08d27122534790b33cf90b8125 *./tests/data/lavf/lavf.mxf_opatom_audio
 102969 ./tests/data/lavf/lavf.mxf_opatom_audio
 ./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff