diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-09-28 16:56:54 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-09-29 21:50:30 +0200 |
commit | 93370d12164236d59645314871a1d6808b2a8ddb (patch) | |
tree | 50c6de8191839a1cfd0930636780848aa893b8ce /libavformat | |
parent | ff07ec143ebd3833fd5a3f4b6c00474ac523a31f (diff) | |
download | ffmpeg-streaming-93370d12164236d59645314871a1d6808b2a8ddb.zip ffmpeg-streaming-93370d12164236d59645314871a1d6808b2a8ddb.tar.gz |
mxfdec: set audio timebase to 1/samplerate
Fixes sync in some samples (e.g. bugs 7581 and 8374 in VLC).
Based on a commit by Matthieu Bouron <matthieu.bouron@gmail.com>
Reported-by: Jean-Baptiste Kempf <jb@videolan.org>
CC: libav-stable@libav.org
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mxfdec.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 7c0f657..d666b47 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1528,8 +1528,16 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) st->codec->channels = descriptor->channels; st->codec->bits_per_coded_sample = descriptor->bits_per_sample; - if (descriptor->sample_rate.den > 0) + if (descriptor->sample_rate.den > 0) { st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den; + avpriv_set_pts_info(st, 64, descriptor->sample_rate.den, descriptor->sample_rate.num); + } else { + av_log(mxf->fc, AV_LOG_WARNING, "invalid sample rate (%d/%d) " + "found for stream #%, time base forced to 1/48000\n", + descriptor->sample_rate.num, descriptor->sample_rate.den, + st->index); + avpriv_set_pts_info(st, 64, 1, 48000); + } /* TODO: implement AV_CODEC_ID_RAWAUDIO */ if (st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) { |