[FFmpeg-devel] [PATCH]Auto-detection for concat demuxer

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Feb 3 00:28:13 CET 2013


Hi!

Attached patch adds auto-detection for the concat demuxer.

Please review, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 0514755..9e73824 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -37,7 +37,21 @@ typedef struct {
 
 static int concat_probe(AVProbeData *probe)
 {
-    return 0;
+    const char *buf = probe->buf;
+    const char *end = buf + probe->buf_size;
+    int found = 0;
+
+    while (buf + 6 < end) {
+        if (!strncmp(buf, "file ", 5)) {
+            found++;
+            buf += 5;
+        } else if (*buf != '#') {
+            return 0;
+        }
+        while (buf < end && *buf++ != '\n')
+            ;
+    }
+    return found ? AVPROBE_SCORE_MAX : 0;
 }
 
 static char *get_keyword(uint8_t **cursor)


More information about the ffmpeg-devel mailing list