[FFmpeg-cvslog] avformat/mxfenc: Correct the Sample rate for PCM outside D10
Michael Niedermayer
git at videolan.org
Tue Sep 12 20:25:17 EEST 2017
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Sep 10 22:10:45 2017 +0200| [de03eb622d30f7e23e0b9c76e581ad8fd788dfb3] | committer: Michael Niedermayer
avformat/mxfenc: Correct the Sample rate for PCM outside D10
Based on mail from IRT
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de03eb622d30f7e23e0b9c76e581ad8fd788dfb3
---
libavformat/mxfenc.c | 17 ++++++++++++++---
tests/ref/fate/copy-trac4914 | 2 +-
tests/ref/lavf/mxf | 6 +++---
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
More information about the ffmpeg-cvslog
mailing list