diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-05-31 13:33:54 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-06-05 14:06:54 +0300 |
commit | 973fab565378cbdd0712977152a66f5b17938d51 (patch) | |
tree | 720f0b9c6e8f3cf64c4134d0ae78a5e30d97a577 /libavformat/img2dec.c | |
parent | c6364b711bad1fe2fbd90e5b2798f87080ddf5ea (diff) |
avcodec: add QOI decoder and demuxer and parser and encoder and muxer
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r-- | libavformat/img2dec.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 5f9d1f094f..e4912cb487 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -1131,6 +1131,23 @@ static int photocd_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX - 1; } +static int qoi_probe(const AVProbeData *p) +{ + if (memcmp(p->buf, "qoif", 4)) + return 0; + + if (AV_RB32(p->buf + 4) == 0 || AV_RB32(p->buf + 8) == 0) + return 0; + + if (p->buf[12] != 3 && p->buf[12] != 4) + return 0; + + if (p->buf[13] > 1) + return 0; + + return AVPROBE_SCORE_MAX - 1; +} + static int gem_probe(const AVProbeData *p) { const uint8_t *b = p->buf; @@ -1208,6 +1225,7 @@ IMAGEAUTO_DEMUXER(png, PNG) IMAGEAUTO_DEMUXER(ppm, PPM) IMAGEAUTO_DEMUXER(psd, PSD) IMAGEAUTO_DEMUXER(qdraw, QDRAW) +IMAGEAUTO_DEMUXER(qoi, QOI) IMAGEAUTO_DEMUXER(sgi, SGI) IMAGEAUTO_DEMUXER(sunrast, SUNRAST) IMAGEAUTO_DEMUXER(svg, SVG) |