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-28 11:15:20 (GMT)
commit47b3551bfefc10741aa555618f0b516585e93477 (patch)
tree8079311bd463fb7ff9934f671eda85ab8be310d6
parentab69b8f5396b4d3cbbdfe1c4c732d3132c892fe2 (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 3ab3afd..5ad0145 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 cd10733..946fa6a 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