cc3cc3d2400b50caaf23983af56816da574b57ce
[cascardo/linux.git] / Documentation / linux_tv / media / mediactl / media-ioc-enum-links.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _media-ioc-enum-links:
4
5 **************************
6 ioctl MEDIA_IOC_ENUM_LINKS
7 **************************
8
9 Name
10 ====
11
12 MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity
13
14
15 Synopsis
16 ========
17
18 .. cpp:function:: int ioctl( int fd, int request, struct media_links_enum *argp )
19
20
21 Arguments
22 =========
23
24 ``fd``
25     File descriptor returned by :ref:`open() <media-func-open>`.
26
27 ``request``
28     MEDIA_IOC_ENUM_LINKS
29
30 ``argp``
31
32
33 Description
34 ===========
35
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.
43
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>`
48 ioctl.
49
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.
55
56 Only forward links that originate at one of the entity's source pads are
57 returned during the enumeration process.
58
59
60 .. _media-links-enum:
61
62 .. flat-table:: struct media_links_enum
63     :header-rows:  0
64     :stub-columns: 0
65     :widths:       1 1 2
66
67
68     -  .. row 1
69
70        -  __u32
71
72        -  ``entity``
73
74        -  Entity id, set by the application.
75
76     -  .. row 2
77
78        -  struct :ref:`media_pad_desc <media-pad-desc>`
79
80        -  \*\ ``pads``
81
82        -  Pointer to a pads array allocated by the application. Ignored if
83           NULL.
84
85     -  .. row 3
86
87        -  struct :ref:`media_link_desc <media-link-desc>`
88
89        -  \*\ ``links``
90
91        -  Pointer to a links array allocated by the application. Ignored if
92           NULL.
93
94
95
96 .. _media-pad-desc:
97
98 .. flat-table:: struct media_pad_desc
99     :header-rows:  0
100     :stub-columns: 0
101     :widths:       1 1 2
102
103
104     -  .. row 1
105
106        -  __u32
107
108        -  ``entity``
109
110        -  ID of the entity this pad belongs to.
111
112     -  .. row 2
113
114        -  __u16
115
116        -  ``index``
117
118        -  0-based pad index.
119
120     -  .. row 3
121
122        -  __u32
123
124        -  ``flags``
125
126        -  Pad flags, see :ref:`media-pad-flag` for more details.
127
128
129
130 .. _media-link-desc:
131
132 .. flat-table:: struct media_link_desc
133     :header-rows:  0
134     :stub-columns: 0
135     :widths:       1 1 2
136
137
138     -  .. row 1
139
140        -  struct :ref:`media_pad_desc <media-pad-desc>`
141
142        -  ``source``
143
144        -  Pad at the origin of this link.
145
146     -  .. row 2
147
148        -  struct :ref:`media_pad_desc <media-pad-desc>`
149
150        -  ``sink``
151
152        -  Pad at the target of this link.
153
154     -  .. row 3
155
156        -  __u32
157
158        -  ``flags``
159
160        -  Link flags, see :ref:`media-link-flag` for more details.
161
162
163 Return Value
164 ============
165
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.
169
170 EINVAL
171     The struct :ref:`media_links_enum <media-links-enum>` ``id``
172     references a non-existing entity.