avformat/mxfenc: Correct the Sample rate for PCM outside D10
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 10 Sep 2017 20:10:45 +0000 (22:10 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 12 Sep 2017 17:24:25 +0000 (19:24 +0200)
Based on mail from IRT

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mxfenc.c
tests/ref/fate/copy-trac4914
tests/ref/lavf/mxf

index 8dc760e..7289e0b 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 /*
- * signal_standard, color_siting, store_user_comments and klv_fill_key version
+ * signal_standard, color_siting, store_user_comments, sample rate and klv_fill_key version
  * fixes sponsored by NOA GmbH
  */
 
@@ -1034,8 +1034,19 @@ static void mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID k
     avio_wb32(pb, st->index+2);
 
     mxf_write_local_tag(pb, 8, 0x3001);
-    avio_wb32(pb, mxf->time_base.den);
-    avio_wb32(pb, mxf->time_base.num);
+    if (s->oformat == &ff_mxf_d10_muxer) {
+        avio_wb32(pb, mxf->time_base.den);
+        avio_wb32(pb, mxf->time_base.num);
+    } else {
+        if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE ||
+            st->codecpar->codec_id == AV_CODEC_ID_PCM_S24LE) {
+            avio_wb32(pb, st->codecpar->sample_rate);
+            avio_wb32(pb, 1);
+        } else {
+            avio_wb32(pb, mxf->time_base.den);
+            avio_wb32(pb, mxf->time_base.num);
+        }
+    }
 
     mxf_write_local_tag(pb, 16, 0x3004);
     avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
index ef06b8f..e0864a0 100644 (file)
@@ -1,4 +1,4 @@
-8868ae16d99ed03916e9dc7105285471 *tests/data/fate/copy-trac4914.mxf
+d51f6bcc96885a2ce8517ae8c774f610 *tests/data/fate/copy-trac4914.mxf
 560697 tests/data/fate/copy-trac4914.mxf
 #tb 0: 1001/30000
 #media_type 0: video
index 48fe95a..b9c3733 100644 (file)
@@ -1,9 +1,9 @@
-eaac3125ac1a61fe5f968c7af83fa71e *./tests/data/lavf/lavf.mxf
+1c06a9d69b6e309579784db5ecb0b69f *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-1562530330b13e9e70f522fe20265632 *./tests/data/lavf/lavf.mxf
+50b4f9ca0493e6d83f4c52dc3aa2b7a5 *./tests/data/lavf/lavf.mxf
 560697 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-e07858715997313ae66a1cdd6fde5f66 *./tests/data/lavf/lavf.mxf
+4b71b154ae37364c8028cb50850a54c5 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab