[PATCH] add AVFMTCTX_ONLY_FRAME_DATA (currently only used when =

David Byron none dbyron
Thu Sep 23 13:50:26 CEST 2010


parsing mp3 files)=0A=
=0A=
---=0A=
 Changelog              |    1 +=0A=
 libavformat/avformat.h |    1 +=0A=
 libavformat/id3v2.c    |    8 ++++++++=0A=
 3 files changed, 10 insertions(+), 0 deletions(-)=0A=
=0A=
diff --git a/Changelog b/Changelog=0A=
index 503ac43..60c718c 100644=0A=
--- a/Changelog=0A=
+++ b/Changelog=0A=
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.=0A=
 =0A=
 version <next>:=0A=
 =0A=
+- add AVFMTCTX_ONLY_FRAME_DATA (currently only used when parsing mp3 =
files)=0A=
 - WebM support in Matroska de/muxer=0A=
 - low overhead Ogg muxing=0A=
 - MMS-TCP support=0A=
diff --git a/libavformat/avformat.h b/libavformat/avformat.h=0A=
index 0520530..2d213ad 100644=0A=
--- a/libavformat/avformat.h=0A=
+++ b/libavformat/avformat.h=0A=
@@ -641,6 +641,7 @@ typedef struct AVProgram {=0A=
 =0A=
 #define AVFMTCTX_NOHEADER      0x0001 /**< signal that no header is =
present=0A=
                                          (streams are added =
dynamically) */=0A=
+#define AVFMTCTX_ONLY_FRAME_DATA        0x0002 /**< Discard all =
non-frame data when parsing */=0A=
 =0A=
 typedef struct AVChapter {=0A=
     int id;                 ///< unique ID to identify the chapter=0A=
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c=0A=
index e2f19a0..230f5b5 100644=0A=
--- a/libavformat/id3v2.c=0A=
+++ b/libavformat/id3v2.c=0A=
@@ -69,7 +69,15 @@ void ff_id3v2_read(AVFormatContext *s, const char =
*magic)=0A=
                 ((buf[7] & 0x7f) << 14) |=0A=
                 ((buf[8] & 0x7f) << 7) |=0A=
                 (buf[9] & 0x7f);=0A=
+            if (s->ctx_flags & AVFMTCTX_ONLY_FRAME_DATA) {=0A=
+                /* Skip the id3v2 tag in case it contains=0A=
+                   anything that could be misinterpreted as=0A=
+                   an audio frame */=0A=
+                av_log(s, AV_LOG_DEBUG, "skipping id3v2 frame due to =
AVFMTCTX_ONLY_FRAME_DATA\n");=0A=
+                url_fskip(s->pb, len);=0A=
+            } else {=0A=
             ff_id3v2_parse(s, len, buf[3], buf[5]);=0A=
+            }=0A=
         } else {    =0A=
             url_fseek(s->pb, off, SEEK_SET);=0A=
         }=0A=
-- =0A=
1.6.0.4=0A=
=0A=

------=_NextPart_000_0A66_01CB5B26.C1472060--




More information about the ffmpeg-devel mailing list