diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2009-08-28 00:44:54 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2009-08-28 00:44:54 +0000 |
commit | eb5f3c5434c823f282d68858ddcdaa001a14857a (patch) | |
tree | 3ff36d99aa62ae6f8ccc277c42f564155a872123 /libavcodec | |
parent | dd0e43e4bbd4d4c3d3660316baa4fd52bfe55783 (diff) | |
download | ffmpeg-eb5f3c5434c823f282d68858ddcdaa001a14857a.tar.gz |
Modify the Ogg/Speex demuxer and the libspeex decoder so that they always treat
a packet of Speex frames as a single frame.
Originally committed as revision 19734 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libspeexdec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c index 8c3dc293df..82b83b8369 100644 --- a/libavcodec/libspeexdec.c +++ b/libavcodec/libspeexdec.c @@ -53,6 +53,8 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx) avctx->sample_rate = s->header->rate; avctx->channels = s->header->nb_channels; avctx->frame_size = s->header->frame_size; + if (s->header->frames_per_packet) + avctx->frame_size *= s->header->frames_per_packet; mode = speex_lib_get_mode(s->header->mode); if (!mode) { @@ -98,7 +100,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx, int16_t *output = data, *end; int i, num_samples; - num_samples = avctx->frame_size * avctx->channels; + num_samples = s->header->frame_size * avctx->channels; end = output + *data_size/2; speex_bits_read_from(&s->bits, buf, buf_size); @@ -113,12 +115,13 @@ static int libspeex_decode_frame(AVCodecContext *avctx, break; if (avctx->channels == 2) - speex_decode_stereo_int(output, avctx->frame_size, &s->stereo); + speex_decode_stereo_int(output, s->header->frame_size, &s->stereo); output += num_samples; } - *data_size = i * avctx->channels * avctx->frame_size * 2; + avctx->frame_size = s->header->frame_size * i; + *data_size = avctx->channels * avctx->frame_size * sizeof(*output); return buf_size; } |