diff options
Diffstat (limited to 'camlibs/pentax')
-rw-r--r-- | camlibs/pentax/library.c | 60 | ||||
-rw-r--r-- | camlibs/pentax/pslr.c | 36 | ||||
-rw-r--r-- | camlibs/pentax/pslr.h | 1 |
3 files changed, 65 insertions, 32 deletions
diff --git a/camlibs/pentax/library.c b/camlibs/pentax/library.c index c0b5c5871..0d2f53a1c 100644 --- a/camlibs/pentax/library.c +++ b/camlibs/pentax/library.c @@ -366,30 +366,50 @@ camera_get_config (Camera *camera, CameraWidget **window, GPContext *context) gp_widget_set_readonly (t, 1); gp_widget_append (section, t); - - gp_widget_new (GP_WIDGET_RADIO, _("Image Size"), &t); - gp_widget_set_name (t, "imgsize"); - for (i = 0; i < PSLR_MAX_RESOLUTIONS; i++) - { - gp_widget_add_choice (t, available_resolutions[i]); + gp_widget_new (GP_WIDGET_RADIO, _("Image format"), &t); + gp_widget_set_name (t, "img_format"); + if (pslr_is_image_format_supported(camera->pl, PSLR_IMAGE_FORMAT_JPEG)) + gp_widget_add_choice (t, "JPEG"); + if (pslr_is_image_format_supported(camera->pl, PSLR_IMAGE_FORMAT_RAW)) + gp_widget_add_choice (t, "RAW"); + if (pslr_is_image_format_supported(camera->pl, PSLR_IMAGE_FORMAT_RAW_PLUS)) + gp_widget_add_choice (t, "RAW+"); + switch (status.image_format) { + case PSLR_IMAGE_FORMAT_JPEG: gp_widget_set_value (t, "JPEG"); break; + case PSLR_IMAGE_FORMAT_RAW: gp_widget_set_value (t, "RAW"); break; + case PSLR_IMAGE_FORMAT_RAW_PLUS: gp_widget_set_value (t, "RAW+"); break; + default: + sprintf(buf, _("Unknown format %d"), status.image_format); + gp_widget_set_value (t, buf); + break; } + gp_widget_append (section, t); - if (status.jpeg_resolution > 0 && status.jpeg_resolution < PSLR_MAX_RESOLUTIONS) - gp_widget_set_value (t, available_resolutions[status.jpeg_resolution]); - else - gp_widget_set_value (t, _("Unknown")); + if (pslr_is_image_format_supported(camera->pl, PSLR_IMAGE_FORMAT_JPEG)) { + gp_widget_new (GP_WIDGET_RADIO, _("Image Size"), &t); + gp_widget_set_name (t, "imgsize"); + for (i = 0; i < PSLR_MAX_RESOLUTIONS && available_resolutions[i]; i++) + { + gp_widget_add_choice (t, available_resolutions[i]); + } - gp_widget_append (section, t); + if (status.jpeg_resolution > 0 && status.jpeg_resolution < PSLR_MAX_RESOLUTIONS) + gp_widget_set_value (t, available_resolutions[status.jpeg_resolution]); + else + gp_widget_set_value (t, _("Unknown")); - gp_widget_new (GP_WIDGET_RADIO, _("Image Quality"), &t); - gp_widget_set_name (t, "imgquality"); - gp_widget_add_choice (t, "4"); - gp_widget_add_choice (t, "3"); - gp_widget_add_choice (t, "2"); - gp_widget_add_choice (t, "1"); - sprintf (buf,"%d",status.jpeg_quality); - gp_widget_set_value (t, buf); - gp_widget_append (section, t); + gp_widget_append (section, t); + + gp_widget_new (GP_WIDGET_RADIO, _("Image Quality"), &t); + gp_widget_set_name (t, "imgquality"); + gp_widget_add_choice (t, "4"); + gp_widget_add_choice (t, "3"); + gp_widget_add_choice (t, "2"); + gp_widget_add_choice (t, "1"); + sprintf (buf,"%d",status.jpeg_quality); + gp_widget_set_value (t, buf); + gp_widget_append (section, t); + } gp_widget_new (GP_WIDGET_RADIO, _("ISO"), &t); gp_widget_set_name (t, "iso"); diff --git a/camlibs/pentax/pslr.c b/camlibs/pentax/pslr.c index 912abb48c..744acd479 100644 --- a/camlibs/pentax/pslr.c +++ b/camlibs/pentax/pslr.c @@ -80,6 +80,10 @@ } \ } while (0) +#define PSLR_SUPPORTED_IMAGE_FORMAT_JPEG (1 << PSLR_IMAGE_FORMAT_JPEG) +#define PSLR_SUPPORTED_IMAGE_FORMAT_RAW (1 << PSLR_IMAGE_FORMAT_RAW) +#define PSLR_SUPPORTED_IMAGE_FORMAT_RAW_PLUS (1 << PSLR_IMAGE_FORMAT_RAW_PLUS) + typedef enum { PSLR_BUFFER_SEGMENT_LAST = 2, PSLR_BUFFER_SEGMENT_INNER = 3, @@ -104,6 +108,7 @@ typedef struct { uint32_t id2; const char *name; const char *resolution_steps[MAX_RESOLUTIONS]; + int supported_formats; } ipslr_model_info_t; typedef struct { @@ -165,18 +170,18 @@ static bool is_istds(ipslr_handle_t *p); static pslr_progress_callback_t progress_callback = NULL; static ipslr_model_info_t camera_models[] = { - { PSLR_ID1_K30, PSLR_ID2_K30, "K30", { "16", "12", "8", "5" } }, - { PSLR_ID1_K20D, PSLR_ID2_K20D, "K20D", { "14", "10", "6", "2" } }, - { PSLR_ID1_K10D, PSLR_ID2_K10D, "K10D", { "10", "6", "2" } }, - { PSLR_ID1_K110D, PSLR_ID2_K110D, "K110D", { "6", "4", "2" } }, - { PSLR_ID1_K100D, PSLR_ID2_K100D, "K100D", { "6", "4", "2" } }, - { PSLR_ID1_K100DS, PSLR_ID2_K100DS, "K100DS", {} }, - { PSLR_ID1_IST_DS2, PSLR_ID2_IST_DS2, "*ist DS2", { "6", "4", "2" } }, - { PSLR_ID1_IST_DL, PSLR_ID2_IST_DL, "*ist DL", { "6", "4", "2" } }, - { PSLR_ID1_IST_DS, PSLR_ID2_IST_DS, "*ist DS", { "6", "4", "2" } }, - { PSLR_ID1_IST_D, PSLR_ID2_IST_D, "*ist D", { "6", "4", "2" } }, - { PSLR_ID1_GX10, PSLR_ID2_GX10, "GX10", { "10", "6", "2" } }, - { PSLR_ID1_GX20, PSLR_ID2_GX20, "GX20", { "14", "10", "6", "2" } }, + { PSLR_ID1_K30, PSLR_ID2_K30, "K30", { "16", "12", "8", "5" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_K20D, PSLR_ID2_K20D, "K20D", { "14", "10", "6", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_K10D, PSLR_ID2_K10D, "K10D", { "10", "6", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_K110D, PSLR_ID2_K110D, "K110D", { "6", "4", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_K100D, PSLR_ID2_K100D, "K100D", { "6", "4", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_K100DS, PSLR_ID2_K100DS, "K100DS", {}, PSLR_SUPPORTED_IMAGE_FORMAT_RAW }, + { PSLR_ID1_IST_DS2, PSLR_ID2_IST_DS2, "*ist DS2", { "6", "4", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_IST_DL, PSLR_ID2_IST_DL, "*ist DL", { "6", "4", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_IST_DS, PSLR_ID2_IST_DS, "*ist DS", { "6", "4", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_IST_D, PSLR_ID2_IST_D, "*ist D", { "6", "4", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_GX10, PSLR_ID2_GX10, "GX10", { "10", "6", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, + { PSLR_ID1_GX20, PSLR_ID2_GX20, "GX20", { "14", "10", "6", "2" }, PSLR_SUPPORTED_IMAGE_FORMAT_JPEG }, }; #ifndef LIBGPHOTO2 @@ -484,6 +489,13 @@ int pslr_set_image_format(pslr_handle_t h, pslr_image_format_t format) return PSLR_OK; } +int pslr_is_image_format_supported(pslr_handle_t h, pslr_image_format_t format) +{ + ipslr_handle_t *p = (ipslr_handle_t *) h; + if (format < 0 || format >= PSLR_IMAGE_FORMAT_MAX || !p->model) + return false; + return (1 << format) & p->model->supported_formats; +} int pslr_set_raw_format(pslr_handle_t h, pslr_raw_format_t format) { diff --git a/camlibs/pentax/pslr.h b/camlibs/pentax/pslr.h index 23dbfffa5..02e0f444b 100644 --- a/camlibs/pentax/pslr.h +++ b/camlibs/pentax/pslr.h @@ -222,6 +222,7 @@ int pslr_set_jpeg_contrast(pslr_handle_t h, int32_t contrast); int pslr_set_jpeg_saturation(pslr_handle_t h, int32_t saturation); int pslr_set_image_format(pslr_handle_t h, pslr_image_format_t format); +int pslr_is_image_format_supported(pslr_handle_t h, pslr_image_format_t format); int pslr_set_raw_format(pslr_handle_t h, pslr_raw_format_t format); int pslr_delete_buffer(pslr_handle_t h, int bufno); |