vlc/vlc-2.0 | branch: master | Sébastien Escudier <sebastien-de...@celeos.eu> | Wed Feb 15 11:37:58 2012 +0100| [0d86ae71dd516af1242011509fca9c357a6ea0dc] | committer: Sébastien Escudier
add exif jpeg detection to the image demuxer (cherry picked from commit 212e7579d65364ed3e749594052b028db8ccf2cb) Signed-off-by: Sébastien Escudier <sebastien-de...@celeos.eu> > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=0d86ae71dd516af1242011509fca9c357a6ea0dc --- 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, }, _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org http://mailman.videolan.org/listinfo/vlc-commits