[FFmpeg-cvslog] voc/avs: Do not change the sample rate mid-stream.
Justin Ruggles
git at videolan.org
Sun Mar 4 04:47:44 CET 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Jan 11 21:10:35 2012 -0500| [0883109b27a9d2edf9528506e2605a5e0b8eef95] | committer: Justin Ruggles
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.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0883109b27a9d2edf9528506e2605a5e0b8eef95
---
libavformat/vocdec.c | 16 ++++++++++++----
tests/ref/seek/lavf_voc | 24 ++++++++++++------------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index e8c11af..3c27062 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 5670d1a..387aef6 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
More information about the ffmpeg-cvslog
mailing list