Bug 7648 - JPEG image headers truncated for some APIC frames
: JPEG image headers truncated for some APIC frames
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Artwork
: 7.0
: All Ubuntu Linux
: P1 normal (vote)
: 7.x
Assigned To: Andy Grundman
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-27 22:16 UTC by Chuck LeDuc
Modified: 2009-07-31 10:18 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
This is the cover.jpg generated by SqueezeCenter and displayed in the web interface. (18.75 KB, application/octet-stream)
2008-03-27 22:18 UTC, Chuck LeDuc
Details
This is the same file as cover.jpg with "FF" prepended -- notice it now works. (18.75 KB, image/jpeg)
2008-03-27 22:19 UTC, Chuck LeDuc
Details
MP3 file containing an image which SqueezeCenter mangles (5.39 MB, audio/mpeg)
2008-03-27 22:24 UTC, Chuck LeDuc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chuck LeDuc 2008-03-27 22:16:13 UTC
Images embedded in some MP3 files are corrupted and do not display properly in SqueezeCenter nor on the remote. I have been seeing this behaviour with some regularity on my system. I think I have found the problem: the file header is being truncated at the beginning by one byte.

I added an image file using EasyTAG (Version 2.1.2, Ubuntu Gutsy, with libid3tag 0.15.1 (beta)). The embedded image is read and displayed properly in Rhythmbox (version 0.11.2), but with SqueezeCenter (version info below) the cover.jpg presented has the first byte truncated. Instead of beginning "FFD8FFE0" it begins "D8FFE0" and nothing recognizes it as a JPEG file -- not Gnome, not eog, not Gimp, and obviously not Firefox or my remote. If I take that image file and prepend "FF" and save it, the image displays correctly everywhere.

So obviously there's an off-by-one error somewhere in the image extraction code. It is apparently manifesting itself somewhat irregularly. I have (many) MP3 files for which SqueezeCenter manifests this behaviour regularly, if a member of the Slim Devices team wants a test case -- I can't attach it b/c it is too large. I have attached a zip file with the broken and corrected image (I couldn't include the broken image itself, because this forum rejects it as an invalid image, as it should).

SqueezeCenter Version: 7.0 - 17793 - Debian - EN - iso-8859-1
Server IP address: 192.168.1.103
Perl Version: 5.8.8 i486-linux-gnu-thread-multi
MySQL Version: 5.0.45-Debian_1ubuntu3.3
Platform Architecture: i686-linux
Comment 1 Chuck LeDuc 2008-03-27 22:18:06 UTC
Created attachment 3144 [details]
This is the cover.jpg generated by SqueezeCenter and displayed in the web interface.

This is an invalid jpeg file.
Comment 2 Chuck LeDuc 2008-03-27 22:19:32 UTC
Created attachment 3145 [details]
This is the same file as cover.jpg with "FF" prepended -- notice it now works.

I edited this using "hexer" and prepended "FF".  It now works.
Comment 3 Chuck LeDuc 2008-03-27 22:24:01 UTC
Created attachment 3146 [details]
MP3 file containing an image which SqueezeCenter mangles

This file contains an embedded JPEG image attached with EasyTAG 2.1.2.  The image displays properly in EasyTag and in Rhythmbox, and if you look at the file in a binary editor, the image is intact within the MP3 file (with the proper header).
Comment 4 Chuck LeDuc 2008-03-27 22:24:48 UTC
JPEG file format information from http://www.obrador.com/essentialjpeg/HeaderInfo.htm
Comment 5 Andy Grundman 2008-03-28 05:09:10 UTC
I'll look at this one.
Comment 6 Andy Grundman 2008-03-28 12:01:15 UTC
Fixed in 7.0 change 18132.  The problem was we weren't correctly handling UTF8 encoding of the APIC frame, skipping an extra byte that we should only skip if the encoding is UTF16.

There's another issue here which is we should really be using the second APIC image in this file (the cover, 0x03), but I'll file another bug for that.
Comment 7 Chuck LeDuc 2008-03-28 13:07:17 UTC
Awesome, Thanks Andy!  Is this committed in SVN?
Comment 8 Chuck LeDuc 2008-03-28 13:08:44 UTC
(In reply to comment #7)
> Awesome, Thanks Andy!  Is this committed in SVN?
> 
Duh. Found it. Thanks!
Comment 9 Ross Levine 2008-05-02 16:40:48 UTC
Verified to be working 7.0.1 - 19325
Comment 10 James Richardson 2008-05-15 12:29:46 UTC
This bug has recently been fixed in the latest release of SqueezeCenter 7.0.1

Please try that version, if you still see the error, then reopen this bug.

To download this version, please navigate to: http://www.slimdevices.com/su_downloads.html
Comment 11 Chris Owens 2009-07-31 10:18:43 UTC
Reduce number of active targets for SC