summaryrefslogtreecommitdiff
path: root/libavformat/mxfenc.c
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 /libavformat/mxfenc.c
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>
Diffstat (limited to 'libavformat/mxfenc.c')
-rw-r--r--libavformat/mxfenc.c17
1 files changed, 14 insertions, 3 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);