[FFmpeg-cvslog] avformat/img2dec: add GEM Raster image demuxer

Peter Ross git at videolan.org
Fri Oct 8 12:59:07 EEST 2021


ffmpeg | branch: master | Peter Ross <pross at xvid.org> | Wed Sep 15 20:15:42 2021 +1000| [4ff884069787161138e604b7aae495d27c457287] | committer: Peter Ross

avformat/img2dec: add GEM Raster image demuxer

Signed-off-by: Peter Ross <pross at xvid.org>

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

 libavformat/allformats.c |  1 +
 libavformat/img2.c       |  3 +++
 libavformat/img2dec.c    | 22 ++++++++++++++++++++++
 libavformat/version.h    |  4 ++--
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 5471f7c16f..99d8c91e00 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -499,6 +499,7 @@ extern const AVInputFormat  ff_image_cri_pipe_demuxer;
 extern const AVInputFormat  ff_image_dds_pipe_demuxer;
 extern const AVInputFormat  ff_image_dpx_pipe_demuxer;
 extern const AVInputFormat  ff_image_exr_pipe_demuxer;
+extern const AVInputFormat  ff_image_gem_pipe_demuxer;
 extern const AVInputFormat  ff_image_gif_pipe_demuxer;
 extern const AVInputFormat  ff_image_j2k_pipe_demuxer;
 extern const AVInputFormat  ff_image_jpeg_pipe_demuxer;
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 6bdd7efe26..4153102c92 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -84,6 +84,9 @@ const IdStrMap ff_img_tags[] = {
     { AV_CODEC_ID_XPM,        "xpm"      },
     { AV_CODEC_ID_XFACE,      "xface"    },
     { AV_CODEC_ID_XWD,        "xwd"      },
+    { AV_CODEC_ID_GEM,        "img"      },
+    { AV_CODEC_ID_GEM,        "ximg"     },
+    { AV_CODEC_ID_GEM,        "timg"     },
     { AV_CODEC_ID_NONE,       NULL       }
 };
 
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index ad4cc623c8..b535831e1c 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -1105,6 +1105,27 @@ static int photocd_probe(const AVProbeData *p)
     return AVPROBE_SCORE_MAX - 1;
 }
 
+static int gem_probe(const AVProbeData *p)
+{
+    const uint8_t *b = p->buf;
+    int ret = 0;
+    if ( AV_RB16(b     ) >= 1 && AV_RB16(b    ) <= 3  &&
+         AV_RB16(b +  2) >= 8 && AV_RB16(b + 2) <= 779 &&
+        (AV_RB16(b +  4) > 0  || AV_RB16(b + 4) <= 8) &&
+        (AV_RB16(b +  6) > 0  || AV_RB16(b + 6) <= 8) &&
+         AV_RB16(b +  8) &&
+         AV_RB16(b + 10) &&
+         AV_RB16(b + 12) &&
+         AV_RB16(b + 14)) {
+        ret = AVPROBE_SCORE_EXTENSION / 4;
+        if (AV_RN32(b + 16) == AV_RN32("STTT") ||
+            AV_RN32(b + 16) == AV_RN32("TIMG") ||
+            AV_RN32(b + 16) == AV_RN32("XIMG"))
+            ret += 1;
+    }
+    return ret;
+}
+
 #define IMAGEAUTO_DEMUXER(imgname, codecid)\
 const AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
     .name           = AV_STRINGIFY(imgname) "_pipe",\
@@ -1123,6 +1144,7 @@ IMAGEAUTO_DEMUXER(cri,     AV_CODEC_ID_CRI)
 IMAGEAUTO_DEMUXER(dds,     AV_CODEC_ID_DDS)
 IMAGEAUTO_DEMUXER(dpx,     AV_CODEC_ID_DPX)
 IMAGEAUTO_DEMUXER(exr,     AV_CODEC_ID_EXR)
+IMAGEAUTO_DEMUXER(gem,     AV_CODEC_ID_GEM)
 IMAGEAUTO_DEMUXER(gif,     AV_CODEC_ID_GIF)
 IMAGEAUTO_DEMUXER(j2k,     AV_CODEC_ID_JPEG2000)
 IMAGEAUTO_DEMUXER(jpeg,    AV_CODEC_ID_MJPEG)
diff --git a/libavformat/version.h b/libavformat/version.h
index 85090c8111..d5dd22059b 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,8 +32,8 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   5
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR   6
+#define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list