[FFmpeg-cvslog] lavf: Add pcx auto-detection.

Carl Eugen Hoyos git at videolan.org
Mon Feb 29 15:50:57 CET 2016


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Mon Feb 29 15:49:52 2016 +0100| [8c5092912b19e793412b07e070da2f8636c2c2f3] | committer: Carl Eugen Hoyos

lavf: Add pcx auto-detection.

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

 libavformat/Makefile     |    1 +
 libavformat/allformats.c |    1 +
 libavformat/img2dec.c    |   22 ++++++++++++++++++++++
 libavformat/version.h    |    2 +-
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 782908e..edfa695 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -218,6 +218,7 @@ OBJS-$(CONFIG_IMAGE_EXR_PIPE_DEMUXER)     += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_J2K_PIPE_DEMUXER)     += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_JPEG_PIPE_DEMUXER)    += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER)  += img2dec.o img2.o
+OBJS-$(CONFIG_IMAGE_PCX_PIPE_DEMUXER)     += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PICTOR_PIPE_DEMUXER)  += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PNG_PIPE_DEMUXER)     += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_QDRAW_PIPE_DEMUXER)   += img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 9662941..fc87900 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -358,6 +358,7 @@ void av_register_all(void)
     REGISTER_DEMUXER (IMAGE_J2K_PIPE,        image_j2k_pipe);
     REGISTER_DEMUXER (IMAGE_JPEG_PIPE,       image_jpeg_pipe);
     REGISTER_DEMUXER (IMAGE_JPEGLS_PIPE,     image_jpegls_pipe);
+    REGISTER_DEMUXER (IMAGE_PCX_PIPE,        image_pcx_pipe);
     REGISTER_DEMUXER (IMAGE_PICTOR_PIPE,     image_pictor_pipe);
     REGISTER_DEMUXER (IMAGE_PNG_PIPE,        image_png_pipe);
     REGISTER_DEMUXER (IMAGE_QDRAW_PIPE,      image_qdraw_pipe);
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 94cce93..019793f 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -764,6 +764,27 @@ static int jpegls_probe(AVProbeData *p)
     return 0;
 }
 
+static int pcx_probe(AVProbeData *p)
+{
+    const uint8_t *b = p->buf;
+
+    if (   p->buf_size < 128
+        || b[0] != 10
+        || b[1] > 5
+        || b[2] != 1
+        || av_popcount(b[3]) != 1 || b[3] > 8
+        || AV_RL16(&b[4]) > AV_RL16(&b[8])
+        || AV_RL16(&b[6]) > AV_RL16(&b[10])
+        || b[64])
+        return 0;
+    b += 73;
+    while (++b < p->buf + 128)
+        if (*b)
+            return AVPROBE_SCORE_EXTENSION / 4;
+
+    return AVPROBE_SCORE_EXTENSION + 1;
+}
+
 static int qdraw_probe(AVProbeData *p)
 {
     const uint8_t *b = p->buf;
@@ -865,6 +886,7 @@ IMAGEAUTO_DEMUXER(exr,     AV_CODEC_ID_EXR)
 IMAGEAUTO_DEMUXER(j2k,     AV_CODEC_ID_JPEG2000)
 IMAGEAUTO_DEMUXER(jpeg,    AV_CODEC_ID_MJPEG)
 IMAGEAUTO_DEMUXER(jpegls,  AV_CODEC_ID_JPEGLS)
+IMAGEAUTO_DEMUXER(pcx,     AV_CODEC_ID_PCX)
 IMAGEAUTO_DEMUXER(pictor,  AV_CODEC_ID_PICTOR)
 IMAGEAUTO_DEMUXER(png,     AV_CODEC_ID_PNG)
 IMAGEAUTO_DEMUXER(qdraw,   AV_CODEC_ID_QDRAW)
diff --git a/libavformat/version.h b/libavformat/version.h
index 82a8892..29aca66 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR  57
-#define LIBAVFORMAT_VERSION_MINOR  26
+#define LIBAVFORMAT_VERSION_MINOR  27
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list