[FFmpeg-cvslog] lavf/rawdec: Autodetect raw mlp streams.

Carl Eugen Hoyos git at videolan.org
Thu Oct 1 19:58:50 CEST 2015


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Thu Oct  1 19:58:10 2015 +0200| [aea5db97f794c0f4e0132be14548af2d6023786d] | committer: Carl Eugen Hoyos

lavf/rawdec: Autodetect raw mlp streams.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aea5db97f794c0f4e0132be14548af2d6023786d
---

 libavformat/rawdec.c  |   23 +++++++++++++++++++++++
 libavformat/version.h |    2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 7684e1d..56ac199 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -207,9 +207,32 @@ FF_DEF_RAWVIDEO_DEMUXER2(mjpeg, "raw MJPEG video", mjpeg_probe, "mjpg,mjpeg,mpo"
 #endif
 
 #if CONFIG_MLP_DEMUXER
+static int mlp_probe(AVProbeData *p)
+{
+    const uint8_t *buf, *last_buf = p->buf, *end = p->buf + p->buf_size;
+    int frames = 0, valid = 0, size = 0;
+
+    for (buf = p->buf; buf + 8 <= end; buf++) {
+        if (AV_RB32(buf + 4) == 0xf8726fbb) {
+            frames++;
+            if (last_buf + size == buf) {
+                valid++;
+            }
+            last_buf = buf;
+            size = (AV_RB16(buf) & 0xfff) * 2;
+        } else if (buf - last_buf == size) {
+            size += (AV_RB16(buf) & 0xfff) * 2;
+        }
+    }
+    if (valid >= 100)
+        return AVPROBE_SCORE_MAX;
+    return 0;
+}
+
 AVInputFormat ff_mlp_demuxer = {
     .name           = "mlp",
     .long_name      = NULL_IF_CONFIG_SMALL("raw MLP"),
+    .read_probe     = mlp_probe,
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
     .flags          = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
diff --git a/libavformat/version.h b/libavformat/version.h
index 743617e..a329fc2 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINOR   2
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list