[vlc-commits] add exif jpeg detection to the image demuxer
Sébastien Escudier
git at videolan.org
Thu Feb 16 10:33:41 CET 2012
vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Wed Feb 15 11:37:58 2012 +0100| [212e7579d65364ed3e749594052b028db8ccf2cb] | committer: Sébastien Escudier
add exif jpeg detection to the image demuxer
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=212e7579d65364ed3e749594052b028db8ccf2cb
---
modules/demux/image.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/modules/demux/image.c b/modules/demux/image.c
index 8921404..f2fb8ac 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -404,6 +404,24 @@ static bool IsSpiff(stream_t *s)
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)
{
/* The header is not enough to ensure proper detection, we need
@@ -513,6 +531,9 @@ static const image_format_t formats[] = {
{ .codec = VLC_CODEC_JPEG,
.detect = IsSpiff,
},
+ { .codec = VLC_CODEC_JPEG,
+ .detect = IsExif,
+ },
{ .codec = VLC_CODEC_TARGA,
.detect = IsTarga,
},
More information about the vlc-commits
mailing list