* Be more picky about what we call thumbnails for JPEG images. Verify that the resolution is <= 160x160 to comply with the DLNA spec.

This commit is contained in:
Justin Maggard
2009-06-03 20:41:08 +00:00
parent 4d58278a5a
commit bce6da53ea

View File

@ -27,6 +27,7 @@
#include <fcntl.h>
#include <libexif/exif-loader.h>
#include "image_utils.h"
#include <jpeglib.h>
#include <setjmp.h>
#include <avutil.h>
@ -345,6 +346,7 @@ GetImageMetadata(const char * path, char * name)
struct stat file;
sqlite_int64 ret;
char *sql;
image * imsrc;
metadata_t m;
memset(&m, '\0', sizeof(metadata_t));
@ -410,9 +412,25 @@ GetImageMetadata(const char * path, char * name)
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " * model: %s\n", model);
if( ed->size )
{
/* We might need to verify that the thumbnail is 160x160 or smaller */
if( ed->size > 12000 )
{
imsrc = image_new_from_jpeg(NULL, 0, (char *)ed->data, ed->size);
if( imsrc )
{
if( (imsrc->width <= 160) && (imsrc->height <= 160) )
{
thumb = 1;
}
image_free(imsrc);
}
}
else
thumb = 0;
{
thumb = 1;
}
}
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " * thumbnail: %d\n", thumb);
exif_data_unref(ed);