From d919fdd4f7e8bf5354e99780181cdaedcf879fa5 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 4 Jul 2014 21:13:40 +0200 Subject: [PATCH 1/3] Do not detect jp2 images as mov files. --- libavformat/mov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 03ed6d4220..89ecc5400b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3264,7 +3264,6 @@ static int mov_probe(AVProbeData *p) /* check for obvious tags */ case MKTAG('m','o','o','v'): moov_offset = offset + 4; - case MKTAG('j','P',' ',' '): /* jpeg 2000 signature */ case MKTAG('m','d','a','t'): case MKTAG('p','n','o','t'): /* detect movs with preview pics like ew.mov and april.mov */ case MKTAG('u','d','t','a'): /* Packet Video PVAuthor adds this and a lot of more junk */ @@ -3274,6 +3273,9 @@ static int mov_probe(AVProbeData *p) offset + 12 > (unsigned int)p->buf_size || AV_RB64(p->buf+offset + 8) == 0)) { score = FFMAX(score, AVPROBE_SCORE_EXTENSION); + } else if (tag == MKTAG('f','t','y','p') && + AV_RL32(p->buf + offset + 8) == MKTAG('j','p','2',' ')) { + score = FFMAX(score, 5); } else { score = AVPROBE_SCORE_MAX; } From 8f6a04a279bb72b9aa73d30b9e43a54fd9b1aedb Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 4 Jul 2014 21:14:53 +0200 Subject: [PATCH 2/3] Assume that old bmps do not contain transparency information. Fixes MK50TEMP.BMP that has its RGB channel bit masks on the actual image. --- libavcodec/bmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index 7443fa9772..ec4c467049 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -128,6 +128,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, rgb[0] = bytestream_get_le32(&buf); rgb[1] = bytestream_get_le32(&buf); rgb[2] = bytestream_get_le32(&buf); + if (ihsize > 40) alpha = bytestream_get_le32(&buf); } From 810294ce3d3d9cceb3670a938379e2b2cba6cdc9 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 4 Jul 2014 21:23:53 +0200 Subject: [PATCH 3/3] Use os/2 palette even if it contains less than 256 entries. Fixes 11Bios13.bmp. --- libavcodec/bmp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index ec4c467049..458fd0c768 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -248,6 +248,8 @@ static int bmp_decode_frame(AVCodecContext *avctx, } else if (t) { colors = t; } + } else { + colors = FFMIN(256, (hsize-ihsize-14) / 3); } buf = buf0 + 14 + ihsize; //palette location // OS/2 bitmap, 3 bytes per palette entry