1 .. -*- coding: utf-8; mode: rst -*-
3 .. _media-ioc-enum-links:
5 **************************
6 ioctl MEDIA_IOC_ENUM_LINKS
7 **************************
9 *man MEDIA_IOC_ENUM_LINKS(2)*
11 Enumerate all pads and links for a given entity
17 .. cpp:function:: int ioctl( int fd, int request, struct media_links_enum *argp )
23 File descriptor returned by :ref:`open() <media-func-open>`.
34 To enumerate pads and/or links for a given entity, applications set the
35 entity field of a struct :ref:`media_links_enum <media-links-enum>`
36 structure and initialize the struct
37 :ref:`media_pad_desc <media-pad-desc>` and struct
38 :ref:`media_link_desc <media-link-desc>` structure arrays pointed by
39 the ``pads`` and ``links`` fields. They then call the
40 MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure.
42 If the ``pads`` field is not NULL, the driver fills the ``pads`` array
43 with information about the entity's pads. The array must have enough
44 room to store all the entity's pads. The number of pads can be retrieved
45 with the :ref:`MEDIA_IOC_ENUM_ENTITIES <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 the
52 :ref:`MEDIA_IOC_ENUM_ENTITIES <media-ioc-enum-entities>` ioctl.
54 Only forward links that originate at one of the entity's source pads are
55 returned during the enumeration process.
60 .. flat-table:: struct media_links_enum
72 - Entity id, set by the application.
76 - struct :ref:`media_pad_desc <media-pad-desc>`
80 - Pointer to a pads array allocated by the application. Ignored if
85 - struct :ref:`media_link_desc <media-link-desc>`
89 - Pointer to a links array allocated by the application. Ignored if
96 .. flat-table:: struct media_pad_desc
108 - ID of the entity this pad belongs to.
124 - Pad flags, see :ref:`media-pad-flag` for more details.
130 .. flat-table:: struct media_link_desc
138 - struct :ref:`media_pad_desc <media-pad-desc>`
142 - Pad at the origin of this link.
146 - struct :ref:`media_pad_desc <media-pad-desc>`
150 - Pad at the target of this link.
158 - Link flags, see :ref:`media-link-flag` for more details.
165 On success 0 is returned, on error -1 and the ``errno`` variable is set
166 appropriately. The generic error codes are described at the
167 :ref:`Generic Error Codes <gen-errors>` chapter.
170 The struct :ref:`media_links_enum <media-links-enum>` ``id``
171 references a non-existing entity.