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.
This commit is contained in:
Justin Ruggles 2012-01-11 21:10:35 -05:00
parent 4da374f8a9
commit 0883109b27
2 changed files with 24 additions and 16 deletions

View File

@ -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);

View File

@ -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