aboutsummaryrefslogtreecommitdiff
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos2016-02-29 15:49:52 +0100
committerCarl Eugen Hoyos2016-02-29 15:49:52 +0100
commit8c5092912b19e793412b07e070da2f8636c2c2f3 (patch)
treedf01cfeb8f5485d872023a874bd745fd1fea07b9 /libavformat/img2dec.c
parent4e05a12a41f4934cffeef39fd1d490f1e6947dfc (diff)
lavf: Add pcx auto-detection.
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 94cce93e11..019793f29c 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -764,6 +764,27 @@ static int jpegls_probe(AVProbeData *p)
return 0;
}
+static int pcx_probe(AVProbeData *p)
+{
+ const uint8_t *b = p->buf;
+
+ if ( p->buf_size < 128
+ || b[0] != 10
+ || b[1] > 5
+ || b[2] != 1
+ || av_popcount(b[3]) != 1 || b[3] > 8
+ || AV_RL16(&b[4]) > AV_RL16(&b[8])
+ || AV_RL16(&b[6]) > AV_RL16(&b[10])
+ || b[64])
+ return 0;
+ b += 73;
+ while (++b < p->buf + 128)
+ if (*b)
+ return AVPROBE_SCORE_EXTENSION / 4;
+
+ return AVPROBE_SCORE_EXTENSION + 1;
+}
+
static int qdraw_probe(AVProbeData *p)
{
const uint8_t *b = p->buf;
@@ -865,6 +886,7 @@ IMAGEAUTO_DEMUXER(exr, AV_CODEC_ID_EXR)
IMAGEAUTO_DEMUXER(j2k, AV_CODEC_ID_JPEG2000)
IMAGEAUTO_DEMUXER(jpeg, AV_CODEC_ID_MJPEG)
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(qdraw, AV_CODEC_ID_QDRAW)