1 <refentry id="media-ioc-enum-entities">
3 <refentrytitle>ioctl MEDIA_IOC_ENUM_ENTITIES</refentrytitle>
8 <refname>MEDIA_IOC_ENUM_ENTITIES</refname>
9 <refpurpose>Enumerate entities and their properties</refpurpose>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct media_entity_desc *<parameter>argp</parameter></paramdef>
24 <title>Arguments</title>
28 <term><parameter>fd</parameter></term>
30 <para>File descriptor returned by
31 <link linkend='media-func-open'><function>open()</function></link>.</para>
35 <term><parameter>request</parameter></term>
37 <para>MEDIA_IOC_ENUM_ENTITIES</para>
41 <term><parameter>argp</parameter></term>
50 <title>Description</title>
51 <para>To query the attributes of an entity, applications set the id field
52 of a &media-entity-desc; structure and call the MEDIA_IOC_ENUM_ENTITIES
53 ioctl with a pointer to this structure. The driver fills the rest of the
54 structure or returns an &EINVAL; when the id is invalid.</para>
55 <para>Entities can be enumerated by or'ing the id with the
56 <constant>MEDIA_ENT_ID_FLAG_NEXT</constant> flag. The driver will return
57 information about the entity with the smallest id strictly larger than the
58 requested one ('next entity'), or the &EINVAL; if there is none.</para>
59 <para>Entity IDs can be non-contiguous. Applications must
60 <emphasis>not</emphasis> try to enumerate entities by calling
61 MEDIA_IOC_ENUM_ENTITIES with increasing id's until they get an error.</para>
62 <para>Two or more entities that share a common non-zero
63 <structfield>group_id</structfield> value are considered as logically
64 grouped. Groups are used to report
66 <listitem><para>ALSA, VBI and video nodes that carry the same media
67 stream</para></listitem>
68 <listitem><para>lens and flash controllers associated with a sensor</para></listitem>
72 <table pgwide="1" frame="none" id="media-entity-desc">
73 <title>struct <structname>media_entity_desc</structname></title>
75 <colspec colname="c1" />
76 <colspec colname="c2" />
77 <colspec colname="c3" />
78 <colspec colname="c4" />
79 <colspec colname="c5" />
83 <entry><structfield>id</structfield></entry>
86 <entry>Entity id, set by the application. When the id is or'ed with
87 <constant>MEDIA_ENT_ID_FLAG_NEXT</constant>, the driver clears the
88 flag and returns the first entity with a larger id.</entry>
92 <entry><structfield>name</structfield>[32]</entry>
95 <entry>Entity name as an UTF-8 NULL-terminated string.</entry>
99 <entry><structfield>type</structfield></entry>
102 <entry>Entity type, see <xref linkend="media-entity-type" /> for details.</entry>
106 <entry><structfield>revision</structfield></entry>
109 <entry>Entity revision in a driver/hardware specific format.</entry>
113 <entry><structfield>flags</structfield></entry>
116 <entry>Entity flags, see <xref linkend="media-entity-flag" /> for details.</entry>
120 <entry><structfield>group_id</structfield></entry>
123 <entry>Entity group ID</entry>
127 <entry><structfield>pads</structfield></entry>
130 <entry>Number of pads</entry>
134 <entry><structfield>links</structfield></entry>
137 <entry>Total number of outbound links. Inbound links are not counted
138 in this field.</entry>
145 <entry>struct</entry>
146 <entry><structfield>v4l</structfield></entry>
148 <entry>Valid for V4L sub-devices and nodes only.</entry>
154 <entry><structfield>major</structfield></entry>
155 <entry>V4L device node major number. For V4L sub-devices with no
156 device node, set by the driver to 0.</entry>
162 <entry><structfield>minor</structfield></entry>
163 <entry>V4L device node minor number. For V4L sub-devices with no
164 device node, set by the driver to 0.</entry>
168 <entry>struct</entry>
169 <entry><structfield>fb</structfield></entry>
171 <entry>Valid for frame buffer nodes only.</entry>
177 <entry><structfield>major</structfield></entry>
178 <entry>Frame buffer device node major number.</entry>
184 <entry><structfield>minor</structfield></entry>
185 <entry>Frame buffer device node minor number.</entry>
189 <entry>struct</entry>
190 <entry><structfield>alsa</structfield></entry>
192 <entry>Valid for ALSA devices only.</entry>
198 <entry><structfield>card</structfield></entry>
199 <entry>ALSA card number</entry>
205 <entry><structfield>device</structfield></entry>
206 <entry>ALSA device number</entry>
212 <entry><structfield>subdevice</structfield></entry>
213 <entry>ALSA sub-device number</entry>
218 <entry><structfield>dvb</structfield></entry>
220 <entry>DVB card number</entry>
225 <entry><structfield>raw</structfield>[180]</entry>
233 <table frame="none" pgwide="1" id="media-entity-type">
234 <title>Media entity types</title>
236 <colspec colname="c1"/>
237 <colspec colname="c2"/>
240 <entry><constant>MEDIA_ENT_T_DEVNODE</constant></entry>
241 <entry>Unknown device node</entry>
244 <entry><constant>MEDIA_ENT_T_DEVNODE_V4L</constant></entry>
245 <entry>V4L video, radio or vbi device node</entry>
248 <entry><constant>MEDIA_ENT_T_DEVNODE_FB</constant></entry>
249 <entry>Frame buffer device node</entry>
252 <entry><constant>MEDIA_ENT_T_DEVNODE_ALSA</constant></entry>
253 <entry>ALSA card</entry>
256 <entry><constant>MEDIA_ENT_T_DEVNODE_DVB</constant></entry>
257 <entry>DVB card</entry>
260 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV</constant></entry>
261 <entry>Unknown V4L sub-device</entry>
264 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_SENSOR</constant></entry>
265 <entry>Video sensor</entry>
268 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_FLASH</constant></entry>
269 <entry>Flash controller</entry>
272 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_LENS</constant></entry>
273 <entry>Lens controller</entry>
276 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_DECODER</constant></entry>
277 <entry>Video decoder, the basic function of the video decoder is to
278 accept analogue video from a wide variety of sources such as
279 broadcast, DVD players, cameras and video cassette recorders, in
280 either NTSC, PAL or HD format and still occasionally SECAM, separate
281 it into its component parts, luminance and chrominance, and output
282 it in some digital video standard, with appropriate embedded timing
289 <table frame="none" pgwide="1" id="media-entity-flag">
290 <title>Media entity flags</title>
292 <colspec colname="c1"/>
293 <colspec colname="c2"/>
296 <entry><constant>MEDIA_ENT_FL_DEFAULT</constant></entry>
297 <entry>Default entity for its type. Used to discover the default
298 audio, VBI and video devices, the default camera sensor, ...</entry>
310 <term><errorcode>EINVAL</errorcode></term>
312 <para>The &media-entity-desc; <structfield>id</structfield> references
313 a non-existing entity.</para>