|
|
|
@ -35,6 +35,10 @@ extern detect_movement detectedpos_data;
|
|
|
|
|
extern Configuration config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void videoctrl_grid_delete ();
|
|
|
|
|
void videoctrl_grid_build ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* stop video recording
|
|
|
|
|
*/
|
|
|
|
@ -52,6 +56,9 @@ void video_stoprecord() {
|
|
|
|
|
videodev_thread = NULL;
|
|
|
|
|
|
|
|
|
|
delete videodev;
|
|
|
|
|
|
|
|
|
|
videoctrl_grid_delete();
|
|
|
|
|
|
|
|
|
|
videodev = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -92,14 +99,16 @@ gboolean videoctrl_update(gpointer data) {
|
|
|
|
|
|
|
|
|
|
for (i = 0; (label = gtk_grid_get_child_at(GTK_GRID(grid), 0, i)) != NULL; i++) {
|
|
|
|
|
if (videodev->GetCtrlMinMaxValue(gtk_label_get_text(GTK_LABEL(label)), &min, &max, &value) == VDEV_STATUS_OK) {
|
|
|
|
|
scale = gtk_grid_get_child_at(GTK_GRID(grid), 1, i);
|
|
|
|
|
if ((scale = gtk_grid_get_child_at(GTK_GRID(grid), 1, i)) != NULL) {
|
|
|
|
|
if (!gtk_widget_has_focus(scale))
|
|
|
|
|
gtk_range_set_value(GTK_RANGE(scale), value);
|
|
|
|
|
entry = gtk_grid_get_child_at(GTK_GRID(grid), 2, i);
|
|
|
|
|
}
|
|
|
|
|
if ((entry = gtk_grid_get_child_at(GTK_GRID(grid), 2, i)) != NULL) {
|
|
|
|
|
if (!gtk_widget_has_focus(entry))
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(entry), std::to_string(value).c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
@ -375,12 +384,28 @@ void cb_video_btnrec (GtkWidget *widget, gpointer data) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* clear all elements in the controls grid
|
|
|
|
|
*/
|
|
|
|
|
void videoctrl_grid_delete () {
|
|
|
|
|
GtkWidget *grid = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "vidctrl-grid"));
|
|
|
|
|
GtkWidget *gridchild = NULL;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// clear grid
|
|
|
|
|
while ((gridchild = gtk_grid_get_child_at(GTK_GRID(grid), 0, 0)) != NULL) {
|
|
|
|
|
gtk_grid_remove_row (GTK_GRID(grid), 0);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* after the video is started and we get the first callback from the VideoDev thread
|
|
|
|
|
* we will call this function to read all ctrls and creade the grid table.
|
|
|
|
|
* function gezts called if: threaddata.runnin == 1
|
|
|
|
|
* function gets called if: threaddata.runnin == 1
|
|
|
|
|
*/
|
|
|
|
|
void video_refreshctrls () {
|
|
|
|
|
void videoctrl_grid_build () {
|
|
|
|
|
std::list<std::string> list;
|
|
|
|
|
std::list<std::string>::iterator iter;
|
|
|
|
|
GtkWidget *cbres = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "cb-videores"));
|
|
|
|
@ -388,7 +413,6 @@ void video_refreshctrls () {
|
|
|
|
|
GtkWidget *cbfmt = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "cb-videofmt"));
|
|
|
|
|
GtkWidget *cbfmtentry = gtk_bin_get_child(GTK_BIN(cbfmt));
|
|
|
|
|
GtkWidget *grid = GTK_WIDGET(gtk_builder_get_object (GTK_BUILDER(_builder_), "vidctrl-grid"));
|
|
|
|
|
GtkWidget *gridchild = NULL;
|
|
|
|
|
int i, w, h;
|
|
|
|
|
std::string format;
|
|
|
|
|
std::string resolution;
|
|
|
|
@ -396,12 +420,7 @@ void video_refreshctrls () {
|
|
|
|
|
if (videodev == NULL) return;
|
|
|
|
|
|
|
|
|
|
videodev->GetCtrlList(&list);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// clear grid
|
|
|
|
|
while ((gridchild = gtk_grid_get_child_at(GTK_GRID(grid), 0, 0)) != NULL) {
|
|
|
|
|
gtk_grid_remove_row (GTK_GRID(grid), 0);
|
|
|
|
|
}
|
|
|
|
|
videoctrl_grid_delete();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// add elements
|
|
|
|
@ -415,14 +434,20 @@ void video_refreshctrls () {
|
|
|
|
|
//
|
|
|
|
|
// label
|
|
|
|
|
GtkWidget *label = gtk_label_new(iter->c_str());
|
|
|
|
|
GtkWidget *scale = NULL;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// scale/range
|
|
|
|
|
GtkWidget *scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, min, max, 1);
|
|
|
|
|
if (min < max) {
|
|
|
|
|
scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, min, max, 1);
|
|
|
|
|
gtk_range_set_value(GTK_RANGE(scale),value);
|
|
|
|
|
gtk_widget_set_hexpand (scale,true);
|
|
|
|
|
gtk_scale_set_draw_value(GTK_SCALE(scale), false);
|
|
|
|
|
g_signal_connect (GTK_RANGE(scale), "value-changed", G_CALLBACK(cb_vidctrl_scale_change), (void*)(long int)i);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf ("%s:%d control %s check not valid min[%d] < max[%d]\n", __FILE__, __LINE__, iter->c_str(), min, max);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// entry field
|
|
|
|
@ -437,10 +462,11 @@ void video_refreshctrls () {
|
|
|
|
|
gtk_grid_insert_column(GTK_GRID(grid), 0);
|
|
|
|
|
}
|
|
|
|
|
gtk_grid_attach(GTK_GRID(grid), label, 0, i, 1, 1);
|
|
|
|
|
gtk_grid_attach(GTK_GRID(grid), scale, 1, i, 1, 1);
|
|
|
|
|
|
|
|
|
|
if (scale) gtk_grid_attach(GTK_GRID(grid), scale, 1, i, 1, 1);
|
|
|
|
|
gtk_grid_attach(GTK_GRID(grid), entry, 2, i, 1, 1);
|
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
gtk_widget_show (scale);
|
|
|
|
|
if (scale) gtk_widget_show (scale);
|
|
|
|
|
gtk_widget_show (entry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -477,7 +503,7 @@ gboolean cb_thread_video (gpointer data) {
|
|
|
|
|
if (cbdata != NULL) {
|
|
|
|
|
vf = &cbdata->vf;
|
|
|
|
|
if (cbdata->running == 1) {
|
|
|
|
|
video_refreshctrls();
|
|
|
|
|
videoctrl_grid_build();
|
|
|
|
|
cbdata->running = 2;
|
|
|
|
|
}
|
|
|
|
|
if (vf->w <= 0 || vf->h <= 0 || vf->data == NULL) vf = NULL;
|
|
|
|
@ -647,7 +673,7 @@ void cb_video_pre_click (GtkWidget *widget, gpointer data) {
|
|
|
|
|
//
|
|
|
|
|
// save the settings
|
|
|
|
|
//
|
|
|
|
|
list<VideoDevCtrl> ctrls = videodev->GetCtrlsMinMaxValue();
|
|
|
|
|
std::list<VideoDevCtrl> ctrls = videodev->GetCtrlsMinMaxValue();
|
|
|
|
|
config.SetPresetButton(presetbtn.idx, &ctrls);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
@ -665,8 +691,8 @@ void cb_video_pre_click (GtkWidget *widget, gpointer data) {
|
|
|
|
|
// callup settings
|
|
|
|
|
//
|
|
|
|
|
int i, retry = 5, again = 1;
|
|
|
|
|
list<VideoDevCtrl> ctrls = config.GetPresetButton(presetbtn.idx);
|
|
|
|
|
list<VideoDevCtrl>::iterator iter;
|
|
|
|
|
std::list<VideoDevCtrl> ctrls = config.GetPresetButton(presetbtn.idx);
|
|
|
|
|
std::list<VideoDevCtrl>::iterator iter;
|
|
|
|
|
presetbtn.idx = -1;
|
|
|
|
|
|
|
|
|
|
for (retry = 5; retry > 0 && again; retry--) {
|
|
|
|
|