diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-01-11 21:10:35 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-03-03 17:03:27 -0500 |
commit | 0883109b27a9d2edf9528506e2605a5e0b8eef95 (patch) | |
tree | 62c1251ebbc30f2606f1d3681e5acabefbac0906 | |
parent | 4da374f8a9bc7cf790e6f5b30af3a30f0b777348 (diff) | |
download | ffmpeg-0883109b27a9d2edf9528506e2605a5e0b8eef95.tar.gz |
voc/avs: Do not change the sample rate mid-stream.
Also, set the time base based on the sample rate.
lavf-voc seek test updated to reflect slightly different seek points.
-rw-r--r-- | libavformat/vocdec.c | 16 | ||||
-rw-r--r-- | tests/ref/seek/lavf_voc | 24 |
2 files changed, 24 insertions, 16 deletions
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index e8c11afbe3..3c27062408 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -86,9 +86,13 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) switch (type) { case VOC_TYPE_VOICE_DATA: - dec->sample_rate = 1000000 / (256 - avio_r8(pb)); - if (sample_rate) - dec->sample_rate = sample_rate; + if (!dec->sample_rate) { + dec->sample_rate = 1000000 / (256 - avio_r8(pb)); + if (sample_rate) + dec->sample_rate = sample_rate; + avpriv_set_pts_info(st, 64, 1, dec->sample_rate); + } else + avio_skip(pb, 1); dec->channels = channels; tmp_codec = avio_r8(pb); dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id); @@ -110,7 +114,11 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) break; case VOC_TYPE_NEW_VOICE_DATA: - dec->sample_rate = avio_rl32(pb); + if (!dec->sample_rate) { + dec->sample_rate = avio_rl32(pb); + avpriv_set_pts_info(st, 64, 1, dec->sample_rate); + } else + avio_skip(pb, 4); dec->bits_per_coded_sample = avio_r8(pb); dec->channels = avio_r8(pb); tmp_codec = avio_rl16(pb); diff --git a/tests/ref/seek/lavf_voc b/tests/ref/seek/lavf_voc index 5670d1a992..387aef6cb8 100644 --- a/tests/ref/seek/lavf_voc +++ b/tests/ref/seek/lavf_voc @@ -1,27 +1,27 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 1024 ret:-1 st:-1 flags:0 ts:-1.000000 ret:-1 st:-1 flags:1 ts: 1.894167 -ret:-1 st: 0 flags:0 ts: 0.788333 -ret:-1 st: 0 flags:1 ts:-0.317500 +ret:-1 st: 0 flags:0 ts: 0.788335 +ret:-1 st: 0 flags:1 ts:-0.317508 ret:-1 st:-1 flags:0 ts: 2.576668 ret:-1 st:-1 flags:1 ts: 1.470835 -ret:-1 st: 0 flags:0 ts: 0.365000 -ret:-1 st: 0 flags:1 ts:-0.740833 +ret:-1 st: 0 flags:0 ts: 0.365006 +ret:-1 st: 0 flags:1 ts:-0.740837 ret:-1 st:-1 flags:0 ts: 2.153336 ret:-1 st:-1 flags:1 ts: 1.047503 -ret:-1 st: 0 flags:0 ts:-0.058333 -ret:-1 st: 0 flags:1 ts: 2.835833 +ret:-1 st: 0 flags:0 ts:-0.058323 +ret:-1 st: 0 flags:1 ts: 2.835834 ret:-1 st:-1 flags:0 ts: 1.730004 ret:-1 st:-1 flags:1 ts: 0.624171 -ret:-1 st: 0 flags:0 ts:-0.481667 -ret:-1 st: 0 flags:1 ts: 2.412500 +ret:-1 st: 0 flags:0 ts:-0.481652 +ret:-1 st: 0 flags:1 ts: 2.412505 ret:-1 st:-1 flags:0 ts: 1.306672 ret:-1 st:-1 flags:1 ts: 0.200839 -ret:-1 st: 0 flags:0 ts:-0.904989 -ret:-1 st: 0 flags:1 ts: 1.989178 +ret:-1 st: 0 flags:0 ts:-0.905003 +ret:-1 st: 0 flags:1 ts: 1.989176 ret:-1 st:-1 flags:0 ts: 0.883340 ret:-1 st:-1 flags:1 ts:-0.222493 -ret:-1 st: 0 flags:0 ts: 2.671678 -ret:-1 st: 0 flags:1 ts: 1.565844 +ret:-1 st: 0 flags:0 ts: 2.671668 +ret:-1 st: 0 flags:1 ts: 1.565847 ret:-1 st:-1 flags:0 ts: 0.460008 ret:-1 st:-1 flags:1 ts:-0.645825 |