[FFmpeg-cvslog] Autodetect JPEG2000 imagess.

Carl Eugen Hoyos git at videolan.org
Fri Jul 4 02:11:45 CEST 2014


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Fri Jul  4 02:10:26 2014 +0200| [4c145b692c31802b6f1be248f56450e20331269b] | committer: Carl Eugen Hoyos

Autodetect JPEG2000 imagess.

Autodetection of jp2 files does not work yet, the files are detected
as mov.

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

 libavformat/Makefile     |    1 +
 libavformat/allformats.c |    1 +
 libavformat/img2dec.c    |   11 +++++++++++
 3 files changed, 13 insertions(+)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 7e7a7fb..03af08a 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -190,6 +190,7 @@ OBJS-$(CONFIG_IMAGE2_BRENDER_PIX_DEMUXER) += img2_brender_pix.o
 OBJS-$(CONFIG_IMAGE_BMP_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
 OBJS-$(CONFIG_IMAGE_PICTOR_PIPE_DEMUXER)  += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_PNG_PIPE_DEMUXER)     += img2dec.o img2.o
 OBJS-$(CONFIG_IMAGE_SGI_PIPE_DEMUXER)     += img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index dbde432..c07fbd1 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -322,6 +322,7 @@ void av_register_all(void)
     REGISTER_DEMUXER (IMAGE_BMP_PIPE,        image_bmp_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);
     REGISTER_DEMUXER (IMAGE_PICTOR_PIPE,     image_pictor_pipe);
     REGISTER_DEMUXER (IMAGE_PNG_PIPE,        image_png_pipe);
     REGISTER_DEMUXER (IMAGE_SGI_PIPE,        image_sgi_pipe);
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index a8f87ef..e795842 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -583,6 +583,16 @@ static int exr_probe(AVProbeData *p)
     return 0;
 }
 
+static int j2k_probe(AVProbeData *p)
+{
+    const uint8_t *b = p->buf;
+
+    if (AV_RB64(b) == 0x0000000c6a502020 ||
+        AV_RB32(b) == 0xff4fff51)
+        return AVPROBE_SCORE_EXTENSION + 1;
+    return 0;
+}
+
 static int pictor_probe(AVProbeData *p)
 {
     const uint8_t *b = p->buf;
@@ -653,6 +663,7 @@ AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
 IMAGEAUTO_DEMUXER(bmp,     AV_CODEC_ID_BMP)
 IMAGEAUTO_DEMUXER(dpx,     AV_CODEC_ID_DPX)
 IMAGEAUTO_DEMUXER(exr,     AV_CODEC_ID_EXR)
+IMAGEAUTO_DEMUXER(j2k,     AV_CODEC_ID_JPEG2000)
 IMAGEAUTO_DEMUXER(pictor,  AV_CODEC_ID_PICTOR)
 IMAGEAUTO_DEMUXER(png,     AV_CODEC_ID_PNG)
 IMAGEAUTO_DEMUXER(sgi,     AV_CODEC_ID_SGI)



More information about the ffmpeg-cvslog mailing list