[FFmpeg-devel] [PATCH 2/5] avformat: add ff_probe_input_format3() so that image2 formats can be probed

Michael Niedermayer michaelni at gmx.at
Fri Mar 28 17:30:47 CET 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/internal.h |    1 +
 libavformat/utils.c    |   13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index f19cebf..1476081 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -411,5 +411,6 @@ enum AVWriteUncodedFrameFlags {
 
 };
 
+AVInputFormat *ff_probe_input_format3(AVProbeData *pd, int flags, int *score_ret);
 
 #endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index ac1a009..0f24f89 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -225,7 +225,7 @@ int av_filename_number_test(const char *filename)
            (av_get_frame_filename(buf, sizeof(buf), filename, 1) >= 0);
 }
 
-AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
+AVInputFormat *ff_probe_input_format3(AVProbeData *pd, int flags,
                                       int *score_ret)
 {
     AVProbeData lpd = *pd;
@@ -247,9 +247,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
 
     fmt = NULL;
     while ((fmt1 = av_iformat_next(fmt1))) {
-        if (!is_opened == !(fmt1->flags & AVFMT_NOFILE))
-            continue;
-        if (fmt1->flags & AVFMT_IMAGE2)
+        if ((fmt1->flags & (AVFMT_NOFILE|AVFMT_IMAGE2)) != flags)
             continue;
         score = 0;
         if (fmt1->read_probe) {
@@ -273,6 +271,13 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
     return fmt;
 }
 
+AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened,
+                                      int *score_ret)
+{
+    return ff_probe_input_format3(pd, is_opened ? 0 : AVFMT_NOFILE, score_ret);
+}
+
+
 AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
 {
     int score_ret;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list