[media] DocBook media: fix coding style in the control example code
Use the proper kernel coding style in these examples. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
a4c8c262f8
commit
10fa813de3
|
@ -441,61 +441,60 @@ more menu type controls.</para>
|
||||||
&v4l2-queryctrl; queryctrl;
|
&v4l2-queryctrl; queryctrl;
|
||||||
&v4l2-querymenu; querymenu;
|
&v4l2-querymenu; querymenu;
|
||||||
|
|
||||||
static void
|
static void enumerate_menu(void)
|
||||||
enumerate_menu (void)
|
|
||||||
{
|
{
|
||||||
printf (" Menu items:\n");
|
printf(" Menu items:\n");
|
||||||
|
|
||||||
memset (&querymenu, 0, sizeof (querymenu));
|
memset(&querymenu, 0, sizeof(querymenu));
|
||||||
querymenu.id = queryctrl.id;
|
querymenu.id = queryctrl.id;
|
||||||
|
|
||||||
for (querymenu.index = queryctrl.minimum;
|
for (querymenu.index = queryctrl.minimum;
|
||||||
querymenu.index <= queryctrl.maximum;
|
querymenu.index <= queryctrl.maximum;
|
||||||
querymenu.index++) {
|
querymenu.index++) {
|
||||||
if (0 == ioctl (fd, &VIDIOC-QUERYMENU;, &querymenu)) {
|
if (0 == ioctl(fd, &VIDIOC-QUERYMENU;, &querymenu)) {
|
||||||
printf (" %s\n", querymenu.name);
|
printf(" %s\n", querymenu.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (&queryctrl, 0, sizeof (queryctrl));
|
memset(&queryctrl, 0, sizeof(queryctrl));
|
||||||
|
|
||||||
for (queryctrl.id = V4L2_CID_BASE;
|
for (queryctrl.id = V4L2_CID_BASE;
|
||||||
queryctrl.id < V4L2_CID_LASTP1;
|
queryctrl.id < V4L2_CID_LASTP1;
|
||||||
queryctrl.id++) {
|
queryctrl.id++) {
|
||||||
if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) {
|
if (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &queryctrl)) {
|
||||||
if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
|
if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf ("Control %s\n", queryctrl.name);
|
printf("Control %s\n", queryctrl.name);
|
||||||
|
|
||||||
if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
|
if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
|
||||||
enumerate_menu ();
|
enumerate_menu();
|
||||||
} else {
|
} else {
|
||||||
if (errno == EINVAL)
|
if (errno == EINVAL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
perror ("VIDIOC_QUERYCTRL");
|
perror("VIDIOC_QUERYCTRL");
|
||||||
exit (EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;
|
for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;
|
||||||
queryctrl.id++) {
|
queryctrl.id++) {
|
||||||
if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) {
|
if (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &queryctrl)) {
|
||||||
if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
|
if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf ("Control %s\n", queryctrl.name);
|
printf("Control %s\n", queryctrl.name);
|
||||||
|
|
||||||
if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
|
if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
|
||||||
enumerate_menu ();
|
enumerate_menu();
|
||||||
} else {
|
} else {
|
||||||
if (errno == EINVAL)
|
if (errno == EINVAL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
perror ("VIDIOC_QUERYCTRL");
|
perror("VIDIOC_QUERYCTRL");
|
||||||
exit (EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@ -508,53 +507,53 @@ for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;
|
||||||
&v4l2-queryctrl; queryctrl;
|
&v4l2-queryctrl; queryctrl;
|
||||||
&v4l2-control; control;
|
&v4l2-control; control;
|
||||||
|
|
||||||
memset (&queryctrl, 0, sizeof (queryctrl));
|
memset(&queryctrl, 0, sizeof(queryctrl));
|
||||||
queryctrl.id = V4L2_CID_BRIGHTNESS;
|
queryctrl.id = V4L2_CID_BRIGHTNESS;
|
||||||
|
|
||||||
if (-1 == ioctl (fd, &VIDIOC-QUERYCTRL;, &queryctrl)) {
|
if (-1 == ioctl(fd, &VIDIOC-QUERYCTRL;, &queryctrl)) {
|
||||||
if (errno != EINVAL) {
|
if (errno != EINVAL) {
|
||||||
perror ("VIDIOC_QUERYCTRL");
|
perror("VIDIOC_QUERYCTRL");
|
||||||
exit (EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
printf ("V4L2_CID_BRIGHTNESS is not supported\n");
|
printf("V4L2_CID_BRIGHTNESS is not supported\n");
|
||||||
}
|
}
|
||||||
} else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) {
|
} else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) {
|
||||||
printf ("V4L2_CID_BRIGHTNESS is not supported\n");
|
printf("V4L2_CID_BRIGHTNESS is not supported\n");
|
||||||
} else {
|
} else {
|
||||||
memset (&control, 0, sizeof (control));
|
memset(&control, 0, sizeof (control));
|
||||||
control.id = V4L2_CID_BRIGHTNESS;
|
control.id = V4L2_CID_BRIGHTNESS;
|
||||||
control.value = queryctrl.default_value;
|
control.value = queryctrl.default_value;
|
||||||
|
|
||||||
if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &control)) {
|
if (-1 == ioctl(fd, &VIDIOC-S-CTRL;, &control)) {
|
||||||
perror ("VIDIOC_S_CTRL");
|
perror("VIDIOC_S_CTRL");
|
||||||
exit (EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (&control, 0, sizeof (control));
|
memset(&control, 0, sizeof(control));
|
||||||
control.id = V4L2_CID_CONTRAST;
|
control.id = V4L2_CID_CONTRAST;
|
||||||
|
|
||||||
if (0 == ioctl (fd, &VIDIOC-G-CTRL;, &control)) {
|
if (0 == ioctl(fd, &VIDIOC-G-CTRL;, &control)) {
|
||||||
control.value += 1;
|
control.value += 1;
|
||||||
|
|
||||||
/* The driver may clamp the value or return ERANGE, ignored here */
|
/* The driver may clamp the value or return ERANGE, ignored here */
|
||||||
|
|
||||||
if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &control)
|
if (-1 == ioctl(fd, &VIDIOC-S-CTRL;, &control)
|
||||||
&& errno != ERANGE) {
|
&& errno != ERANGE) {
|
||||||
perror ("VIDIOC_S_CTRL");
|
perror("VIDIOC_S_CTRL");
|
||||||
exit (EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
/* Ignore if V4L2_CID_CONTRAST is unsupported */
|
/* Ignore if V4L2_CID_CONTRAST is unsupported */
|
||||||
} else if (errno != EINVAL) {
|
} else if (errno != EINVAL) {
|
||||||
perror ("VIDIOC_G_CTRL");
|
perror("VIDIOC_G_CTRL");
|
||||||
exit (EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
control.id = V4L2_CID_AUDIO_MUTE;
|
control.id = V4L2_CID_AUDIO_MUTE;
|
||||||
control.value = TRUE; /* silence */
|
control.value = 1; /* silence */
|
||||||
|
|
||||||
/* Errors ignored */
|
/* Errors ignored */
|
||||||
ioctl (fd, VIDIOC_S_CTRL, &control);
|
ioctl(fd, VIDIOC_S_CTRL, &control);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</section>
|
</section>
|
||||||
|
@ -675,12 +674,12 @@ control class is found:</para>
|
||||||
<informalexample>
|
<informalexample>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
qctrl.id = V4L2_CTRL_CLASS_MPEG | V4L2_CTRL_FLAG_NEXT_CTRL;
|
qctrl.id = V4L2_CTRL_CLASS_MPEG | V4L2_CTRL_FLAG_NEXT_CTRL;
|
||||||
while (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &qctrl)) {
|
while (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &qctrl)) {
|
||||||
if (V4L2_CTRL_ID2CLASS (qctrl.id) != V4L2_CTRL_CLASS_MPEG)
|
if (V4L2_CTRL_ID2CLASS(qctrl.id) != V4L2_CTRL_CLASS_MPEG)
|
||||||
break;
|
break;
|
||||||
/* ... */
|
/* ... */
|
||||||
qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
|
qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</informalexample>
|
</informalexample>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue