1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl MEDIA_IOC_ENUM_LINKS</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="media-user-func.html" title="Appendix&#160;L.&#160;Function Reference"><link rel="prev" href="media-ioc-enum-entities.html" title="ioctl MEDIA_IOC_ENUM_ENTITIES"><link rel="next" href="media-ioc-setup-link.html" title="ioctl MEDIA_IOC_SETUP_LINK"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl MEDIA_IOC_ENUM_LINKS</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="media-ioc-enum-entities.html">Prev</a>&#160;</td><th width="60%" align="center">Appendix&#160;L.&#160;Function Reference</th><td width="20%" align="right">&#160;<a accesskey="n" href="media-ioc-setup-link.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="media-ioc-enum-links"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>MEDIA_IOC_ENUM_LINKS &#8212; Enumerate all pads and links for a given entity</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">request</var>, </td></tr><tr><td>&#160;</td><td>struct media_links_enum *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1134351772"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by
2	  <a class="link" href="media-func-open.html" title="media open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>MEDIA_IOC_ENUM_LINKS</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1"><a name="idp1134355636"></a><h2>Description</h2><p>To enumerate pads and/or links for a given entity, applications set
3    the entity field of a struct&#160;<a class="link" href="media-ioc-enum-links.html#media-links-enum" title="Table&#160;L.5.&#160;struct media_links_enum">media_links_enum</a> structure and initialize the
4    struct&#160;<a class="link" href="media-ioc-enum-links.html#media-pad-desc" title="Table&#160;L.6.&#160;struct media_pad_desc">media_pad_desc</a> and struct&#160;<a class="link" href="media-ioc-enum-links.html#media-link-desc" title="Table&#160;L.8.&#160;struct media_link_desc">media_link_desc</a> structure arrays pointed by the
5    <em class="structfield"><code>pads</code></em> and <em class="structfield"><code>links</code></em> fields.
6    They then call the MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this
7    structure.</p><p>If the <em class="structfield"><code>pads</code></em> field is not NULL, the driver
8    fills the <em class="structfield"><code>pads</code></em> array with information about the
9    entity's pads. The array must have enough room to store all the entity's
10    pads. The number of pads can be retrieved with the <a class="link" href="media-ioc-enum-entities.html" title="ioctl MEDIA_IOC_ENUM_ENTITIES"><code class="constant">MEDIA_IOC_ENUM_ENTITIES</code></a>
11    ioctl.</p><p>If the <em class="structfield"><code>links</code></em> field is not NULL, the driver
12    fills the <em class="structfield"><code>links</code></em> array with information about the
13    entity's outbound links. The array must have enough room to store all the
14    entity's outbound links. The number of outbound links can be retrieved with
15    the <a class="link" href="media-ioc-enum-entities.html" title="ioctl MEDIA_IOC_ENUM_ENTITIES"><code class="constant">MEDIA_IOC_ENUM_ENTITIES</code></a> ioctl.</p><p>Only forward links that originate at one of the entity's source pads
16    are returned during the enumeration process.</p><div class="table"><a name="media-links-enum"></a><p class="title"><b>Table&#160;L.5.&#160;struct <span class="structname">media_links_enum</span></b></p><div class="table-contents"><table summary="struct media_links_enum" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>entity</code></em></td><td valign="top">Entity id, set by the application.</td></tr><tr><td valign="top">struct&#160;<a class="link" href="media-ioc-enum-links.html#media-pad-desc" title="Table&#160;L.6.&#160;struct media_pad_desc">media_pad_desc</a></td><td valign="top">*<em class="structfield"><code>pads</code></em></td><td valign="top">Pointer to a pads array allocated by the application. Ignored
17	    if NULL.</td></tr><tr><td valign="top">struct&#160;<a class="link" href="media-ioc-enum-links.html#media-link-desc" title="Table&#160;L.8.&#160;struct media_link_desc">media_link_desc</a></td><td valign="top">*<em class="structfield"><code>links</code></em></td><td valign="top">Pointer to a links array allocated by the application. Ignored
18	    if NULL.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="media-pad-desc"></a><p class="title"><b>Table&#160;L.6.&#160;struct <span class="structname">media_pad_desc</span></b></p><div class="table-contents"><table summary="struct media_pad_desc" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>entity</code></em></td><td valign="top">ID of the entity this pad belongs to.</td></tr><tr><td valign="top">__u16</td><td valign="top"><em class="structfield"><code>index</code></em></td><td valign="top">0-based pad index.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>flags</code></em></td><td valign="top">Pad flags, see <a class="xref" href="media-ioc-enum-links.html#media-pad-flag" title="Table&#160;L.7.&#160;Media pad flags">Table&#160;L.7, &#8220;Media pad flags&#8221;</a> for more details.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="media-pad-flag"></a><p class="title"><b>Table&#160;L.7.&#160;Media pad flags</b></p><div class="table-contents"><table summary="Media pad flags" width="100%" border="0"><colgroup><col class="c1"><col class="c2"></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">MEDIA_PAD_FL_SINK</code></td><td valign="top">Input pad, relative to the entity. Input pads sink data and
19	    are targets of links.</td></tr><tr><td valign="top"><code class="constant">MEDIA_PAD_FL_SOURCE</code></td><td valign="top">Output pad, relative to the entity. Output pads source data
20	    and are origins of links.</td></tr><tr><td valign="top"><code class="constant">MEDIA_PAD_FL_MUST_CONNECT</code></td><td valign="top">If this flag is set and the pad is linked to any other
21	    pad, then at least one of those links must be enabled for the
22	    entity to be able to stream. There could be temporary reasons
23	    (e.g. device configuration dependent) for the pad to need
24	    enabled links even when this flag isn't set; the absence of the
25	    flag doesn't imply there is none.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="media-link-desc"></a><p class="title"><b>Table&#160;L.8.&#160;struct <span class="structname">media_link_desc</span></b></p><div class="table-contents"><table summary="struct media_link_desc" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">struct&#160;<a class="link" href="media-ioc-enum-links.html#media-pad-desc" title="Table&#160;L.6.&#160;struct media_pad_desc">media_pad_desc</a></td><td valign="top"><em class="structfield"><code>source</code></em></td><td valign="top">Pad at the origin of this link.</td></tr><tr><td valign="top">struct&#160;<a class="link" href="media-ioc-enum-links.html#media-pad-desc" title="Table&#160;L.6.&#160;struct media_pad_desc">media_pad_desc</a></td><td valign="top"><em class="structfield"><code>sink</code></em></td><td valign="top">Pad at the target of this link.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>flags</code></em></td><td valign="top">Link flags, see <a class="xref" href="media-ioc-enum-links.html#media-link-flag" title="Table&#160;L.9.&#160;Media link flags">Table&#160;L.9, &#8220;Media link flags&#8221;</a> for more details.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="media-link-flag"></a><p class="title"><b>Table&#160;L.9.&#160;Media link flags</b></p><div class="table-contents"><table summary="Media link flags" width="100%" border="0"><colgroup><col class="c1"><col class="c2"></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">MEDIA_LNK_FL_ENABLED</code></td><td valign="top">The link is enabled and can be used to transfer media data.
26	    When two or more links target a sink pad, only one of them can be
27	    enabled at a time.</td></tr><tr><td valign="top"><code class="constant">MEDIA_LNK_FL_IMMUTABLE</code></td><td valign="top">The link enabled state can't be modified at runtime. An
28	    immutable link is always enabled.</td></tr><tr><td valign="top"><code class="constant">MEDIA_LNK_FL_DYNAMIC</code></td><td valign="top">The link enabled state can be modified during streaming. This
29	    flag is set by drivers and is read-only for applications.</td></tr></tbody></table></div></div><br class="table-break"><p>One and only one of <code class="constant">MEDIA_PAD_FL_SINK</code> and
30    <code class="constant">MEDIA_PAD_FL_SOURCE</code> must be set for every pad.</p></div><div class="refsect1"><a name="idp1134390204"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table&#160;19.1.&#160;Generic error codes">Generic Error Codes</a> chapter.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The struct&#160;<a class="link" href="media-ioc-enum-links.html#media-links-enum" title="Table&#160;L.5.&#160;struct media_links_enum">media_links_enum</a> <em class="structfield"><code>id</code></em> references
31	  a non-existing entity.</p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="media-ioc-enum-entities.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="media-user-func.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="media-ioc-setup-link.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl MEDIA_IOC_ENUM_ENTITIES&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;ioctl MEDIA_IOC_SETUP_LINK</td></tr></table></div></body></html>
32