• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. -*- coding: utf-8; mode: rst -*-
2
3.. _media_ioc_enum_links:
4
5**************************
6ioctl MEDIA_IOC_ENUM_LINKS
7**************************
8
9Name
10====
11
12MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity
13
14
15Synopsis
16========
17
18.. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp )
19    :name: MEDIA_IOC_ENUM_LINKS
20
21
22Arguments
23=========
24
25``fd``
26    File descriptor returned by :ref:`open() <media-func-open>`.
27
28``argp``
29
30
31Description
32===========
33
34To enumerate pads and/or links for a given entity, applications set the
35entity field of a struct :c:type:`media_links_enum`
36structure and initialize the struct
37:c:type:`media_pad_desc` and struct
38:c:type:`media_link_desc` structure arrays pointed by
39the ``pads`` and ``links`` fields. They then call the
40MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure.
41
42If the ``pads`` field is not NULL, the driver fills the ``pads`` array
43with information about the entity's pads. The array must have enough
44room to store all the entity's pads. The number of pads can be retrieved
45with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
46
47If the ``links`` field is not NULL, the driver fills the ``links`` array
48with information about the entity's outbound links. The array must have
49enough room to store all the entity's outbound links. The number of
50outbound links can be retrieved with :ref:`MEDIA_IOC_ENUM_ENTITIES`.
51
52Only forward links that originate at one of the entity's source pads are
53returned during the enumeration process.
54
55
56.. c:type:: media_links_enum
57
58.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
59
60.. flat-table:: struct media_links_enum
61    :header-rows:  0
62    :stub-columns: 0
63    :widths:       1 1 2
64
65    *  -  __u32
66       -  ``entity``
67       -  Entity id, set by the application.
68
69    *  -  struct :c:type:`media_pad_desc`
70       -  \*\ ``pads``
71       -  Pointer to a pads array allocated by the application. Ignored if
72	  NULL.
73
74    *  -  struct :c:type:`media_link_desc`
75       -  \*\ ``links``
76       -  Pointer to a links array allocated by the application. Ignored if
77	  NULL.
78
79
80.. c:type:: media_pad_desc
81
82.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
83
84.. flat-table:: struct media_pad_desc
85    :header-rows:  0
86    :stub-columns: 0
87    :widths:       1 1 2
88
89    *  -  __u32
90       -  ``entity``
91       -  ID of the entity this pad belongs to.
92
93    *  -  __u16
94       -  ``index``
95       -  Pad index, starts at 0.
96
97    *  -  __u32
98       -  ``flags``
99       -  Pad flags, see :ref:`media-pad-flag` for more details.
100
101    *  -  __u32
102       -  ``reserved[2]``
103       -  Reserved for future extensions. Drivers and applications must set
104          the array to zero.
105
106
107
108.. c:type:: media_link_desc
109
110.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
111
112.. flat-table:: struct media_link_desc
113    :header-rows:  0
114    :stub-columns: 0
115    :widths:       1 1 2
116
117    *  -  struct :c:type:`media_pad_desc`
118       -  ``source``
119       -  Pad at the origin of this link.
120
121    *  -  struct :c:type:`media_pad_desc`
122       -  ``sink``
123       -  Pad at the target of this link.
124
125    *  -  __u32
126       -  ``flags``
127       -  Link flags, see :ref:`media-link-flag` for more details.
128
129    *  -  __u32
130       -  ``reserved[4]``
131       -  Reserved for future extensions. Drivers and applications must set
132          the array to zero.
133
134
135Return Value
136============
137
138On success 0 is returned, on error -1 and the ``errno`` variable is set
139appropriately. The generic error codes are described at the
140:ref:`Generic Error Codes <gen-errors>` chapter.
141
142EINVAL
143    The struct :c:type:`media_links_enum` ``id``
144    references a non-existing entity.
145