-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontrol_functions.h
58 lines (48 loc) · 1.83 KB
/
control_functions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <math.h>
#include <gtk/gtk.h>
#define ARGUMENTS 5
int brightness = 50; //default manual brightness
int sharpness;
int contrast;
int saturation = 0;
char ss_label[20] = "0.020000 s"; //starting label for ss
long int shutter_speed = 20000; //default manual ss (microseconds)
int iso = 450; //default manual ISO
char resolution[2][5] = {"1920", "1080"}; //default resolution
char command_arguments[ARGUMENTS + 1][10];
char auto_settings = 0x00; //each bit corresponds to a single control. 1 = Automatic, 0 = manual
static void brightness_control(GtkAdjustment *adj){
brightness = (int)adj->value;
sprintf(command_arguments[0], "-br %d ", brightness);
}
static void sharpness_control(GtkAdjustment *adj){
sharpness = (int)adj->value;
sprintf(command_arguments[1], "-sh %d ", sharpness);
}
static void contrast_control(GtkAdjustment *adj){
contrast = (int)adj->value;
sprintf(command_arguments[2], "-co %d ", contrast);
}
static void saturation_control(GtkAdjustment *adj){
saturation = (int)adj->value;
sprintf(command_arguments[3], "-sa %d ", saturation);
}
static void iso_control(GtkAdjustment *adj){
iso = (int)adj->value;
sprintf(command_arguments[4], "-ISO %d ", iso);
}
static void shutter_speed_control(GtkAdjustment *adj, GtkLabel *label){
shutter_speed = 0.00000002 * pow(10, (double)adj->value * 8); //function to better set shutter speed
if(label){
sprintf(ss_label, "%f s", (double)shutter_speed/1000000);
gtk_label_set_text(label, ss_label);
}
}
static void resolution_control(GtkWidget *item, char* res){
for(int i = 0; i < 5; i++){
resolution[0][i] = '\0';
resolution[1][i] = '\0';
}
strncpy(resolution[0], res, 4);
strncpy(resolution[1], res+4, 4);
}