From b453e768427969b170820e8e8fe51c84856563b2 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 7 May 2015 00:51:28 +0200 Subject: [PATCH 1/2] lavc/qdrw: Also support real-world qdraw images. --- libavcodec/qdrw.c | 4 ++++ libavcodec/version.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index b650ade343..b7a7cf5f1d 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -124,6 +124,10 @@ static int decode_frame(AVCodecContext *avctx, int w, h, ret; bytestream2_init(&gbc, avpkt->data, avpkt->size); + if ( avpkt->size >= 552 + && AV_RB32(&avpkt->data[ 10]) != 0x001102FF + && AV_RB32(&avpkt->data[522]) == 0x001102FF) + bytestream2_skip(&gbc, 512); /* smallest PICT header */ if (bytestream2_get_bytes_left(&gbc) < 40) { diff --git a/libavcodec/version.h b/libavcodec/version.h index 3f06f85cb9..e4a7f753c4 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #define LIBAVCODEC_VERSION_MAJOR 56 #define LIBAVCODEC_VERSION_MINOR 37 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ From 2279de6eca1294082a307feb211b217781da8045 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 7 May 2015 01:10:45 +0200 Subject: [PATCH 2/2] lavf/img2dec: Autodetect qdraw images. --- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/img2dec.c | 11 +++++++++++ libavformat/version.h | 4 ++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 8d9a770784..bca9d5b9d4 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -206,6 +206,7 @@ OBJS-$(CONFIG_IMAGE_JPEG_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_JPEGLS_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 OBJS-$(CONFIG_IMAGE_SGI_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER) += img2dec.o img2.o OBJS-$(CONFIG_IMAGE_TIFF_PIPE_DEMUXER) += img2dec.o img2.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index e6a9d01672..0f53d4c73c 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -339,6 +339,7 @@ void av_register_all(void) REGISTER_DEMUXER (IMAGE_JPEGLS_PIPE, image_jpegls_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); REGISTER_DEMUXER (IMAGE_SGI_PIPE, image_sgi_pipe); REGISTER_DEMUXER (IMAGE_SUNRAST_PIPE, image_sunrast_pipe); REGISTER_DEMUXER (IMAGE_TIFF_PIPE, image_tiff_pipe); diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 5fc5b8342d..ba2911074b 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -707,6 +707,16 @@ static int jpegls_probe(AVProbeData *p) return 0; } +static int qdraw_probe(AVProbeData *p) +{ + const uint8_t *b = p->buf; + + if (!b[10] && AV_RB32(b+11) == 0x1102ff0c && !b[15] || + p->buf_size >= 528 && !b[522] && AV_RB32(b+523) == 0x1102ff0c && !b[527]) + return AVPROBE_SCORE_EXTENSION + 1; + return 0; +} + static int pictor_probe(AVProbeData *p) { const uint8_t *b = p->buf; @@ -793,6 +803,7 @@ IMAGEAUTO_DEMUXER(jpeg, AV_CODEC_ID_MJPEG) IMAGEAUTO_DEMUXER(jpegls, AV_CODEC_ID_JPEGLS) IMAGEAUTO_DEMUXER(pictor, AV_CODEC_ID_PICTOR) IMAGEAUTO_DEMUXER(png, AV_CODEC_ID_PNG) +IMAGEAUTO_DEMUXER(qdraw, AV_CODEC_ID_QDRAW) IMAGEAUTO_DEMUXER(sgi, AV_CODEC_ID_SGI) IMAGEAUTO_DEMUXER(sunrast, AV_CODEC_ID_SUNRAST) IMAGEAUTO_DEMUXER(tiff, AV_CODEC_ID_TIFF) diff --git a/libavformat/version.h b/libavformat/version.h index 976fa60fc8..6373017cfd 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,8 +30,8 @@ #include "libavutil/version.h" #define LIBAVFORMAT_VERSION_MAJOR 56 -#define LIBAVFORMAT_VERSION_MINOR 31 -#define LIBAVFORMAT_VERSION_MICRO 102 +#define LIBAVFORMAT_VERSION_MINOR 32 +#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \