1
0
Fork 0
forked from len0rd/rockbox

FS#11819: image viewer: use magick number in file to determine image type.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29110 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2011-01-22 13:41:53 +00:00
parent 060609a202
commit 68cc564c9b
3 changed files with 72 additions and 15 deletions

View file

@ -148,8 +148,8 @@ static void get_pic_list(void)
for (i = 0; i < tree->filesindir && buf_size > sizeof(char**); i++)
{
if (!(dircache[i].attr & ATTR_DIRECTORY)
&& get_image_type(dircache[i].name) != IMAGE_UNKNOWN)
/* Add all files. Non-image files will be filtered out while loading. */
if (!(dircache[i].attr & ATTR_DIRECTORY))
{
file_pt[entries] = dircache[i].name;
/* Set Selected File. */
@ -742,7 +742,13 @@ static int load_and_show(char* filename, struct image_info *info)
rb->lcd_clear_display();
status = get_image_type(filename);
/* suppress warning while running slideshow */
status = get_image_type(filename, iv_api.running_slideshow);
if (status == IMAGE_UNKNOWN) {
/* file isn't supported image file, skip this. */
file_pt[curfile] = NULL;
return change_filename(direction);
}
if (image_type != status) /* type of image is changed, load decoder. */
{
struct loader_info loader_info = {
@ -914,7 +920,7 @@ enum plugin_status plugin_start(const void* parameter)
if(!parameter) return PLUGIN_ERROR;
rb->strcpy(np_file, parameter);
if (get_image_type(np_file) == IMAGE_UNKNOWN)
if (get_image_type(np_file, false) == IMAGE_UNKNOWN)
{
rb->splash(HZ*2, "Unsupported file");
return PLUGIN_ERROR;