[FFmpeg-devel] [PATCH]Show "Broken ogg file" warning only once
Carl Eugen Hoyos
cehoyos at ag.or.at
Sun Feb 12 01:59:29 CET 2012
Hi!
It seems that FFmpeg produces files that trigger the new warning "Broken file"
when decoding ogg:
http://thread.gmane.org/gmane.comp.video.ffmpeg.user/35384
Attached patch makes the warning only appear once.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index e32ab69..5a6848e 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -582,7 +582,10 @@ static void ogg_validate_keyframe(AVFormatContext *s, int idx, int pstart, int p
struct ogg_stream *os = ogg->streams + idx;
if (psize && s->streams[idx]->codec->codec_id == CODEC_ID_THEORA) {
if (!!(os->pflags & AV_PKT_FLAG_KEY) != !(os->buf[pstart] & 0x40)) {
- av_log(s, AV_LOG_WARNING, "Broken file, keyframes not correctly marked.\n");
+ if (!ogg->broken_stream_warning_shown) {
+ av_log(s, AV_LOG_WARNING, "Broken file, keyframes not correctly marked.\n");
+ ogg->broken_stream_warning_shown = 1;
+ }
os->pflags ^= AV_PKT_FLAG_KEY;
}
}
diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
index 7f5452f..a9694c4 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -93,6 +93,7 @@ struct ogg {
int headers;
int curidx;
struct ogg_state *state;
+ int broken_stream_warning_shown;
};
#define OGG_FLAG_CONT 1
More information about the ffmpeg-devel
mailing list