Commit 282f02cb authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] doc-rst: Don't use captions for examples

Unfortunately, captions are new on Sphinx for c blocks: it was
added only on version 1.3. Also, it were already bad enough
not being able to auto-numerate them.

So, let's give up and use, instead, titles before the examples.
Not much is lost, and, as a side track, we don't need to
numerate them anymore.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 30339339
...@@ -48,8 +48,13 @@ symbol rate of 5.217 Mbauds, those properties should be sent to ...@@ -48,8 +48,13 @@ symbol rate of 5.217 Mbauds, those properties should be sent to
- :ref:`DTV_TUNE <DTV-TUNE>` - :ref:`DTV_TUNE <DTV-TUNE>`
The code that would do the above is: The code that would that would do the above is show in
:ref:`dtv-prop-example`.
.. _dtv-prop-example:
Example: Setting digital TV frontend properties
===============================================
.. code-block:: c .. code-block:: c
......
...@@ -17,8 +17,8 @@ updated/recommended examples. ...@@ -17,8 +17,8 @@ updated/recommended examples.
.. _tuning: .. _tuning:
Tuning Example: Tuning
====== ===============
We will start with a generic tuning subroutine that uses the frontend We will start with a generic tuning subroutine that uses the frontend
and SEC, as well as the demux devices. The example is given for QPSK and SEC, as well as the demux devices. The example is given for QPSK
...@@ -238,8 +238,8 @@ switch, and weather conditions this may be necessary. ...@@ -238,8 +238,8 @@ switch, and weather conditions this may be necessary.
.. _the_dvr_device: .. _the_dvr_device:
The DVR device Example: The DVR device
============== ========================
The following program code shows how to use the DVR device for The following program code shows how to use the DVR device for
recording. recording.
......
...@@ -54,8 +54,10 @@ in the struct :ref:`v4l2_capability <v4l2-capability>` returned by ...@@ -54,8 +54,10 @@ in the struct :ref:`v4l2_capability <v4l2-capability>` returned by
the :ref:`VIDIOC_QUERYCAP` ioctl. the :ref:`VIDIOC_QUERYCAP` ioctl.
Example: Information about the current audio input
==================================================
.. code-block:: c .. code-block:: c
:caption: Example 1.3. Information about the current audio input
struct v4l2_audio audio; struct v4l2_audio audio;
...@@ -69,8 +71,10 @@ the :ref:`VIDIOC_QUERYCAP` ioctl. ...@@ -69,8 +71,10 @@ the :ref:`VIDIOC_QUERYCAP` ioctl.
printf("Current input: %s\\n", audio.name); printf("Current input: %s\\n", audio.name);
Example: Switching to the first audio input
===========================================
.. code-block:: c .. code-block:: c
:caption: Example 1.4. Switching to the first audio input
struct v4l2_audio audio; struct v4l2_audio audio;
......
...@@ -373,8 +373,10 @@ more menu type controls. ...@@ -373,8 +373,10 @@ more menu type controls.
.. _enum_all_controls: .. _enum_all_controls:
Example: Enumerating all user controls
======================================
.. code-block:: c .. code-block:: c
:caption: Example 1.8. Enumerating all user controls
struct v4l2_queryctrl queryctrl; struct v4l2_queryctrl queryctrl;
...@@ -438,8 +440,10 @@ more menu type controls. ...@@ -438,8 +440,10 @@ more menu type controls.
} }
Example: Enumerating all user controls (alternative)
====================================================
.. code-block:: c .. code-block:: c
:caption: Example 1.9. Enumerating all user controls (alternative)
memset(&queryctrl, 0, sizeof(queryctrl)); memset(&queryctrl, 0, sizeof(queryctrl));
...@@ -462,9 +466,10 @@ more menu type controls. ...@@ -462,9 +466,10 @@ more menu type controls.
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
Example: Changing controls
==========================
.. code-block:: c .. code-block:: c
:caption: Example 1.10. Changing controls
struct v4l2_queryctrl queryctrl; struct v4l2_queryctrl queryctrl;
struct v4l2_control control; struct v4l2_control control;
......
...@@ -147,8 +147,10 @@ ensure the parameters are suitable before starting I/O. ...@@ -147,8 +147,10 @@ ensure the parameters are suitable before starting I/O.
**NOTE:** on the next two examples, a video capture device is assumed; **NOTE:** on the next two examples, a video capture device is assumed;
change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device. change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device.
Example: Resetting the cropping parameters
==========================================
.. code-block:: c .. code-block:: c
:caption: Example 1.11. Resetting the cropping parameters
struct v4l2_cropcap cropcap; struct v4l2_cropcap cropcap;
struct v4l2_crop crop; struct v4l2_crop crop;
...@@ -173,8 +175,11 @@ change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device. ...@@ -173,8 +175,11 @@ change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device.
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
Example: Simple downscaling
===========================
.. code-block:: c .. code-block:: c
:caption: Example 1.12. Simple downscaling
struct v4l2_cropcap cropcap; struct v4l2_cropcap cropcap;
struct v4l2_format format; struct v4l2_format format;
...@@ -199,10 +204,12 @@ change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device. ...@@ -199,10 +204,12 @@ change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device.
/* We could check the actual image size now, the actual scaling factor /* We could check the actual image size now, the actual scaling factor
or if the driver can scale at all. */ or if the driver can scale at all. */
Example: Selecting an output area
=================================
**NOTE:** This example assumes an output device. **NOTE:** This example assumes an output device.
.. code-block:: c .. code-block:: c
:caption: Example 1.13. Selecting an output area
struct v4l2_cropcap cropcap; struct v4l2_cropcap cropcap;
struct v4l2_crop crop; struct v4l2_crop crop;
...@@ -236,10 +243,12 @@ change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device. ...@@ -236,10 +243,12 @@ change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device.
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
Example: Current scaling factor and pixel aspect
================================================
**NOTE:** This example assumes a video capture device. **NOTE:** This example assumes a video capture device.
.. code-block:: c .. code-block:: c
:caption: Example 1.14. Current scaling factor and pixel aspect
struct v4l2_cropcap cropcap; struct v4l2_cropcap cropcap;
struct v4l2_crop crop; struct v4l2_crop crop;
......
...@@ -50,9 +50,10 @@ standard. A V4L2 driver may reject attempts to change the video standard ...@@ -50,9 +50,10 @@ standard. A V4L2 driver may reject attempts to change the video standard
(or any other ioctl which would imply a framebuffer size change) with an (or any other ioctl which would imply a framebuffer size change) with an
``EBUSY`` error code until all applications closed the framebuffer device. ``EBUSY`` error code until all applications closed the framebuffer device.
Example: Finding a framebuffer device for OSD
---------------------------------------------
.. code-block:: c .. code-block:: c
:caption: Example 4.1. Finding a framebuffer device for OSD
#include <linux/fb.h> #include <linux/fb.h>
......
...@@ -37,8 +37,10 @@ driver must be switched into DMABUF I/O mode by calling the ...@@ -37,8 +37,10 @@ driver must be switched into DMABUF I/O mode by calling the
:ref:`VIDIOC_REQBUFS <VIDIOC_REQBUFS>` with the desired buffer type. :ref:`VIDIOC_REQBUFS <VIDIOC_REQBUFS>` with the desired buffer type.
Example: Initiating streaming I/O with DMABUF file descriptors
==============================================================
.. code-block:: c .. code-block:: c
:caption: Example 3.4. Initiating streaming I/O with DMABUF file descriptors
struct v4l2_requestbuffers reqbuf; struct v4l2_requestbuffers reqbuf;
...@@ -62,9 +64,10 @@ buffers, every plane can be associated with a different DMABUF ...@@ -62,9 +64,10 @@ buffers, every plane can be associated with a different DMABUF
descriptor. Although buffers are commonly cycled, applications can pass descriptor. Although buffers are commonly cycled, applications can pass
a different DMABUF descriptor at each :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` call. a different DMABUF descriptor at each :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` call.
Example: Queueing DMABUF using single plane API
===============================================
.. code-block:: c .. code-block:: c
:caption: Example 3.5. Queueing DMABUF using single plane API
int buffer_queue(int v4lfd, int index, int dmafd) int buffer_queue(int v4lfd, int index, int dmafd)
{ {
...@@ -84,9 +87,10 @@ a different DMABUF descriptor at each :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` call. ...@@ -84,9 +87,10 @@ a different DMABUF descriptor at each :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` call.
return 0; return 0;
} }
Example 3.6. Queueing DMABUF using multi plane API
==================================================
.. code-block:: c .. code-block:: c
:caption: Example 3.6. Queueing DMABUF using multi plane API
int buffer_queue_mp(int v4lfd, int index, int dmafd[], int n_planes) int buffer_queue_mp(int v4lfd, int index, int dmafd[], int n_planes)
{ {
......
...@@ -52,9 +52,10 @@ allocated in physical memory, as opposed to virtual memory, which can be ...@@ -52,9 +52,10 @@ allocated in physical memory, as opposed to virtual memory, which can be
swapped out to disk. Applications should free the buffers as soon as swapped out to disk. Applications should free the buffers as soon as
possible with the :ref:`munmap() <func-munmap>` function. possible with the :ref:`munmap() <func-munmap>` function.
Example: Mapping buffers in the single-planar API
=================================================
.. code-block:: c .. code-block:: c
:caption: Example 3.1. Mapping buffers in the single-planar API
struct v4l2_requestbuffers reqbuf; struct v4l2_requestbuffers reqbuf;
struct { struct {
...@@ -122,8 +123,10 @@ possible with the :ref:`munmap() <func-munmap>` function. ...@@ -122,8 +123,10 @@ possible with the :ref:`munmap() <func-munmap>` function.
munmap(buffers[i].start, buffers[i].length); munmap(buffers[i].start, buffers[i].length);
Example: Mapping buffers in the multi-planar API
================================================
.. code-block:: c .. code-block:: c
:caption: Example 3.2. Mapping buffers in the multi-planar API
struct v4l2_requestbuffers reqbuf; struct v4l2_requestbuffers reqbuf;
/* Our current format uses 3 planes per buffer */ /* Our current format uses 3 planes per buffer */
......
...@@ -8,9 +8,10 @@ Examples ...@@ -8,9 +8,10 @@ Examples
``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other devices; change target to ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other devices; change target to
``V4L2_SEL_TGT_COMPOSE_*`` family to configure composing area) ``V4L2_SEL_TGT_COMPOSE_*`` family to configure composing area)
Example: Resetting the cropping parameters
==========================================
.. code-block:: c .. code-block:: c
:caption: Example 1.15. Resetting the cropping parameters
struct v4l2_selection sel = { struct v4l2_selection sel = {
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
...@@ -27,9 +28,10 @@ Examples ...@@ -27,9 +28,10 @@ Examples
Setting a composing area on output of size of *at most* half of limit Setting a composing area on output of size of *at most* half of limit
placed at a center of a display. placed at a center of a display.
Example: Simple downscaling
===========================
.. code-block:: c .. code-block:: c
:caption: Example 1.16. Simple downscaling
struct v4l2_selection sel = { struct v4l2_selection sel = {
.type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT,
...@@ -55,9 +57,10 @@ placed at a center of a display. ...@@ -55,9 +57,10 @@ placed at a center of a display.
A video output device is assumed; change ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` A video output device is assumed; change ``V4L2_BUF_TYPE_VIDEO_OUTPUT``
for other devices for other devices
Example: Querying for scaling factors
=====================================
.. code-block:: c .. code-block:: c
:caption: Example 1.17. Querying for scaling factors
struct v4l2_selection compose = { struct v4l2_selection compose = {
.type = V4L2_BUF_TYPE_VIDEO_OUTPUT, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT,
......
...@@ -64,9 +64,10 @@ Applications can make use of the :ref:`input-capabilities` and ...@@ -64,9 +64,10 @@ Applications can make use of the :ref:`input-capabilities` and
:ref:`output-capabilities` flags to determine whether the video :ref:`output-capabilities` flags to determine whether the video
standard ioctls can be used with the given input or output. standard ioctls can be used with the given input or output.
Example: Information about the current video standard
=====================================================
.. code-block:: c .. code-block:: c
:caption: Example 1.5. Information about the current video standard
v4l2_std_id std_id; v4l2_std_id std_id;
struct v4l2_standard standard; struct v4l2_standard standard;
...@@ -100,9 +101,10 @@ standard ioctls can be used with the given input or output. ...@@ -100,9 +101,10 @@ standard ioctls can be used with the given input or output.
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
Example: Listing the video standards supported by the current input
===================================================================
.. code-block:: c .. code-block:: c
:caption: Example 1.6. Listing the video standards supported by the current input
struct v4l2_input input; struct v4l2_input input;
struct v4l2_standard standard; struct v4l2_standard standard;
...@@ -139,9 +141,10 @@ standard ioctls can be used with the given input or output. ...@@ -139,9 +141,10 @@ standard ioctls can be used with the given input or output.
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
Example: Selecting a new video standard
=======================================
.. code-block:: c .. code-block:: c
:caption: Example 1.7. Selecting a new video standard
struct v4l2_input input; struct v4l2_input input;
v4l2_std_id std_id; v4l2_std_id std_id;
......
...@@ -26,9 +26,10 @@ No buffers (planes) are allocated beforehand, consequently they are not ...@@ -26,9 +26,10 @@ No buffers (planes) are allocated beforehand, consequently they are not
indexed and cannot be queried like mapped buffers with the indexed and cannot be queried like mapped buffers with the
:ref:`VIDIOC_QUERYBUF <VIDIOC_QUERYBUF>` ioctl. :ref:`VIDIOC_QUERYBUF <VIDIOC_QUERYBUF>` ioctl.
Example: Initiating streaming I/O with user pointers
====================================================
.. code-block:: c .. code-block:: c
:caption: Example 3.3. Initiating streaming I/O with user pointers
struct v4l2_requestbuffers reqbuf; struct v4l2_requestbuffers reqbuf;
......
...@@ -28,8 +28,10 @@ applications call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` and ...@@ -28,8 +28,10 @@ applications call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` and
implement all the input ioctls when the device has one or more inputs, implement all the input ioctls when the device has one or more inputs,
all the output ioctls when the device has one or more outputs. all the output ioctls when the device has one or more outputs.
Example: Information about the current video input
==================================================
.. code-block:: c .. code-block:: c
:caption: Example 1.1. Information about the current video input
struct v4l2_input input; struct v4l2_input input;
int index; int index;
...@@ -50,8 +52,10 @@ all the output ioctls when the device has one or more outputs. ...@@ -50,8 +52,10 @@ all the output ioctls when the device has one or more outputs.
printf("Current input: %s\\n", input.name); printf("Current input: %s\\n", input.name);
Example: Switching to the first video input
===========================================
.. code-block:: c .. code-block:: c
:caption: Example 1.2. Switching to the first video input
int index; int index;
......
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