Commit 10fa813d authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] DocBook media: fix coding style in the control example code

Use the proper kernel coding style in these examples.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent a4c8c262
...@@ -441,61 +441,60 @@ more menu type controls.</para> ...@@ -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 (&amp;querymenu, 0, sizeof (querymenu)); memset(&amp;querymenu, 0, sizeof(querymenu));
querymenu.id = queryctrl.id; querymenu.id = queryctrl.id;
for (querymenu.index = queryctrl.minimum; for (querymenu.index = queryctrl.minimum;
querymenu.index &lt;= queryctrl.maximum; querymenu.index &lt;= queryctrl.maximum;
querymenu.index++) { querymenu.index++) {
if (0 == ioctl (fd, &VIDIOC-QUERYMENU;, &amp;querymenu)) { if (0 == ioctl(fd, &VIDIOC-QUERYMENU;, &amp;querymenu)) {
printf (" %s\n", querymenu.name); printf(" %s\n", querymenu.name);
} }
} }
} }
memset (&amp;queryctrl, 0, sizeof (queryctrl)); memset(&amp;queryctrl, 0, sizeof(queryctrl));
for (queryctrl.id = V4L2_CID_BASE; for (queryctrl.id = V4L2_CID_BASE;
queryctrl.id &lt; V4L2_CID_LASTP1; queryctrl.id &lt; V4L2_CID_LASTP1;
queryctrl.id++) { queryctrl.id++) {
if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) { if (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) {
if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED) if (queryctrl.flags &amp; 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;, &amp;queryctrl)) { if (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) {
if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED) if (queryctrl.flags &amp; 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;; ...@@ -508,53 +507,53 @@ for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;
&v4l2-queryctrl; queryctrl; &v4l2-queryctrl; queryctrl;
&v4l2-control; control; &v4l2-control; control;
memset (&amp;queryctrl, 0, sizeof (queryctrl)); memset(&amp;queryctrl, 0, sizeof(queryctrl));
queryctrl.id = V4L2_CID_BRIGHTNESS; queryctrl.id = V4L2_CID_BRIGHTNESS;
if (-1 == ioctl (fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) { if (-1 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;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 &amp; V4L2_CTRL_FLAG_DISABLED) { } else if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED) {
printf ("V4L2_CID_BRIGHTNESS is not supported\n"); printf("V4L2_CID_BRIGHTNESS is not supported\n");
} else { } else {
memset (&amp;control, 0, sizeof (control)); memset(&amp;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;, &amp;control)) { if (-1 == ioctl(fd, &VIDIOC-S-CTRL;, &amp;control)) {
perror ("VIDIOC_S_CTRL"); perror("VIDIOC_S_CTRL");
exit (EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
memset (&amp;control, 0, sizeof (control)); memset(&amp;control, 0, sizeof(control));
control.id = V4L2_CID_CONTRAST; control.id = V4L2_CID_CONTRAST;
if (0 == ioctl (fd, &VIDIOC-G-CTRL;, &amp;control)) { if (0 == ioctl(fd, &VIDIOC-G-CTRL;, &amp;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;, &amp;control) if (-1 == ioctl(fd, &VIDIOC-S-CTRL;, &amp;control)
&amp;&amp; errno != ERANGE) { &amp;&amp; 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, &amp;control); ioctl(fd, VIDIOC_S_CTRL, &amp;control);
</programlisting> </programlisting>
</example> </example>
</section> </section>
...@@ -675,12 +674,12 @@ control class is found:</para> ...@@ -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;, &amp;qctrl)) { while (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment