Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

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

Attached to Project: Rockbox
Opened by Teruaki Kawashima (teru) - Monday, 20 December 2010, 15:35 GMT+2
Last edited by Teruaki Kawashima (teru) - Saturday, 22 January 2011, 14:47 GMT+2
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

this implements suggestions discussed in mailing list ( FS#6321  - Universal Image Viewer(http://www.rockbox.org/mail/archive/rockbox-dev-archive-2010-11/0058.shtml))
get_image_type in image_decoder.c is changed as follows.
1. if it has supported image's magick value and has assosiated file extension, returns corresponding IMAGE_*.
file will be loaded.
2. if it has supported image's magick value but *doesn't* have assosiated file extension, it warns that file extension might not be correct and returns corresponding IMAGE_* determined from the magick value.
file will be loaded.
3. if it *doesn't* have supported image's magick value but has supported image file's file extension, returns corresponding IMAGE_* determined from the extension.
file will not be loaded, and error will be displayed. user can know something is wrong.
4. if it *doesn't* have supported image's magick value and *doesn't* have supported image file's file extension, returns IMAGE_UNKNOWN.
image viewer skips to next file silently.

get_pic_list imag in imageviewer.c is changed so that it create list of all file.
(if filtering is done at this point, initial loading would take longer, but not confirmed)
   imageviewer_magic.patch (3.5 KiB)
 apps/plugins/imageviewer/imageviewer.c   |    5 +-
 apps/plugins/imageviewer/image_decoder.c |   55 ++++++++++++++++++++++++++-----
 apps/plugins/imageviewer/image_decoder.h |    3 +
 3 files changed, 53 insertions(+), 10 deletions(-)

This task depends upon

Closed by  Teruaki Kawashima (teru)
Saturday, 22 January 2011, 14:47 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Committed in r29110.
Comment by Teruaki Kawashima (teru) - Tuesday, 21 December 2010, 14:49 GMT+2
it seems like i attached wrong version of the patch. this is correct one.
   imageviewer_magic.patch (4.4 KiB)
 apps/plugins/imageviewer/imageviewer.c   |   10 +++-
 apps/plugins/imageviewer/image_decoder.c |   67 +++++++++++++++++++++++++++----
 apps/plugins/imageviewer/image_decoder.h |    3 +
 3 files changed, 70 insertions(+), 10 deletions(-)

Comment by Marcin Bukat (MarcinBukat) - Saturday, 25 December 2010, 14:51 GMT+2
What about situation where the same decoder handles a few variants of the format with different magic values? One example is ppmviewer with magic numbers P2 and P6 both valid.
Comment by Teruaki Kawashima (teru) - Sunday, 26 December 2010, 08:41 GMT+2
add both of them to magic_list and files will be loaded fine.

update patch: slightly change error message.
   imageviewer_magic.2.patch (4.8 KiB)
 apps/plugins/imageviewer/imageviewer.c   |   15 +++++-
 apps/plugins/imageviewer/image_decoder.c |   67 ++++++++++++++++++++++++++-----
 apps/plugins/imageviewer/image_decoder.h |    5 +-
 3 files changed, 73 insertions(+), 14 deletions(-)

Comment by Teruaki Kawashima (teru) - Saturday, 15 January 2011, 12:32 GMT+2
synced.
   imageviewer_magic.3.patch (5.1 KiB)
 apps/plugins/imageviewer/imageviewer.c   |   15 ++++--
 apps/plugins/imageviewer/image_decoder.c |   73 ++++++++++++++++++++++++++-----
 apps/plugins/imageviewer/image_decoder.h |    5 +-
 3 files changed, 78 insertions(+), 15 deletions(-)

Loading...