~ubuntu-branches/ubuntu/utopic/lebiniou/utopic

« back to all changes in this revision

Viewing changes to src/webcam_controls.c

  • Committer: Package Import Robot
  • Author(s): Logan Rosen
  • Date: 2013-11-13 21:19:20 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20131113211920-af65h37psw9fz6oy
Tags: 3.19.1-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - debian/patches/fix_ftbfs_with_binutils_gold: Add -lz to fix FTBFS with
    binutils-gold.
* debian/patches/fix_ftbfs_with_binutils_gold: Remove -lavutil, as it is
  already linked.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright 1994-2012 Olivier Girondel
 
2
 *  Copyright 1994-2013 Olivier Girondel
3
3
 *
4
4
 *  This file is part of lebiniou.
5
5
 *
32
32
  for (querymenu.index = queryctrl.minimum;
33
33
       querymenu.index <= (unsigned)queryctrl.maximum;
34
34
       querymenu.index++)
35
 
    if (0 == ioctl(cam->fd, VIDIOC_QUERYMENU, &querymenu))
36
 
      printf ("[i]   - %s\n", querymenu.name);
37
 
    else
 
35
    if (0 == ioctl(cam->fd, VIDIOC_QUERYMENU, &querymenu)) {
 
36
      VERBOSE(printf ("[i]   - %s\n", querymenu.name));
 
37
    } else
38
38
      xperror("VIDIOC_QUERYMENU");
39
39
}
40
40
 
51
51
      if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
52
52
        continue;
53
53
      
54
 
      printf("[i] * %s\n", queryctrl.name);
 
54
      VERBOSE(printf("[i] * %s\n", queryctrl.name));
55
55
      
56
56
      if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
57
57
        enumerate_menu(cam);
77
77
      if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
78
78
        continue;
79
79
      
80
 
      printf ("[i] * %s\n", queryctrl.name);
 
80
      VERBOSE(printf ("[i] * %s\n", queryctrl.name));
81
81
      
82
82
      if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
83
83
        enumerate_menu(cam);
94
94
void
95
95
enumerate_cids(webcam_t *cam)
96
96
{
97
 
  printf("[i] Webcam %d: base controls\n", cam->cam_no);
 
97
  VERBOSE(printf("[i] Webcam %d: base controls\n", cam->cam_no));
98
98
  enumerate_base_cids(cam);
99
 
  printf("[i] Webcam %d: private controls\n", cam->cam_no);
 
99
  VERBOSE(printf("[i] Webcam %d: private controls\n", cam->cam_no));
100
100
  enumerate_private_cids(cam);
101
101
}
102
102
 
114
114
    if (errno != EINVAL) {
115
115
      xerror("VIDIOC_QUERYCTRL\n");
116
116
    } else {
117
 
      printf("V4L2_CID_BRIGHTNESS is not supported\n");
 
117
      fprintf(stderr, "V4L2_CID_BRIGHTNESS is not supported\n");
118
118
    }
119
119
  } else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) {
120
 
    printf("%s is not supported\n",
121
 
           (ctrl == V4L2_CID_VFLIP) ? "V4L2_CID_VFLIP" : "V4L2_CID_HFLIP");
 
120
    fprintf(stderr, "%s is not supported\n",
 
121
            (ctrl == V4L2_CID_VFLIP) ? "V4L2_CID_VFLIP" : "V4L2_CID_HFLIP");
122
122
  } else {
123
123
    memset(&control, 0, sizeof(control));
124
124
    control.id = ctrl;
129
129
    }
130
130
  }
131
131
 
132
 
  printf("[i] %s: default= %d",
133
 
         ((ctrl == V4L2_CID_VFLIP) ? "V4L2_CID_VFLIP" : "V4L2_CID_HFLIP"),
134
 
         control.value);;
 
132
  VERBOSE(printf("[i] %s: default= %d",
 
133
                 ((ctrl == V4L2_CID_VFLIP) ? "V4L2_CID_VFLIP" : "V4L2_CID_HFLIP"),
 
134
                 control.value));
135
135
 
136
136
  memset(&control, 0, sizeof (control));
137
137
  control.id = ctrl;
143
143
        && errno != ERANGE) {
144
144
      xerror("VIDIOC_S_CTRL\n");
145
145
    } else
146
 
      printf(" set: %d\n", value);
 
146
      VERBOSE(printf(" set: %d\n", value));
147
147
    /* Ignore if V4L2_CID_CONTRAST is unsupported */
148
148
  } else if (errno != EINVAL) {
149
149
    xerror("VIDIOC_G_CTRL\n");
174
174
 
175
175
  inputs.index = 0;
176
176
  while (ioctl(fd, VIDIOC_ENUMINPUT, &inputs) == 0) {
177
 
    printf("[i] Webcam %d: input #%d\n", cam->cam_no, index);
178
 
    printf("[i] * Name: %s\n", inputs.name);
 
177
    VERBOSE(printf("[i] Webcam %d: input #%d\n", cam->cam_no, index));
 
178
    VERBOSE(printf("[i] * Name: %s\n", inputs.name));
179
179
 
180
 
    printf("[i] * Type: ");
181
 
    if (inputs.type == V4L2_INPUT_TYPE_CAMERA)
182
 
      printf("camera\n");
183
 
    else if (inputs.type == V4L2_INPUT_TYPE_TUNER)
184
 
      printf("tuner\n");
185
 
    else
 
180
    VERBOSE(printf("[i] * Type: "));
 
181
    if (inputs.type == V4L2_INPUT_TYPE_CAMERA) {
 
182
      VERBOSE(printf("camera\n"));
 
183
    } else if (inputs.type == V4L2_INPUT_TYPE_TUNER) {
 
184
      VERBOSE(printf("tuner\n"));
 
185
    } else
186
186
      assert(0);
187
187
 
188
 
    printf("[i] * Video standard: %d\n", (int)inputs.std);
 
188
    VERBOSE(printf("[i] * Video standard: %d\n", (int)inputs.std));
189
189
    index++;
190
190
    inputs.index = index;
191
191
  }