Path: blob/master/Documentation/DocBook/v4l/media-ioc-enum-links.xml
10821 views
<refentry id="media-ioc-enum-links">1<refmeta>2<refentrytitle>ioctl MEDIA_IOC_ENUM_LINKS</refentrytitle>3&manvol;4</refmeta>56<refnamediv>7<refname>MEDIA_IOC_ENUM_LINKS</refname>8<refpurpose>Enumerate all pads and links for a given entity</refpurpose>9</refnamediv>1011<refsynopsisdiv>12<funcsynopsis>13<funcprototype>14<funcdef>int <function>ioctl</function></funcdef>15<paramdef>int <parameter>fd</parameter></paramdef>16<paramdef>int <parameter>request</parameter></paramdef>17<paramdef>struct media_links_enum *<parameter>argp</parameter></paramdef>18</funcprototype>19</funcsynopsis>20</refsynopsisdiv>2122<refsect1>23<title>Arguments</title>2425<variablelist>26<varlistentry>27<term><parameter>fd</parameter></term>28<listitem>29<para>File descriptor returned by30<link linkend='media-func-open'><function>open()</function></link>.</para>31</listitem>32</varlistentry>33<varlistentry>34<term><parameter>request</parameter></term>35<listitem>36<para>MEDIA_IOC_ENUM_LINKS</para>37</listitem>38</varlistentry>39<varlistentry>40<term><parameter>argp</parameter></term>41<listitem>42<para></para>43</listitem>44</varlistentry>45</variablelist>46</refsect1>4748<refsect1>49<title>Description</title>5051<para>To enumerate pads and/or links for a given entity, applications set52the entity field of a &media-links-enum; structure and initialize the53&media-pad-desc; and &media-link-desc; structure arrays pointed by the54<structfield>pads</structfield> and <structfield>links</structfield> fields.55They then call the MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this56structure.</para>57<para>If the <structfield>pads</structfield> field is not NULL, the driver58fills the <structfield>pads</structfield> array with information about the59entity's pads. The array must have enough room to store all the entity's60pads. The number of pads can be retrieved with the &MEDIA-IOC-ENUM-ENTITIES;61ioctl.</para>62<para>If the <structfield>links</structfield> field is not NULL, the driver63fills the <structfield>links</structfield> array with information about the64entity's outbound links. The array must have enough room to store all the65entity's outbound links. The number of outbound links can be retrieved with66the &MEDIA-IOC-ENUM-ENTITIES; ioctl.</para>67<para>Only forward links that originate at one of the entity's source pads68are returned during the enumeration process.</para>6970<table pgwide="1" frame="none" id="media-links-enum">71<title>struct <structname>media_links_enum</structname></title>72<tgroup cols="3">73&cs-str;74<tbody valign="top">75<row>76<entry>__u32</entry>77<entry><structfield>entity</structfield></entry>78<entry>Entity id, set by the application.</entry>79</row>80<row>81<entry>struct &media-pad-desc;</entry>82<entry>*<structfield>pads</structfield></entry>83<entry>Pointer to a pads array allocated by the application. Ignored84if NULL.</entry>85</row>86<row>87<entry>struct &media-link-desc;</entry>88<entry>*<structfield>links</structfield></entry>89<entry>Pointer to a links array allocated by the application. Ignored90if NULL.</entry>91</row>92</tbody>93</tgroup>94</table>9596<table pgwide="1" frame="none" id="media-pad-desc">97<title>struct <structname>media_pad_desc</structname></title>98<tgroup cols="3">99&cs-str;100<tbody valign="top">101<row>102<entry>__u32</entry>103<entry><structfield>entity</structfield></entry>104<entry>ID of the entity this pad belongs to.</entry>105</row>106<row>107<entry>__u16</entry>108<entry><structfield>index</structfield></entry>109<entry>0-based pad index.</entry>110</row>111<row>112<entry>__u32</entry>113<entry><structfield>flags</structfield></entry>114<entry>Pad flags, see <xref linkend="media-pad-flag" /> for more details.</entry>115</row>116</tbody>117</tgroup>118</table>119120<table frame="none" pgwide="1" id="media-pad-flag">121<title>Media pad flags</title>122<tgroup cols="2">123<colspec colname="c1"/>124<colspec colname="c2"/>125<tbody valign="top">126<row>127<entry><constant>MEDIA_PAD_FL_SINK</constant></entry>128<entry>Input pad, relative to the entity. Input pads sink data and129are targets of links.</entry>130</row>131<row>132<entry><constant>MEDIA_PAD_FL_SOURCE</constant></entry>133<entry>Output pad, relative to the entity. Output pads source data134and are origins of links.</entry>135</row>136</tbody>137</tgroup>138</table>139140<table pgwide="1" frame="none" id="media-link-desc">141<title>struct <structname>media_links_desc</structname></title>142<tgroup cols="3">143&cs-str;144<tbody valign="top">145<row>146<entry>struct &media-pad-desc;</entry>147<entry><structfield>source</structfield></entry>148<entry>Pad at the origin of this link.</entry>149</row>150<row>151<entry>struct &media-pad-desc;</entry>152<entry><structfield>sink</structfield></entry>153<entry>Pad at the target of this link.</entry>154</row>155<row>156<entry>__u32</entry>157<entry><structfield>flags</structfield></entry>158<entry>Link flags, see <xref linkend="media-link-flag" /> for more details.</entry>159</row>160</tbody>161</tgroup>162</table>163164<table frame="none" pgwide="1" id="media-link-flag">165<title>Media link flags</title>166<tgroup cols="2">167<colspec colname="c1"/>168<colspec colname="c2"/>169<tbody valign="top">170<row>171<entry><constant>MEDIA_LNK_FL_ENABLED</constant></entry>172<entry>The link is enabled and can be used to transfer media data.173When two or more links target a sink pad, only one of them can be174enabled at a time.</entry>175</row>176<row>177<entry><constant>MEDIA_LNK_FL_IMMUTABLE</constant></entry>178<entry>The link enabled state can't be modified at runtime. An179immutable link is always enabled.</entry>180</row>181<row>182<entry><constant>MEDIA_LNK_FL_DYNAMIC</constant></entry>183<entry>The link enabled state can be modified during streaming. This184flag is set by drivers and is read-only for applications.</entry>185</row>186</tbody>187</tgroup>188</table>189<para>One and only one of <constant>MEDIA_PAD_FL_SINK</constant> and190<constant>MEDIA_PAD_FL_SOURCE</constant> must be set for every pad.</para>191</refsect1>192193<refsect1>194&return-value;195196<variablelist>197<varlistentry>198<term><errorcode>EINVAL</errorcode></term>199<listitem>200<para>The &media-links-enum; <structfield>id</structfield> references201a non-existing entity.</para>202</listitem>203</varlistentry>204</variablelist>205</refsect1>206</refentry>207208209