Skip to content

Commit

Permalink
avformat/mxfenc: Correct the Sample rate for PCM outside D10
Browse files Browse the repository at this point in the history
Based on mail from IRT

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
  • Loading branch information
michaelni committed Sep 12, 2017
1 parent 4c33ec0 commit de03eb6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
17 changes: 14 additions & 3 deletions libavformat/mxfenc.c
Expand Up @@ -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
*/

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
6 changes: 3 additions & 3 deletions 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

0 comments on commit de03eb6

Please sign in to comment.