diff options
author | Martin Vignali | 2016-11-24 21:26:56 +0100 |
---|---|---|
committer | Michael Niedermayer | 2016-12-14 03:21:27 +0100 |
commit | a534862b278a52c09ddf7d6e78e72397b6b4048b (patch) | |
tree | 5ef2a083e20a6d74535801cef5da424d693228f0 /libavformat/img2dec.c | |
parent | 90af962911bbe10f32a4367954c4f11a9e47a98f (diff) |
libavformat : add Photoshop PSD demuxer.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r-- | libavformat/img2dec.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index a920f4611f..f1a0e7fa54 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -822,6 +822,37 @@ static int png_probe(AVProbeData *p) return 0; } +static int psd_probe(AVProbeData *p) +{ + const uint8_t *b = p->buf; + int ret = 0; + uint16_t color_mode; + + if (AV_RL32(b) == MKTAG('8','B','P','S')) { + ret += 1; + } else { + return 0; + } + + if ((b[4] == 0) && (b[5] == 1)) {/* version 1 is PSD, version 2 is PSB */ + ret += 1; + } else { + return 0; + } + + if ((AV_RL32(b+6) == 0) && (AV_RL16(b+10) == 0))/* reserved must be 0 */ + ret += 1; + + color_mode = AV_RB16(b+24); + if ((color_mode <= 9) && (color_mode != 5) && (color_mode != 6)) + ret += 1; + + if (ret) + return AVPROBE_SCORE_EXTENSION + ret; + + return 0; +} + static int sgi_probe(AVProbeData *p) { const uint8_t *b = p->buf; @@ -947,6 +978,7 @@ IMAGEAUTO_DEMUXER(pgmyuv, AV_CODEC_ID_PGMYUV) IMAGEAUTO_DEMUXER(pictor, AV_CODEC_ID_PICTOR) IMAGEAUTO_DEMUXER(png, AV_CODEC_ID_PNG) IMAGEAUTO_DEMUXER(ppm, AV_CODEC_ID_PPM) +IMAGEAUTO_DEMUXER(psd, AV_CODEC_ID_PSD) IMAGEAUTO_DEMUXER(qdraw, AV_CODEC_ID_QDRAW) IMAGEAUTO_DEMUXER(sgi, AV_CODEC_ID_SGI) IMAGEAUTO_DEMUXER(sunrast, AV_CODEC_ID_SUNRAST) |