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>dev</structfield></entry>
148 <entry>Valid for (sub-)devices that create a single device node.</entry>
154 <entry><structfield>major</structfield></entry>
155 <entry>Device node major number.</entry>
161 <entry><structfield>minor</structfield></entry>
162 <entry>Device node minor number.</entry>
167 <entry><structfield>raw</structfield>[184]</entry>
175 <table frame="none" pgwide="1" id="media-entity-type">
176 <title>Media entity types</title>
178 <colspec colname="c1"/>
179 <colspec colname="c2"/>
182 <entry><constant>MEDIA_ENT_T_UNKNOWN</constant> and <constant>MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN</constant></entry>
183 <entry>Unknown entity. That generally indicates that
184 a driver didn't initialize properly the entity, with is a Kernel bug</entry>
187 <entry><constant>MEDIA_ENT_T_V4L2_VIDEO</constant></entry>
188 <entry>V4L video streaming input or output entity</entry>
191 <entry><constant>MEDIA_ENT_T_V4L2_VBI</constant></entry>
192 <entry>V4L VBI streaming input or output entity</entry>
195 <entry><constant>MEDIA_ENT_T_V4L2_SWRADIO</constant></entry>
196 <entry>V4L Software Digital Radio (SDR) streaming input or output entity</entry>
199 <entry><constant>MEDIA_ENT_T_DVB_DEMOD</constant></entry>
200 <entry>DVB demodulator entity</entry>
203 <entry><constant>MEDIA_ENT_T_DVB_DEMUX</constant></entry>
204 <entry>DVB demux entity. Can be implemented in hardware or in Kernelspace</entry>
207 <entry><constant>MEDIA_ENT_T_DVB_TSOUT</constant></entry>
208 <entry>DVB Transport Stream output entity</entry>
211 <entry><constant>MEDIA_ENT_T_DVB_CA</constant></entry>
212 <entry>DVB Conditional Access module (CAM) entity</entry>
215 <entry><constant>MEDIA_ENT_T_DVB_DEMOD_NET_DECAP</constant></entry>
216 <entry>DVB network ULE/MLE de-encapsulation entity. Can be implemented in hardware or in Kernelspace</entry>
219 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_SENSOR</constant></entry>
220 <entry>Camera image sensor entity</entry>
223 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_FLASH</constant></entry>
224 <entry>Flash controller entity</entry>
227 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_LENS</constant></entry>
228 <entry>Lens controller entity</entry>
231 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_DECODER</constant></entry>
232 <entry>Analog video decoder, the basic function of the video decoder
233 is to accept analogue video from a wide variety of sources such as
234 broadcast, DVD players, cameras and video cassette recorders, in
235 either NTSC, PAL, SECAM or HD format, separating the stream
236 into its component parts, luminance and chrominance, and output
237 it in some digital video standard, with appropriate timing
241 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_TUNER</constant></entry>
242 <entry>Digital TV, analog TV, radio and/or software radio tuner</entry>
248 <table frame="none" pgwide="1" id="media-entity-flag">
249 <title>Media entity flags</title>
251 <colspec colname="c1"/>
252 <colspec colname="c2"/>
255 <entry><constant>MEDIA_ENT_FL_DEFAULT</constant></entry>
256 <entry>Default entity for its type. Used to discover the default
257 audio, VBI and video devices, the default camera sensor, ...</entry>
269 <term><errorcode>EINVAL</errorcode></term>
271 <para>The &media-entity-desc; <structfield>id</structfield> references
272 a non-existing entity.</para>