diff raw.c @ 4254:d05b13327b07 libavformat

Fix probing of files with ID3v2 tags. Discussed at http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-January/059302.html
author alexc
date Mon, 19 Jan 2009 21:54:06 +0000
parents 77e0c7511d41
children d8803d0a4274
line wrap: on
line diff
--- a/raw.c	Mon Jan 19 17:01:22 2009 +0000
+++ b/raw.c	Mon Jan 19 21:54:06 2009 +0000
@@ -26,6 +26,7 @@
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
 #include "raw.h"
+#include "id3v2.h"
 
 /* simple formats */
 #if CONFIG_FLAC_MUXER
@@ -582,9 +583,15 @@
 {
     int max_frames = 0, first_frames = 0;
     int fsize, frames;
+    uint8_t *buf0 = p->buf;
     uint8_t *buf2;
-    uint8_t *buf = p->buf;
-    uint8_t *end = buf + p->buf_size - 7;
+    uint8_t *buf;
+    uint8_t *end = buf0 + p->buf_size - 7;
+
+    if (ff_id3v2_match(buf0)) {
+        buf0 += ff_id3v2_tag_len(buf0);
+    }
+    buf = buf0;
 
     for(; buf < end; buf= buf2+1) {
         buf2 = buf;
@@ -599,7 +606,7 @@
             buf2 += fsize;
         }
         max_frames = FFMAX(max_frames, frames);
-        if(buf == p->buf)
+        if(buf == buf0)
             first_frames= frames;
     }
     if   (first_frames>=3) return AVPROBE_SCORE_MAX/2+1;