46 struct v4l2_format fmt;
47 struct v4l2_fmtdesc fmtd;
49 memset(&fmt, 0,
sizeof(
struct v4l2_format));
50 fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
51 memset(&fmtd, 0,
sizeof(
struct v4l2_fmtdesc));
53 fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
59 if (-1 == ioctl(fd, VIDIOC_G_FMT, &fmt)) {
60 yCError(
USBCAMERA,
"Failed to get image format: %d, %s", errno, strerror(errno));
64 yCInfo(
USBCAMERA,
"Current bytes per line: %d", fmt.fmt.pix.bytesperline);
68 while (ioctl(fd, VIDIOC_ENUM_FMT, &fmtd) >= 0) {
69 if (fmt.fmt.pix.pixelformat == fmtd.pixelformat) {
82 struct v4l2_input vin;
83 struct v4l2_tuner tun;
84 struct v4l2_frequency freq;
86 memset(&vin, 0,
sizeof(
struct v4l2_input));
93 while (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
97 if (vin.type & V4L2_INPUT_TYPE_TUNER) {
100 memset(&tun, 0,
sizeof(
struct v4l2_tuner));
101 tun.index = vin.tuner;
102 if (ioctl(fd, VIDIOC_G_TUNER, &tun) == 0) {
104 if (tun.type == V4L2_TUNER_RADIO) {
107 if (tun.type == V4L2_TUNER_ANALOG_TV) {
110 if (tun.capability & V4L2_TUNER_CAP_LOW) {
116 if (tun.capability & V4L2_TUNER_CAP_NORM) {
119 if (tun.capability & V4L2_TUNER_CAP_STEREO) {
124 "lowest tunable frequency: %.2f %s",
126 (tun.capability & V4L2_TUNER_CAP_LOW) ?
"Hz" :
"kHz");
128 "highest tunable frequency: %.2f %s",
129 tun.rangehigh * 62.5,
130 (tun.capability & V4L2_TUNER_CAP_LOW) ?
"Hz" :
"kHz");
131 memset(&freq, 0,
sizeof(
struct v4l2_frequency));
132 freq.tuner = vin.tuner;
133 if (ioctl(fd, VIDIOC_G_FREQUENCY, &freq) == 0) {
135 "Current frequency: %.2f %s",
136 freq.frequency * 62.5,
137 (tun.capability & V4L2_TUNER_CAP_LOW) ?
"Hz" :
"kHz");
141 if (vin.type & V4L2_INPUT_TYPE_CAMERA) {
145 if (vin.std & V4L2_STD_PAL) {
148 if (vin.std & V4L2_STD_NTSC) {
151 if (vin.std & V4L2_STD_SECAM) {
161 struct v4l2_frmsizeenum frms;
162 struct v4l2_fmtdesc fmtd;
164 memset(&frms, 0,
sizeof(
struct v4l2_frmsizeenum));
165 memset(&fmtd, 0,
sizeof(
struct v4l2_fmtdesc));
166 fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
174 while (ioctl(fd, VIDIOC_ENUM_FMT, &fmtd) >= 0) {
177 frms.pixel_format = fmtd.pixelformat;
178 while (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frms) >= 0) {
179 if (frms.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
181 "index %2d: Width: %4d - Height: %d",
184 frms.discrete.height);
188 "index %2d\tMin, max & step height: %d - %d - %d Min, max & step width: %d - %d - %d",
190 frms.stepwise.min_height,
191 frms.stepwise.max_height,
192 frms.stepwise.step_height,
193 frms.stepwise.min_width,
194 frms.stepwise.max_width,
195 frms.stepwise.step_width);
206 "Control: id: 0x%x - name: %s - min: %d -max: %d - step: %d - type: %d(%s) - flags: %d (%s%s%s%s%s%s)",
213 (qc->type == V4L2_CTRL_TYPE_INTEGER ?
"Integer" :
214 qc->type == V4L2_CTRL_TYPE_BOOLEAN ?
"Boolean" :
215 qc->type == V4L2_CTRL_TYPE_MENU ?
"Menu" :
216 qc->type == V4L2_CTRL_TYPE_BUTTON ?
"Button" :
217 qc->type == V4L2_CTRL_TYPE_INTEGER64 ?
"Integer64" :
218 qc->type == V4L2_CTRL_TYPE_CTRL_CLASS ?
"Class" :
221 qc->flags & V4L2_CTRL_FLAG_DISABLED ?
"Disabled " :
"",
222 qc->flags & V4L2_CTRL_FLAG_GRABBED ?
"Grabbed " :
"",
223 qc->flags & V4L2_CTRL_FLAG_READ_ONLY ?
"ReadOnly " :
"",
224 qc->flags & V4L2_CTRL_FLAG_UPDATE ?
"Update " :
"",
225 qc->flags & V4L2_CTRL_FLAG_INACTIVE ?
"Inactive " :
"",
226 qc->flags & V4L2_CTRL_FLAG_SLIDER ?
"slider " :
"");
280 struct v4l2_capability cap;
286 if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0) {
295 (cap.version >> 16) & 0xFF,
296 (cap.version >> 8) & 0xFF,
299 yCInfo(
USBCAMERA,
"%s capture capability", (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) ?
"Has" :
"Does NOT have");
300 yCInfo(
USBCAMERA,
"%s output capability", (cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) ?
"Has" :
"Does NOT have");
301 yCInfo(
USBCAMERA,
"%s overlay capability", (cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) ?
"Has" :
"Does NOT have");
302 yCInfo(
USBCAMERA,
"%s VBI capture capability", (cap.capabilities & V4L2_CAP_VBI_CAPTURE) ?
"Has" :
"Does NOT have");
303 yCInfo(
USBCAMERA,
"%s VBI output capability", (cap.capabilities & V4L2_CAP_VBI_OUTPUT) ?
"Has" :
"Does NOT have");
304 yCInfo(
USBCAMERA,
"%s SLICED VBI capture capability", (cap.capabilities & V4L2_CAP_SLICED_VBI_CAPTURE) ?
"Has" :
"Does NOT have");
305 yCInfo(
USBCAMERA,
"%s SLICED VBI output capability", (cap.capabilities & V4L2_CAP_SLICED_VBI_OUTPUT) ?
"Has" :
"Does NOT have");
306 yCInfo(
USBCAMERA,
"%s RDS capability", (cap.capabilities & V4L2_CAP_RDS_CAPTURE) ?
"Has" :
"Does NOT have");
307 yCInfo(
USBCAMERA,
"%s tuner capability", (cap.capabilities & V4L2_CAP_TUNER) ?
"Has" :
"Does NOT have");
308 yCInfo(
USBCAMERA,
"%s audio capability", (cap.capabilities & V4L2_CAP_AUDIO) ?
"Has" :
"Does NOT have");
309 yCInfo(
USBCAMERA,
"%s radio capability", (cap.capabilities & V4L2_CAP_RADIO) ?
"Has" :
"Does NOT have");
310 yCInfo(
USBCAMERA,
"%s read/write capability", (cap.capabilities & V4L2_CAP_READWRITE) ?
"Has" :
"Does NOT have");
311 yCInfo(
USBCAMERA,
"%s async IO capability", (cap.capabilities & V4L2_CAP_ASYNCIO) ?
"Has" :
"Does NOT have");
312 yCInfo(
USBCAMERA,
"%s streaming capability", (cap.capabilities & V4L2_CAP_STREAMING) ?
"Has" :
"Does NOT have");
315 if (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) {