[FFmpeg-devel] [PATCH] Abort Ogg header parsing when we encounter a data packet.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Fri Apr 8 01:20:59 CEST 2011
Fixes ticket #15.
---
libavformat/oggdec.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index ddc7a1f..bcec2d5 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -376,8 +376,9 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo
// 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.
+ // but if we continue with header parsing we may lose data packets.
+ // So stuck between a rock and a hard place we just set
+ // AVFMTCTX_NOHEADER
ogg->headers = 1;
// Update the header state for all streams and
@@ -386,8 +387,6 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo
s->data_offset = os->sync_pos;
for (i = 0; i < ogg->nstreams; i++) {
struct ogg_stream *cur_os = ogg->streams + i;
- if (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
@@ -491,6 +490,7 @@ ogg_read_header (AVFormatContext * s, AVFormatParameters * ap)
{
struct ogg *ogg = s->priv_data;
int i;
+ s->ctx_flags |= AVFMTCTX_NOHEADER;
ogg->curidx = -1;
//linear headers seek from start
if (ogg_get_headers (s) < 0){
--
1.7.4.1
More information about the ffmpeg-devel
mailing list