aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/camorama-window.c80
-rw-r--r--src/v4l.c10
-rw-r--r--src/v4l.h2
3 files changed, 66 insertions, 26 deletions
diff --git a/src/camorama-window.c b/src/camorama-window.c
index bff1412..54fa881 100644
--- a/src/camorama-window.c
+++ b/src/camorama-window.c
@@ -283,31 +283,61 @@ load_interface(cam* cam) {
G_CALLBACK (delete_event), NULL);
/* sliders */
- glade_xml_signal_connect_data (cam->xml, "contrast_change",
- G_CALLBACK (contrast_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider2"),
- (int) (cam->contrast / 256));
- glade_xml_signal_connect_data (cam->xml, "brightness_change",
- G_CALLBACK (brightness_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider3"),
- (int) (cam->brightness / 256));
- glade_xml_signal_connect_data (cam->xml, "colour_change",
- G_CALLBACK (colour_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider4"),
- (int) (cam->colour / 256));
- glade_xml_signal_connect_data (cam->xml, "hue_change",
- G_CALLBACK (hue_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider5"),
- (int) (cam->hue / 256));
- glade_xml_signal_connect_data (cam->xml, "wb_change",
- G_CALLBACK (wb_change), cam);
- gtk_range_set_value ((GtkRange *)
- glade_xml_get_widget (cam->xml, "slider6"),
- (int) (cam->wb / 256));
+ if (cam->contrast < 0) {
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "contrast_icon"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "label64"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "slider2"));
+ } else {
+ glade_xml_signal_connect_data (cam->xml, "contrast_change",
+ G_CALLBACK (contrast_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider2"),
+ (int) (cam->contrast / 256));
+ }
+ if (cam->brightness < 0) {
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "brightness_icon"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "label65"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "slider3"));
+ } else {
+ glade_xml_signal_connect_data (cam->xml, "brightness_change",
+ G_CALLBACK (brightness_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider3"),
+ (int) (cam->brightness / 256));
+ }
+ if (cam->colour < 1) {
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "color_icon"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "label66"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "slider4"));
+ } else {
+ glade_xml_signal_connect_data (cam->xml, "colour_change",
+ G_CALLBACK (colour_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider4"),
+ (int) (cam->colour / 256));
+ }
+ if (cam->hue < 0) {
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "hue_icon"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "label67"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "slider5"));
+ } else {
+ glade_xml_signal_connect_data (cam->xml, "hue_change",
+ G_CALLBACK (hue_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider5"),
+ (int) (cam->hue / 256));
+ }
+ if (cam->whiteness < 0) {
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "balance_icon"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "label68"));
+ gtk_widget_hide(glade_xml_get_widget (cam->xml, "slider6"));
+ } else {
+ glade_xml_signal_connect_data (cam->xml, "wb_change",
+ G_CALLBACK (wb_change), cam);
+ gtk_range_set_value ((GtkRange *)
+ glade_xml_get_widget (cam->xml, "slider6"),
+ (int) (cam->whiteness / 256));
+ }
/* buttons */
glade_xml_signal_connect_data (cam->xml, "on_status_show",
diff --git a/src/v4l.c b/src/v4l.c
index f265512..47c0fe6 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -173,30 +173,40 @@ void get_pic_info(cam * cam){
cam->hue = i;
if(cam->debug == TRUE)
printf("hue = %d\n", cam->hue);
+ } else {
+ cam->hue = -1;
}
i = v4l2_get_control(cam->dev, V4L2_CID_SATURATION);
if (i >= 0) {
cam->colour = i;
if(cam->debug == TRUE)
printf("colour = %d\n", cam->colour);
+ } else {
+ cam->colour = -1;
}
i = v4l2_get_control(cam->dev, V4L2_CID_CONTRAST);
if (i >= 0) {
cam->contrast = i;
if(cam->debug == TRUE)
printf("contrast = %d\n", cam->contrast);
+ } else {
+ cam->contrast = -1;
}
i = v4l2_get_control(cam->dev, V4L2_CID_WHITENESS);
if (i >= 0) {
cam->whiteness = i;
if(cam->debug == TRUE)
printf("whiteness = %d\n", cam->whiteness);
+ } else {
+ cam->whiteness = -1;
}
i = v4l2_get_control(cam->dev, V4L2_CID_BRIGHTNESS);
if (i >= 0) {
cam->brightness = i;
if(cam->debug == TRUE)
printf("brightness = %d\n", cam->brightness);
+ } else {
+ cam->brightness = -1;
}
}
diff --git a/src/v4l.h b/src/v4l.h
index ca2739c..1c07641 100644
--- a/src/v4l.h
+++ b/src/v4l.h
@@ -47,7 +47,7 @@ typedef struct camera {
int desk_depth;
CamoImageSize size;
char name[32];
- int contrast, brightness, whiteness, colour, hue, wb, bytesperline;
+ int contrast, brightness, whiteness, colour, hue, bytesperline;
unsigned int pixformat;
int frame_number;

Privacy Policy