Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 583aa3a9 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] V4L2: Add per-device-node capabilities



If V4L2_CAP_DEVICE_CAPS is set, then the new device_caps field is filled with
the capabilities of the opened device node.

The capabilities field traditionally contains the capabilities of the physical
device, being a superset of all capabilities available at the several device
nodes. E.g., if you open /dev/video0, then if it contains VBI caps then that means
that there is a corresponding vbi node as well. And the capabilities field of
both the video and vbi nodes should contain identical caps.

However, it would be very useful to also have a capabilities field that contains
just the caps for the currently open device, hence the new CAP bit and field.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 93596ef7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2393,6 +2393,10 @@ details.</para>
	    to the <link linkend="control">User controls class</link>.
	  </para>
        </listitem>
        <listitem>
	  <para>Added the device_caps field to struct v4l2_capabilities and added the new
	  V4L2_CAP_DEVICE_CAPS capability.</para>
        </listitem>
      </orderedlist>
    </section>

+8 −1
Original line number Diff line number Diff line
@@ -127,6 +127,13 @@ structs, ioctls) must be noted in more detail in the history chapter
(compat.xml), along with the possible impact on existing drivers and
applications. -->

      <revision>
	<revnumber>3.3</revnumber>
	<date>2012-01-11</date>
	<authorinitials>hv</authorinitials>
	<revremark>Added device_caps field to struct v4l2_capabilities.</revremark>
      </revision>

      <revision>
	<revnumber>3.2</revnumber>
	<date>2011-08-26</date>
@@ -417,7 +424,7 @@ and discussions on the V4L mailing list.</revremark>
</partinfo>

<title>Video for Linux Two API Specification</title>
 <subtitle>Revision 3.2</subtitle>
 <subtitle>Revision 3.3</subtitle>

  <chapter id="common">
    &sub-common;
+33 −3
Original line number Diff line number Diff line
@@ -124,12 +124,35 @@ printf ("Version: %u.%u.%u\n",
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>capabilities</structfield></entry>
	    <entry>Device capabilities, see <xref
		linkend="device-capabilities" />.</entry>
	    <entry>Available capabilities of the physical device as a whole, see <xref
		linkend="device-capabilities" />. The same physical device can export
		multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and /dev/radioZ).
		The <structfield>capabilities</structfield> field should contain a union
		of all capabilities available around the several V4L2 devices exported
		to userspace.
		For all those devices the <structfield>capabilities</structfield> field
		returns the same set of	capabilities. This allows applications to open
		just one of the devices (typically the video device) and discover whether
		video, vbi and/or radio are also supported.
	    </entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>reserved</structfield>[4]</entry>
	    <entry><structfield>device_caps</structfield></entry>
	    <entry>Device capabilities of the opened device, see <xref
		linkend="device-capabilities" />. Should contain the available capabilities
		of that specific device node. So, for example, <structfield>device_caps</structfield>
		of a radio device will only contain radio related capabilities and
		no video or vbi capabilities. This field is only set if the <structfield>capabilities</structfield>
		field contains the <constant>V4L2_CAP_DEVICE_CAPS</constant> capability.
		Only the <structfield>capabilities</structfield> field can have the
		<constant>V4L2_CAP_DEVICE_CAPS</constant> capability, <structfield>device_caps</structfield>
		will never set <constant>V4L2_CAP_DEVICE_CAPS</constant>.
	    </entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>reserved</structfield>[3]</entry>
	    <entry>Reserved for future extensions. Drivers must set
this array to zero.</entry>
	  </row>
@@ -276,6 +299,13 @@ linkend="async">asynchronous</link> I/O methods.</entry>
	    <entry>The device supports the <link
linkend="mmap">streaming</link> I/O method.</entry>
	  </row>
	  <row>
	    <entry><constant>V4L2_CAP_DEVICE_CAPS</constant></entry>
	    <entry>0x80000000</entry>
	    <entry>The driver fills the <structfield>device_caps</structfield>
	    field. This capability can only appear in the <structfield>capabilities</structfield>
	    field and never in the <structfield>device_caps</structfield> field.</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>
+0 −1
Original line number Diff line number Diff line
@@ -1686,7 +1686,6 @@ static struct v4l2_capability pvr_capability = {
	.capabilities   = (V4L2_CAP_VIDEO_CAPTURE |
			   V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_RADIO |
			 V4L2_CAP_STREAMING | V4L2_CAP_READWRITE),
	.reserved       = {0, 0, 0, 0}
};
static int vidioc_querycap(struct file *file, void  *priv,
				struct v4l2_capability *cap)
+0 −1
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ static struct v4l2_capability pvr_capability ={
	.capabilities   = (V4L2_CAP_VIDEO_CAPTURE |
			   V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_RADIO |
			   V4L2_CAP_READWRITE),
	.reserved       = {0,0,0,0}
};

static struct v4l2_fmtdesc pvr_fmtdesc [] = {
Loading