aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oggparsespeex.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2009-08-28 00:44:54 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2009-08-28 00:44:54 +0000
commiteb5f3c5434c823f282d68858ddcdaa001a14857a (patch)
tree3ff36d99aa62ae6f8ccc277c42f564155a872123 /libavformat/oggparsespeex.c
parentdd0e43e4bbd4d4c3d3660316baa4fd52bfe55783 (diff)
downloadffmpeg-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 'libavformat/oggparsespeex.c')
-rw-r--r--libavformat/oggparsespeex.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 140a58a9eb..cc00dd2207 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -40,12 +40,22 @@ static int speex_header(AVFormatContext *s, int idx) {
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);