PDA

View Full Version : JPEG decode failure


rectalogic
May 21st, 2009, 04:44 PM
Boxee can't seem to decode any of the JPEG thumbnails we use, e.g.

http://www.motionbox.com/thumbnails/f/7/d/9/1285651-f7d9b20d5d7a15fa-thumbs/thumb00003.jpg

This file begins with SOI marker 0xFFD8 followed by a comment marker 0xFFFE

In boxee-0.9.11.5777-src/xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp method CxImageJPG::Decode() scans for SOI 0xFFD8 followed by 0xFFE0, 0xFFE1 or 0xFFC4. Any other markers like 0xFFD8 and it fails.

This recent patch to ximajpg.cpp (http://github.com/elan/xbmc-sources-fork/commit/ad149d94a077066092ab1af35e463a15c9e842e1) in Plex I think will fix the problem for Boxee, it expands the set of allowable markers following SOI.


Simplest way to reproduce this is to add the following to sources.xml:

<source>
<name>TestJPEG</name>
<path>app://test</path>
<thumbnail>http://www.motionbox.com/thumbnails/f/7/d/9/1285651-f7d9b20d5d7a15fa-thumbs/thumb00003.jpg</thumbnail>
</source>


Then in the boxee.log you will see:

ERROR: Invalid url:
INFO: msg: Error loading JPEG - no SOI marker found in first 8096 bytes
INFO: msg: Error loading JPEG - no SOI marker found in first 8096 bytes
INFO: msg: PICTURE::CreateThumbnail: Unable to open image: http://www.motionbox.com/thumbnails/f/7/d/9/1285651-f7d9b20d5d7a15fa-thumbs/thumb00003.jpg Error:
ERROR: PICTURE::DoCreateThumbnail: Unable to create thumbfile /Users/aw/Library/Application Support/BOXEE/UserData/profiles/rectalogic/Thumbnails/Pictures/7/7e75fea0.tbn from image http://www.motionbox.com/thumbnails/f/7/d/9/1285651-f7d9b20d5d7a15fa-thumbs/thumb00003.jpg

ameno
May 21st, 2009, 08:19 PM
Yes, we had that same problem. In the end, we ended up creating a proxy php file that converted the files to png's on the fly.

rectalogic
May 28th, 2009, 05:21 PM
I applied the Plex patch to Boxee 0.9.11.5777 and rebuilt and it fixed the issue. A Boxee branch with the patch applied is here:

http://github.com/rectalogic/boxee/commit/9d638b1d3e1192b7d04b855b83c3e6080896a015


Boxee does have a second issue where if the jpg is returned using Transfer-Encoding: chunked (and so no Content-Length), it also fails. I can fix this on the server side though.

Boxee fails because CxImageJPG::Decode attempts to seek to 0 after finding the SOI, and CFileCurl thinks the length is 0 and so short circuits the seek and the subsequent JPEG decode fails since we did not actually seek to the beginning of the SOI.