summaryrefslogtreecommitdiff
path: root/libavformat/oggparsespeex.c
diff options
context:
space:
mode:
authorDavid Conrad <lessen42@gmail.com>2010-03-11 07:17:46 +0000
committerDavid Conrad <lessen42@gmail.com>2010-03-11 07:17:46 +0000
commit8f8320d7c32c375e86712aa406465c30a27eb8d3 (patch)
tree05a0cf2241aa8de85f6655473930b2867954a09b /libavformat/oggparsespeex.c
parent77560b0ef13664b77efcb765f3b863698fea9e38 (diff)
oggdec: Don't use ogg_stream's seq for vorbis or speex headers
Originally committed as revision 22459 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/oggparsespeex.c')
-rw-r--r--libavformat/oggparsespeex.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 14d2b38131..395ae59377 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -32,18 +32,25 @@
struct speex_params {
int final_packet_duration;
+ int seq;
};
static int speex_header(AVFormatContext *s, int idx) {
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
+ struct speex_params *spxp = os->private;
AVStream *st = s->streams[idx];
uint8_t *p = os->buf + os->pstart;
- if (os->seq > 1)
+ if (!spxp) {
+ spxp = av_mallocz(sizeof(*spxp));
+ os->private = spxp;
+ }
+
+ if (spxp->seq > 1)
return 0;
- if (os->seq == 0) {
+ if (spxp->seq == 0) {
int frames_per_packet;
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_SPEEX;
@@ -70,6 +77,7 @@ static int speex_header(AVFormatContext *s, int idx) {
} else
vorbis_comment(s, p, os->psize);
+ spxp->seq++;
return 1;
}
@@ -90,11 +98,6 @@ static int speex_packet(AVFormatContext *s, int idx)
struct speex_params *spxp = os->private;
int packet_size = s->streams[idx]->codec->frame_size;
- if (!spxp) {
- spxp = av_mallocz(sizeof(*spxp));
- os->private = spxp;
- }
-
if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE &&
os->granule > 0) {
/* first packet of final page. we have to calculate the final packet