[FFmpeg-devel] [PATCH] lavf/img2dec: add ppm pipe demuxer
Clément Bœsch
u at pkh.me
Thu Jun 9 11:49:10 CEST 2016
From: Clément Bœsch <clement at stupeflix.com>
---
libavformat/Makefile | 1 +
libavformat/allformats.c | 1 +
libavformat/img2dec.c | 18 ++++++++++++++++++
libavformat/version.h | 4 ++--
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6684ead..6f473b0 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -229,6 +229,7 @@ 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_PPM_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_QDRAW_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SGI_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER) += img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0a38793..c3c906f 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -360,6 +360,7 @@ void av_register_all(void)
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_PPM_PIPE, image_ppm_pipe);
REGISTER_DEMUXER (IMAGE_QDRAW_PIPE, image_qdraw_pipe);
REGISTER_DEMUXER (IMAGE_SGI_PIPE, image_sgi_pipe);
REGISTER_DEMUXER (IMAGE_SUNRAST_PIPE, image_sunrast_pipe);
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 8dfb813..668f31c 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -862,6 +862,23 @@ static int webp_probe(AVProbeData *p)
return 0;
}
+static int ppm_probe(AVProbeData *p)
+{
+ const uint8_t *b = p->buf;
+
+ if (b[0] == 'P' && b[1] >= '0' && b[1] <= '7') {
+ while (b[2] == '\r')
+ b++;
+ if (b[2] == '\n') {
+ if (b[3] == '#')
+ return AVPROBE_SCORE_EXTENSION + 1;
+ if (b[3] >= '0' && b[3] <= '9')
+ return AVPROBE_SCORE_MAX - 1;
+ }
+ }
+ return 0;
+}
+
#define IMAGEAUTO_DEMUXER(imgname, codecid)\
static const AVClass imgname ## _class = {\
.class_name = AV_STRINGIFY(imgname) " demuxer",\
@@ -891,6 +908,7 @@ 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(ppm, AV_CODEC_ID_PPM)
IMAGEAUTO_DEMUXER(qdraw, AV_CODEC_ID_QDRAW)
IMAGEAUTO_DEMUXER(sgi, AV_CODEC_ID_SGI)
IMAGEAUTO_DEMUXER(sunrast, AV_CODEC_ID_SUNRAST)
diff --git a/libavformat/version.h b/libavformat/version.h
index acfa513..b856085 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,8 +32,8 @@
// When bumping major check Ticket5467 for regressing
// Also please add any ticket numbers that you belive might regress here
#define LIBAVFORMAT_VERSION_MAJOR 57
-#define LIBAVFORMAT_VERSION_MINOR 37
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 38
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
--
2.8.3
More information about the ffmpeg-devel
mailing list