summaryrefslogtreecommitdiff
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c73
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;
}