aboutsummaryrefslogtreecommitdiffstats
path: root/src/callbacks.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-07-24 12:49:09 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-07-24 14:19:19 (GMT)
commitcbc8d0905488d9efe5c9ecb2e97076e27049c6b3 (patch)
tree51580318fbcd908b972f1fb74f90655afad41e81 /src/callbacks.c
parent343b5eb4ae59dbf5583de087326fa3423c923595 (diff)
Allow selecting the image resolution instead of "small/midium/large"resolution_improvement
The concept of small, midium, large is relative, as it depends on whatever the camera supports. Instead of using it, it is a way better to show a list of the supported resolutions. That works fine for most cameras, with uses a fixed set. On cameras with a scale, the Kernel actually exports the resolution range. On this case, let's present 4 resolutions between the minimum and maximum one. That should be reasonable for most usecases. Nowadays, all drivers should be reporting resolutions via VIDIOC_ENUM_FRAMESIZES. Yet, as one might run camorama with very legacy kernels, provide backward support, using small/midium/large resolutions just like before. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'src/callbacks.c')
-rw-r--r--src/callbacks.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 3db9ba5..0b7aaa1 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -364,7 +364,7 @@ void on_change_size_activate (GtkWidget * widget, cam * cam)
{
gchar const *name;
gchar *title;
- int width, height;
+ int width = 0, height = 0;
name = gtk_widget_get_name (widget);
@@ -374,9 +374,11 @@ void on_change_size_activate (GtkWidget * widget, cam * cam)
} else if (strcmp (name, "medium") == 0) {
width = cam->max_width / 2;
height = cam->max_height / 2;
- } else {
+ } else if (strcmp (name, "large") == 0) {
width = cam->max_width;
height = cam->max_height;
+ } else {
+ sscanf(name, "%dx%d", &width, &height);
}
try_set_win_info(cam, &width, &height);

Privacy Policy