diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2017-03-16 19:46:03 +0100 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2017-03-16 19:46:03 +0100 |
commit | a3c76a78455dc2d7c5341573edb461e969fd6216 (patch) | |
tree | 9f082f3e9a72759fa7d31800208a7df6d96913cb | |
parent | ee08627134268b92a0cbb53038d5964245935475 (diff) | |
download | libgphoto2-a3c76a78455dc2d7c5341573edb461e969fd6216.tar.gz |
also allow RAW+
look for the first free buftype in capture_image
-rw-r--r-- | camlibs/pentax/library.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/camlibs/pentax/library.c b/camlibs/pentax/library.c index a6bfa19bd..810a89949 100644 --- a/camlibs/pentax/library.c +++ b/camlibs/pentax/library.c @@ -206,17 +206,21 @@ save_buffer(pslr_handle_t camhandle, int bufno, CameraFile *file, pslr_status *s uint32_t current; switch (status->image_format) { - case PSLR_IMAGE_FORMAT_JPEG: - imagetype = status->jpeg_quality + 1; - image_resolution = status->jpeg_resolution; + case PSLR_IMAGE_FORMAT_JPEG: + imagetype = status->jpeg_quality + 1; + image_resolution = status->jpeg_resolution; break; - case PSLR_IMAGE_FORMAT_RAW: - imagetype = 0; - image_resolution = 0; + case PSLR_IMAGE_FORMAT_RAW: + imagetype = 0; + image_resolution = 0; break; - default: - gp_log (GP_LOG_ERROR, "pentax", "Sorry, only JPEG and PEF RAW files are supported\n"); - return GP_ERROR; + case PSLR_IMAGE_FORMAT_RAW_PLUS: + imagetype = status->jpeg_quality + 1; + image_resolution = status->jpeg_resolution; + break; + default: + gp_log (GP_LOG_ERROR, "pentax", "Sorry, only JPEG and PEF RAW files are supported\n"); + return GP_ERROR; } gp_log(GP_LOG_DEBUG, "pentax", "get buffer %d type %d res %d\n", bufno, imagetype, image_resolution); @@ -270,6 +274,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, int ret, length; CameraFile *file = NULL; CameraFileInfo info; + int bufno; const char *mime; pslr_get_status (p, &status); @@ -308,14 +313,23 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, gp_file_set_mtime (file, time(NULL)); gp_file_set_mime_type (file, mime); + if (status.bufmask == 0) { + gp_log (GP_LOG_ERROR, "pentax", "no buffer available for download"); + return GP_ERROR; + } + for (bufno=0;bufno<16;bufno++) + if (status.bufmask & (1 << bufno)) + break; + /* we will have found one if bufmask != 0 */ + while (1) { - length = save_buffer( p, (int)0, file, &status); + length = save_buffer( p, bufno, file, &status); if (length == GP_ERROR_NOT_SUPPORTED) return length; if (length >= GP_OK) break; usleep(100000); } - pslr_delete_buffer(p, (int)0 ); + pslr_delete_buffer(p, bufno ); gp_log (GP_LOG_DEBUG, "pentax", "append image to fs"); ret = gp_filesystem_append(camera->fs, path->folder, path->name, context); @@ -370,7 +384,8 @@ camera_wait_for_event (Camera *camera, int timeout, gettimeofday (&event_start, 0); while (1) { pslr_status status; - int bufno; + int bufno; + const char *mime; if (PSLR_OK != pslr_get_status (camera->pl, &status)) break; @@ -384,7 +399,6 @@ camera_wait_for_event (Camera *camera, int timeout, break; if (bufno == 16) goto next; - const char *mime; path = malloc(sizeof(CameraFilePath)); strcpy (path->folder, "/"); switch (status.image_format) { |