diff options
author | Paul B Mahol | 2018-12-08 13:06:31 +0100 |
---|---|---|
committer | Paul B Mahol | 2018-12-10 11:20:41 +0100 |
commit | eade85bbbd935f4ab5e6315a45650c2bf01465c6 (patch) | |
tree | 592880259439aac8bd1c044508949486ee44ffd2 /libavformat/img2dec.c | |
parent | 8f66d46ce5f41be8084ad14061cec8f8e769d711 (diff) |
avformat: add gif pipe demuxer
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r-- | libavformat/img2dec.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index ff4757e532..e82b1df50b 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -29,6 +29,7 @@ #include "libavutil/pixdesc.h" #include "libavutil/parseutils.h" #include "libavutil/intreadwrite.h" +#include "libavcodec/gif.h" #include "avformat.h" #include "avio_internal.h" #include "internal.h" @@ -1005,6 +1006,19 @@ static int xwd_probe(AVProbeData *p) return AVPROBE_SCORE_MAX / 2 + 1; } +static int gif_probe(AVProbeData *p) +{ + /* check magick */ + if (memcmp(p->buf, gif87a_sig, 6) && memcmp(p->buf, gif89a_sig, 6)) + return 0; + + /* width or height contains zero? */ + if (!AV_RL16(&p->buf[6]) || !AV_RL16(&p->buf[8])) + return 0; + + return AVPROBE_SCORE_MAX - 1; +} + #define IMAGEAUTO_DEMUXER(imgname, codecid)\ static const AVClass imgname ## _class = {\ .class_name = AV_STRINGIFY(imgname) " demuxer",\ @@ -1028,6 +1042,7 @@ IMAGEAUTO_DEMUXER(bmp, AV_CODEC_ID_BMP) IMAGEAUTO_DEMUXER(dds, AV_CODEC_ID_DDS) IMAGEAUTO_DEMUXER(dpx, AV_CODEC_ID_DPX) IMAGEAUTO_DEMUXER(exr, AV_CODEC_ID_EXR) +IMAGEAUTO_DEMUXER(gif, AV_CODEC_ID_GIF) IMAGEAUTO_DEMUXER(j2k, AV_CODEC_ID_JPEG2000) IMAGEAUTO_DEMUXER(jpeg, AV_CODEC_ID_MJPEG) IMAGEAUTO_DEMUXER(jpegls, AV_CODEC_ID_JPEGLS) |