Commit 212e7579 authored by Sébastien Escudier's avatar Sébastien Escudier

add exif jpeg detection to the image demuxer

parent 20bfa22b
...@@ -404,6 +404,24 @@ static bool IsSpiff(stream_t *s) ...@@ -404,6 +404,24 @@ static bool IsSpiff(stream_t *s)
return true; return true;
} }
static bool IsExif(stream_t *s)
{
const uint8_t *header;
int size = stream_Peek(s, &header, 256);
int position = 0;
if (FindJpegMarker(&position, header, size) != 0xd8)
return false;
if (FindJpegMarker(&position, header, size) != 0xe1)
return false;
position += 2; /* Skip size */
if (position + 5 > size)
return false;
if (memcmp(&header[position], "Exif\0", 5))
return false;
return true;
}
static bool IsTarga(stream_t *s) static bool IsTarga(stream_t *s)
{ {
/* The header is not enough to ensure proper detection, we need /* The header is not enough to ensure proper detection, we need
...@@ -513,6 +531,9 @@ static const image_format_t formats[] = { ...@@ -513,6 +531,9 @@ static const image_format_t formats[] = {
{ .codec = VLC_CODEC_JPEG, { .codec = VLC_CODEC_JPEG,
.detect = IsSpiff, .detect = IsSpiff,
}, },
{ .codec = VLC_CODEC_JPEG,
.detect = IsExif,
},
{ .codec = VLC_CODEC_TARGA, { .codec = VLC_CODEC_TARGA,
.detect = IsTarga, .detect = IsTarga,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment