diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-03-06 22:28:22 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-03-06 22:28:22 +0100 |
commit | e356487fdae890a8236fbe374c58685e5945a280 (patch) | |
tree | 351424dde382be50bc6d9d39a702dc325d3c633e /libavformat/img2dec.c | |
parent | aebfbe5c1368ca1a3a8dfad49fa05e36ac430b08 (diff) | |
download | ffmpeg-e356487fdae890a8236fbe374c58685e5945a280.tar.gz |
lavf/img2dec: Use jpeg constants in jpeg_probe().
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r-- | libavformat/img2dec.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 019793f29c..fe0e346d94 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -33,6 +33,7 @@ #include "avio_internal.h" #include "internal.h" #include "img2.h" +#include "libavcodec/mjpeg.h" #if HAVE_GLOB /* Locally define as 0 (bitwise-OR no-op) any missing glob options that @@ -687,7 +688,7 @@ static int j2k_probe(AVProbeData *p) static int jpeg_probe(AVProbeData *p) { const uint8_t *b = p->buf; - int i, state = 0xD8; + int i, state = SOI; if (AV_RB16(b) != 0xFFD8 || AV_RB32(b) == 0xFFD8FFF7) @@ -700,57 +701,57 @@ static int jpeg_probe(AVProbeData *p) continue; c = b[i + 1]; switch (c) { - case 0xD8: + case SOI: return 0; - case 0xC0: - case 0xC1: - case 0xC2: - case 0xC3: - case 0xC5: - case 0xC6: - case 0xC7: + case SOF0: + case SOF1: + case SOF2: + case SOF3: + case SOF5: + case SOF6: + case SOF7: i += AV_RB16(&b[i + 2]) + 1; - if (state != 0xD8) + if (state != SOI) return 0; - state = 0xC0; + state = SOF0; break; - case 0xDA: + case SOS: i += AV_RB16(&b[i + 2]) + 1; - if (state != 0xC0 && state != 0xDA) + if (state != SOF0 && state != SOS) return 0; - state = 0xDA; + state = SOS; break; - case 0xD9: - if (state != 0xDA) + case EOI: + if (state != SOS) return 0; - state = 0xD9; + state = EOI; break; - case 0xE0: - case 0xE1: - case 0xE2: - case 0xE3: - case 0xE4: - case 0xE5: - case 0xE6: - case 0xE7: - case 0xE8: - case 0xE9: - case 0xEA: - case 0xEB: - case 0xEC: - case 0xED: - case 0xEE: - case 0xEF: + case APP0: + case APP1: + case APP2: + case APP3: + case APP4: + case APP5: + case APP6: + case APP7: + case APP8: + case APP9: + case APP10: + case APP11: + case APP12: + case APP13: + case APP14: + case APP15: i += AV_RB16(&b[i + 2]) + 1; break; default: - if ( (c >= 0x02 && c <= 0xBF) - || c == 0xC8) + if ( (c > TEM && c < SOF0) + || c == JPG) return 0; } } - if (state == 0xD9) + if (state == EOI) return AVPROBE_SCORE_EXTENSION + 1; return AVPROBE_SCORE_EXTENSION / 8; } |