summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorDavid Conrad <lessen42@gmail.com>2010-02-08 10:13:03 +0000
committerDavid Conrad <lessen42@gmail.com>2010-02-08 10:13:03 +0000
commitecc0027bc6d58536b92003173b0e23504e828472 (patch)
tree2d7cee753b4e70a3ceb47c5949f23c68db6bc62c /libavformat
parent55a7e946f6558eb36296fbd14a04d675bebe91ea (diff)
downloadffmpeg-ecc0027bc6d58536b92003173b0e23504e828472.tar.gz
Fix playback with invalid files that don't set the continuation flag for
pages that continue packets started in prior pages. Fixes issue1248 Originally committed as revision 21688 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/oggdec.c5
-rw-r--r--libavformat/oggdec.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 26a6af20cb..3e1bf5d4de 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -122,6 +122,7 @@ ogg_reset (struct ogg * ogg)
os->lastdts = AV_NOPTS_VALUE;
os->nsegs = 0;
os->segp = 0;
+ os->incomplete = 0;
}
ogg->curidx = -1;
@@ -268,7 +269,7 @@ ogg_read_page (AVFormatContext * s, int *str)
for (i = 0; i < nsegs; i++)
size += os->segments[i];
- if (flags & OGG_FLAG_CONT){
+ if (flags & OGG_FLAG_CONT || os->incomplete){
if (!os->psize){
while (os->segp < os->nsegs){
int seg = os->segments[os->segp++];
@@ -356,6 +357,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
if (!complete && os->segp == os->nsegs){
ogg->curidx = -1;
+ os->incomplete = 1;
}
}while (!complete);
@@ -366,6 +368,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
#endif
ogg->curidx = idx;
+ os->incomplete = 0;
if (os->header < 0){
int hdr = os->codec->header (s, idx);
diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
index 7c677a1de4..b0a23e2516 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -71,6 +71,7 @@ struct ogg_stream {
int header;
int nsegs, segp;
uint8_t segments[255];
+ int incomplete; ///< whether we're expecting a continuation in the next page
int page_end; ///< current packet is the last one completed in the page
void *private;
};