Mercurial > libavformat.hg
changeset 5152:ab5ed34ed707 libavformat
Modify the Ogg/Speex demuxer and the libspeex decoder so that they always treat
a packet of Speex frames as a single frame.
author | jbr |
---|---|
date | Fri, 28 Aug 2009 00:44:54 +0000 |
parents | 0e13b1b352ff |
children | 3fe89226cacf |
files | oggparsespeex.c |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/oggparsespeex.c Wed Aug 26 22:33:48 2009 +0000 +++ b/oggparsespeex.c Fri Aug 28 00:44:54 2009 +0000 @@ -40,12 +40,22 @@ return 0; if (os->seq == 0) { + int frames_per_packet; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_SPEEX; st->codec->sample_rate = AV_RL32(p + 36); st->codec->channels = AV_RL32(p + 48); + + /* We treat the whole Speex packet as a single frame everywhere Speex + is handled in FFmpeg. This avoids the complexities of splitting + and joining individual Speex frames, which are not always + byte-aligned. */ st->codec->frame_size = AV_RL32(p + 56); + frames_per_packet = AV_RL32(p + 64); + if (frames_per_packet) + st->codec->frame_size *= frames_per_packet; + st->codec->extradata_size = os->psize; st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);