aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2011-02-05 16:32:35 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-02-09 03:33:55 +0100
commit94dfea71ed370f8e27d99a26612793f7ed7dca46 (patch)
tree67fbee15aaeb9cb0be7dddb2dc7cf081613b9b28 /libavformat
parent68b2336d13ce9a474cf99d4d855188bab5777e8c (diff)
downloadffmpeg-94dfea71ed370f8e27d99a26612793f7ed7dca46.tar.gz
oggdec: Fix incorrect assumption about header/data interleaving
Currently (since the data_offset fix) the ogg demuxer assumes that after the first non-header packets in any stream no more header packets will follow. This is not guaranteed, so change the code back again to wait until it has finished the headers for all streams before returning from ogg_get_headers. This fixes issue 2428. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit 6bd69e6adadf645fd07e909bebc150eab4b9c3c8)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/oggdec.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 1b4553c73b..be2f03a47b 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -374,20 +374,20 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo
os->segp = segp;
os->psize = psize;
- // We have reached the first non-header packet. All header
- // packets must be complete before the first non-header
- // one, so everything that follows must be non-header.
+ // We have reached the first non-header packet in this stream.
+ // Unfortunately more header packets may still follow for others,
+ // so we reset this later unless we are done with the headers
+ // for all streams.
ogg->headers = 1;
// Update the header state for all streams and
// compute the data_offset.
- s->data_offset = os->sync_pos;
+ if (!s->data_offset)
+ s->data_offset = os->sync_pos;
for (i = 0; i < ogg->nstreams; i++) {
struct ogg_stream *cur_os = ogg->streams + i;
- // Set stream header state to 0 if its last packet
- // was a header.
if (cur_os->header > 0)
- cur_os->header = 0;
+ ogg->headers = 0;
// if we have a partial non-header packet, its start is
// obviously at or after the data start