aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-17 12:56:36 (GMT)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-17 12:56:36 (GMT)
commit003564d7109424c3d2a788dd14b12b0cecfcb15e (patch)
treec4b210df8e703d0bbfd5dd399a05bee8ff33f5ab
parent6d5d0633b62329ffa1e2daaf5ab6691c470b91e7 (diff)
v4l: make print_cam() useful
There is a debug logic at v4l.c that is not used anywhere. Also, its output is noisy, as it displays some things that shouldn't work if not explicitly set. Print data from it when -D is used, on a useful way, e. g. by default it will print something like: Camera Info ----------- device = /dev/video0, x = 960, y = 720 bits per pixel = 24, desk_depth = 24 capture directory = /home/user/Webcam_Pictures, capture file = Webcam Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--src/main.c4
-rw-r--r--src/v4l.c28
-rw-r--r--src/v4l.h1
3 files changed, 27 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index ecd5c4a..41b52ab 100644
--- a/src/main.c
+++ b/src/main.c
@@ -274,6 +274,10 @@ main(int argc, char *argv[]) {
cam->idle_id = gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam);
gtk_timeout_add (2000, (GSourceFunc) fps, cam->status);
+
+ if (cam->debug == TRUE)
+ print_cam(cam);
+
gtk_main ();
if (cam->read == FALSE) {
stop_streaming(cam);
diff --git a/src/v4l.c b/src/v4l.c
index aeaa9e9..68d882e 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -11,14 +11,30 @@ extern int errno;
void print_cam(cam *cam){
printf("\nCamera Info\n");
- printf("-------------\n");
+ printf("-----------\n");
printf("device = %s, x = %d, y = %d\n",cam->video_dev, cam->width,cam->height);
- printf("bits per pixel = %d, desk_depth = %d, size = %d\n", cam->bpp, cam->desk_depth, cam->size);
+ printf("bits per pixel = %d, desk_depth = %d\n", cam->bpp, cam->desk_depth);
+ if(cam->width <= 0 || cam->height <= 0) {
+ switch (cam->size) {
+ case PICMAX:
+ printf("size = PICMAX\n");
+ break;
+ case PICMIN:
+ printf("size = PICMIN\n");
+ break;
+ case PICHALF:
+ default:
+ printf("size = PICHALF\n");
+ break;
+ }
+ }
printf("capture directory = %s, capture file = %s\n",cam->pixdir, cam->capturefile);
- printf("remote capture directory = %s, remote capture file = %s\n",cam->rpixdir, cam->rcapturefile);
- printf("remote host = %s, remote login = %s\n",cam->rhost,cam->rlogin);
- printf("timestamp = %s\n\n",cam->ts_string);
-
+ if (strcmp(cam->rhost, "yourdomain.org")) {
+ printf("remote host = %s, remote login = %s\n",cam->rhost,cam->rlogin);
+ printf("remote capture directory = %s, remote capture file = %s\n",cam->rpixdir, cam->rcapturefile);
+ }
+ if (strcmp(cam->ts_string, "Camorama!"))
+ printf("timestamp = %s\n\n",cam->ts_string);
}
void insert_resolution(cam * cam, int x, int y)
diff --git a/src/v4l.h b/src/v4l.h
index 27c737e..65ed5c8 100644
--- a/src/v4l.h
+++ b/src/v4l.h
@@ -93,6 +93,7 @@ typedef struct camera {
} cam;
void camera_cap (cam *);
+void print_cam (cam *);
void try_set_win_info(cam * cam, int *x, int *y);
void set_win_info (cam * cam);
void get_pic_info (cam *);

Privacy Policy