X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fvocdec.c;h=ea06b53ecfe792651904d486ff706653c5b5c01b;hb=c0b47d1914a19abacdf1edf081cbf07485952920;hp=6ee8d33964e1e2d0c390318ed415912feb34c22b;hpb=7c29313b387392fa305365e855fa408cd28c276e;p=ffmpeg diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 6ee8d33964e..8060864406b 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -38,7 +38,7 @@ static int voc_probe(AVProbeData *p) return AVPROBE_SCORE_MAX; } -static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) +static int voc_read_header(AVFormatContext *s) { VocDecContext *voc = s->priv_data; AVIOContext *pb = s->pb; @@ -62,7 +62,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) } int -voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) +ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) { VocDecContext *voc = s->priv_data; AVCodecContext *dec = st->codec; @@ -86,9 +86,13 @@ 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 @@ 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); @@ -153,7 +161,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) static int voc_read_packet(AVFormatContext *s, AVPacket *pkt) { - return voc_get_packet(s, pkt, s->streams[0], 0); + return ff_voc_get_packet(s, pkt, s->streams[0], 0); } AVInputFormat ff_voc_demuxer = { @@ -163,5 +171,5 @@ AVInputFormat ff_voc_demuxer = { .read_probe = voc_probe, .read_header = voc_read_header, .read_packet = voc_read_packet, - .codec_tag=(const AVCodecTag* const []){ff_voc_codec_tags, 0}, + .codec_tag = (const AVCodecTag* const []){ ff_voc_codec_tags, 0 }, };