Repository URL to install this package:
Version:
7:2.7.1-1ubuntu3 ▾
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>FFmpeg: I/O Read/Write</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">FFmpeg
 <span id="projectnumber">2.7.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#files">Files</a> </div>
<div class="headertitle">
<div class="title">I/O Read/Write</div> </div>
<div class="ingroups"><a class="el" href="group__libavf.html">I/O and Muxing/Demuxing Library</a></div></div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="files"></a>
Files</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">file  </td><td class="memItemRight" valign="bottom"><a class="el" href="avio_8h.html">avio.h</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><p>Buffered I/O operations. </p>
<br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<h2><a class="anchor" id="lavf_io_dirlist"></a>
Directory listing</h2>
<p>The directory listing API makes it possible to list files on remote servers.</p>
<p>Some of possible use cases:</p>
<ul>
<li>an "open file" dialog to choose files from a remote location,</li>
<li>a recursive media finder providing a player with an ability to play all files from a given directory.</li>
</ul>
<h3><a class="anchor" id="lavf_io_dirlist_open"></a>
Opening a directory</h3>
<p>At first, a directory needs to be opened by calling <a class="el" href="avio_8h.html#a7bb596b33ba395e488af6c0c21ca00d5" title="Open directory for reading.">avio_open_dir()</a> supplied with a URL and, optionally, <a class="el" href="group__lavu__dict.html#ga1d7cc0833bee918994a600556410315f">AVDictionary</a> containing protocol-specific parameters. The function returns zero or positive integer and allocates <a class="el" href="structAVIODirContext.html">AVIODirContext</a> on success.</p>
<div class="fragment"><pre class="fragment"> <a class="code" href="structAVIODirContext.html">AVIODirContext</a> *ctx = NULL;
<span class="keywordflow">if</span> (<a class="code" href="avio_8h.html#a7bb596b33ba395e488af6c0c21ca00d5" title="Open directory for reading.">avio_open_dir</a>(&ctx, <span class="stringliteral">"smb://example.com/some_dir"</span>, NULL) < 0) {
fprintf(stderr, <span class="stringliteral">"Cannot open directory.\n"</span>);
abort();
}
</pre></div><p>This code tries to open a sample directory using smb protocol without any additional parameters.</p>
<h3><a class="anchor" id="lavf_io_dirlist_read"></a>
Reading entries</h3>
<p>Each directory's entry (i.e. file, another directory, anything else within <a class="el" href="avio_8h.html#ae8a759e02fd6f14d13511b0e2acbf8fa" title="Directory entry types.">AVIODirEntryType</a>) is represented by <a class="el" href="structAVIODirEntry.html" title="Describes single entry of the directory.">AVIODirEntry</a>. Reading consecutive entries from an opened <a class="el" href="structAVIODirContext.html">AVIODirContext</a> is done by repeatedly calling <a class="el" href="avio_8h.html#addb214cfa43621ca164b14d9932af2bb" title="Get next directory entry.">avio_read_dir()</a> on it. Each call returns zero or positive integer if successful. Reading can be stopped right after the NULL entry has been read -- it means there are no entries left to be read. The following code reads all entries from a directory associated with ctx and prints their names to standard output. </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="structAVIODirEntry.html" title="Describes single entry of the directory.">AVIODirEntry</a> *entry = NULL;
<span class="keywordflow">for</span> (;;) {
<span class="keywordflow">if</span> (<a class="code" href="avio_8h.html#addb214cfa43621ca164b14d9932af2bb" title="Get next directory entry.">avio_read_dir</a>(ctx, &entry) < 0) {
fprintf(stderr, <span class="stringliteral">"Cannot list directory.\n"</span>);
abort();
}
<span class="keywordflow">if</span> (!entry)
<span class="keywordflow">break</span>;
printf(<span class="stringliteral">"%s\n"</span>, entry-><a class="code" href="structAVIODirEntry.html#ac318bb2fb814386a2c8b9f8810150968" title="Filename.">name</a>);
<a class="code" href="avio_8h.html#aa0b5fe2c2243b25f770b1049a710861f" title="Free entry allocated by avio_read_dir().">avio_free_directory_entry</a>(&entry);
}
</pre></div> </div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Defines</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>