summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-09-10 22:10:45 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-09-12 19:24:25 +0200
commitde03eb622d30f7e23e0b9c76e581ad8fd788dfb3 (patch)
tree642d56a3156ea3ad9fd3ad687a6694878755e703
parent4c33ec004fd879ccc7e927bd50604aa3fadf7e43 (diff)
avformat/mxfenc: Correct the Sample rate for PCM outside D10
Based on mail from IRT Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mxfenc.c17
-rw-r--r--tests/ref/fate/copy-trac49142
-rw-r--r--tests/ref/lavf/mxf6
3 files changed, 18 insertions, 7 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 8dc760e8f3..7289e0b05b 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -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);
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index ef06b8f816..e0864a0035 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -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
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 48fe95a235..b9c37334a9 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -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