[FFmpeg-devel] [PATCH]Autodetect dds frames
Carl Eugen Hoyos
cehoyos at ag.or.at
Thu Jun 25 09:37:42 CEST 2015
Hi!
Attached patch adds autodetection for dds.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5380a2a..11bdd2b 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -200,6 +200,7 @@ OBJS-$(CONFIG_IMAGE2PIPE_MUXER) += img2enc.o img2.o
OBJS-$(CONFIG_IMAGE2_ALIAS_PIX_DEMUXER) += img2_alias_pix.o
OBJS-$(CONFIG_IMAGE2_BRENDER_PIX_DEMUXER) += img2_brender_pix.o
OBJS-$(CONFIG_IMAGE_BMP_PIPE_DEMUXER) += img2dec.o img2.o
+OBJS-$(CONFIG_IMAGE_DDS_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_DPX_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_EXR_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_J2K_PIPE_DEMUXER) += img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 306e0c9..579a25a 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -334,6 +334,7 @@ void av_register_all(void)
/* image demuxers */
REGISTER_DEMUXER (IMAGE_BMP_PIPE, image_bmp_pipe);
+ REGISTER_DEMUXER (IMAGE_DDS_PIPE, image_dds_pipe);
REGISTER_DEMUXER (IMAGE_DPX_PIPE, image_dpx_pipe);
REGISTER_DEMUXER (IMAGE_EXR_PIPE, image_exr_pipe);
REGISTER_DEMUXER (IMAGE_J2K_PIPE, image_j2k_pipe);
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 0830f00..772204c 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -609,6 +609,17 @@ static int bmp_probe(AVProbeData *p)
return AVPROBE_SCORE_EXTENSION / 4;
}
+static int dds_probe(AVProbeData *p)
+{
+ const uint8_t *b = p->buf;
+
+ if ( AV_RB64(b) == 0x444453207c000000
+ && AV_RL32(b + 8)
+ && AV_RL32(b + 12))
+ return AVPROBE_SCORE_MAX - 1;
+ return 0;
+}
+
static int dpx_probe(AVProbeData *p)
{
const uint8_t *b = p->buf;
@@ -799,6 +810,7 @@ AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
};
IMAGEAUTO_DEMUXER(bmp, AV_CODEC_ID_BMP)
+IMAGEAUTO_DEMUXER(dds, AV_CODEC_ID_DDS)
IMAGEAUTO_DEMUXER(dpx, AV_CODEC_ID_DPX)
IMAGEAUTO_DEMUXER(exr, AV_CODEC_ID_EXR)
IMAGEAUTO_DEMUXER(j2k, AV_CODEC_ID_JPEG2000)
More information about the ffmpeg-devel
mailing list