* Fix bug with bad album art.
This commit is contained in:
parent
9854e35533
commit
0a415861e7
@ -181,6 +181,8 @@ check_for_album_file(char * dir)
|
||||
if( access(file, R_OK) == 0 )
|
||||
{
|
||||
imsrc = image_new_from_jpeg(file, 1, NULL, 0);
|
||||
if( !imsrc )
|
||||
return NULL;
|
||||
width = imsrc->width;
|
||||
height = imsrc->height;
|
||||
if( width > 160 || height > 160 )
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <setjmp.h>
|
||||
#include <jpeglib.h>
|
||||
|
||||
#include "image_utils.h"
|
||||
@ -175,11 +176,13 @@ jpeg_memory_src(j_decompress_ptr cinfo, const unsigned char * buffer, size_t buf
|
||||
src->pub.bytes_in_buffer = bufsize;
|
||||
}
|
||||
|
||||
jmp_buf setjmp_buffer;
|
||||
/* Don't exit on error like libjpeg likes to do */
|
||||
static void
|
||||
libjpeg_error_handler(j_common_ptr cinfo)
|
||||
{
|
||||
cinfo->err->output_message(cinfo);
|
||||
longjmp(setjmp_buffer, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -258,6 +261,13 @@ image_new_from_jpeg(const char * path, int is_file, const char * buf, int size)
|
||||
{
|
||||
jpeg_memory_src(&cinfo, (const unsigned char *)buf, size);
|
||||
}
|
||||
if( setjmp(setjmp_buffer) )
|
||||
{
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
if( is_file && file )
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
cinfo.do_fancy_upsampling = FALSE;
|
||||
cinfo.do_block_smoothing = FALSE;
|
||||
|
@ -414,6 +414,12 @@ GetImageMetadata(const char * path, char * name)
|
||||
fclose(infile);
|
||||
}
|
||||
|
||||
if( !width || !height )
|
||||
{
|
||||
if( m.mime )
|
||||
free(m.mime);
|
||||
return 0;
|
||||
}
|
||||
if( width <= 640 && height <= 480 )
|
||||
asprintf(&m.dlna_pn, "JPEG_SM;DLNA.ORG_OP=01;DLNA.ORG_CI=0");
|
||||
else if( width <= 1024 && height <= 768 )
|
||||
|
@ -883,6 +883,7 @@ shutdown:
|
||||
|
||||
if (sudp >= 0) close(sudp);
|
||||
if (shttpl >= 0) close(shttpl);
|
||||
if (sbeacon >= 0) close(sbeacon);
|
||||
|
||||
if(SendSSDPGoodbye(snotify, n_lan_addr) < 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user