summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2012-05-19 17:21:55 +0000
committerMarcus Meissner <marcus@jet.franken.de>2012-05-19 17:21:55 +0000
commit8048a97d9e6bd965717555bd7ce9fe6520012eb2 (patch)
tree25e9b3d3732b2bdd0ce1e88ede3f206a1365555c
parent077c4ab90875f5c7e5bab7102f0d39ab17b1994e (diff)
downloadlibgphoto2-8048a97d9e6bd965717555bd7ce9fe6520012eb2.tar.gz
enhance the thumbnail check to make eos thumbnails work again
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_4/libgphoto2@14020 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r--camlibs/ptp2/library.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c
index cfba9b739..389f07965 100644
--- a/camlibs/ptp2/library.c
+++ b/camlibs/ptp2/library.c
@@ -4555,12 +4555,14 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
unsigned char *ximage = NULL;
unsigned int xlen = 0;
- /* If thumb size is 0 then there is no thumbnail at all... */
- if((size=oi->ThumbCompressedSize)==0) return (GP_ERROR_NOT_SUPPORTED);
+ size=oi->ThumbCompressedSize;
+ /* If thumb size is 0 and the OFC is not a image type (0x3800 / 0xb800)... */
+ if ((size==0) && ((oi->ObjectFormat & 0x7800) != 0x3800))
+ return GP_ERROR_NOT_SUPPORTED;
CPR (context, ptp_getthumb(params,
params->handles.Handler[object_id],
&ximage, &xlen));
- if (xlen != size)
+ if (size && (xlen != size))
gp_log (GP_LOG_ERROR, "get_file_func/GP_FILE_TYPE_PREVIEW", "size mismatch %d vs %d", size, xlen);
set_mimetype (camera, file, params->deviceinfo.VendorExtensionID, oi->ThumbFormat);
CR (gp_file_set_data_and_size (file, (char*)ximage, xlen));