1 .. -*- coding: utf-8; mode: rst -*-
3 .. _media_ioc_enum_links:
5 **************************
6 ioctl MEDIA_IOC_ENUM_LINKS
7 **************************
12 MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity
18 .. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp )
19 :name: MEDIA_IOC_ENUM_LINKS
26 File descriptor returned by :ref:`open() <media-func-open>`.
29 Pointer to struct :c:type:`media_links_enum`.
35 To enumerate pads and/or links for a given entity, applications set the
36 entity field of a struct :c:type:`media_links_enum`
37 structure and initialize the struct
38 :c:type:`media_pad_desc` and struct
39 :c:type:`media_link_desc` structure arrays pointed by
40 the ``pads`` and ``links`` fields. They then call the
41 MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure.
43 If the ``pads`` field is not NULL, the driver fills the ``pads`` array
44 with information about the entity's pads. The array must have enough
45 room to store all the entity's pads. The number of pads can be retrieved
46 with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
48 If the ``links`` field is not NULL, the driver fills the ``links`` array
49 with information about the entity's outbound links. The array must have
50 enough room to store all the entity's outbound links. The number of
51 outbound links can be retrieved with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
53 Only forward links that originate at one of the entity's source pads are
54 returned during the enumeration process.
57 .. c:type:: media_links_enum
59 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
61 .. flat-table:: struct media_links_enum
68 - Entity id, set by the application.
70 * - struct :c:type:`media_pad_desc`
72 - Pointer to a pads array allocated by the application. Ignored if
75 * - struct :c:type:`media_link_desc`
77 - Pointer to a links array allocated by the application. Ignored if
81 .. c:type:: media_pad_desc
83 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
85 .. flat-table:: struct media_pad_desc
92 - ID of the entity this pad belongs to.
96 - Pad index, starts at 0.
100 - Pad flags, see :ref:`media-pad-flag` for more details.
104 - Reserved for future extensions. Drivers and applications must set
109 .. c:type:: media_link_desc
111 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
113 .. flat-table:: struct media_link_desc
118 * - struct :c:type:`media_pad_desc`
120 - Pad at the origin of this link.
122 * - struct :c:type:`media_pad_desc`
124 - Pad at the target of this link.
128 - Link flags, see :ref:`media-link-flag` for more details.
132 - Reserved for future extensions. Drivers and applications must set
139 On success 0 is returned, on error -1 and the ``errno`` variable is set
140 appropriately. The generic error codes are described at the
141 :ref:`Generic Error Codes <gen-errors>` chapter.
144 The struct :c:type:`media_links_enum` ``id``
145 references a non-existing entity.