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 .. cpp:function:: int ioctl( int fd, int request, struct media_links_enum *argp )
25 File descriptor returned by :ref:`open() <media-func-open>`.
36 To enumerate pads and/or links for a given entity, applications set the
37 entity field of a struct :ref:`media_links_enum <media-links-enum>`
38 structure and initialize the struct
39 :ref:`media_pad_desc <media-pad-desc>` and struct
40 :ref:`media_link_desc <media-link-desc>` structure arrays pointed by
41 the ``pads`` and ``links`` fields. They then call the
42 MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure.
44 If the ``pads`` field is not NULL, the driver fills the ``pads`` array
45 with information about the entity's pads. The array must have enough
46 room to store all the entity's pads. The number of pads can be retrieved
47 with the :ref:`MEDIA_IOC_ENUM_ENTITIES <media-ioc-enum-entities>`
50 If the ``links`` field is not NULL, the driver fills the ``links`` array
51 with information about the entity's outbound links. The array must have
52 enough room to store all the entity's outbound links. The number of
53 outbound links can be retrieved with the
54 :ref:`MEDIA_IOC_ENUM_ENTITIES <media-ioc-enum-entities>` ioctl.
56 Only forward links that originate at one of the entity's source pads are
57 returned during the enumeration process.
62 .. flat-table:: struct media_links_enum
74 - Entity id, set by the application.
78 - struct :ref:`media_pad_desc <media-pad-desc>`
82 - Pointer to a pads array allocated by the application. Ignored if
87 - struct :ref:`media_link_desc <media-link-desc>`
91 - Pointer to a links array allocated by the application. Ignored if
98 .. flat-table:: struct media_pad_desc
110 - ID of the entity this pad belongs to.
126 - Pad flags, see :ref:`media-pad-flag` for more details.
132 .. flat-table:: struct media_link_desc
140 - struct :ref:`media_pad_desc <media-pad-desc>`
144 - Pad at the origin of this link.
148 - struct :ref:`media_pad_desc <media-pad-desc>`
152 - Pad at the target of this link.
160 - Link flags, see :ref:`media-link-flag` for more details.
166 On success 0 is returned, on error -1 and the ``errno`` variable is set
167 appropriately. The generic error codes are described at the
168 :ref:`Generic Error Codes <gen-errors>` chapter.
171 The struct :ref:`media_links_enum <media-links-enum>` ``id``
172 references a non-existing entity.