Repository URL to install this package:
|
Version:
8:3.0.2-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"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>FFmpeg: doc/examples/demuxing_decoding.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<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">3.0.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<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 class="current"><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 id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<!-- 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>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</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>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_e68e8157741866f444e17edd764ebbae.html">doc</a></li><li class="navelem"><a class="el" href="dir_687bdf86e8e626c2168c3a2d1c125116.html">examples</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">demuxing_decoding.c</div> </div>
</div><!--header-->
<div class="contents">
<a href="demuxing__decoding_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 2012 Stefano Sabatini</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a copy</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * of this software and associated documentation files (the "Software"), to deal</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * in the Software without restriction, including without limitation the rights</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * copies of the Software, and to permit persons to whom the Software is</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * furnished to do so, subject to the following conditions:</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * The above copyright notice and this permission notice shall be included in</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * all copies or substantial portions of the Software.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * THE SOFTWARE.</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"></span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment">/**</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment"> * @file</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment"> * Demuxing and decoding example.</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"> * Show how to use the libavformat and libavcodec API to demux and</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="comment"> * decode audio and video data.</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="comment"> * @example demuxing_decoding.c</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include <<a class="code" href="imgutils_8h.html">libavutil/imgutils.h</a>></span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#include <<a class="code" href="samplefmt_8h.html">libavutil/samplefmt.h</a>></span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include <<a class="code" href="timestamp_8h.html">libavutil/timestamp.h</a>></span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="preprocessor">#include <<a class="code" href="avformat_8h.html">libavformat/avformat.h</a>></span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> </div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a409462acdf7aebe5bfbe1bcd811efa5d"> 37</a></span> <span class="keyword">static</span> <a class="code" href="structAVFormatContext.html">AVFormatContext</a> *<a class="code" href="demuxing__decoding_8c.html#a409462acdf7aebe5bfbe1bcd811efa5d">fmt_ctx</a> = NULL;</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a2e10f5f24d4c8dd311b8eedc376accf5"> 38</a></span> <span class="keyword">static</span> <a class="code" href="structAVCodecContext.html">AVCodecContext</a> *<a class="code" href="demuxing__decoding_8c.html#a2e10f5f24d4c8dd311b8eedc376accf5">video_dec_ctx</a> = NULL, *<a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a>;</div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4"> 39</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>;</div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135"> 40</a></span> <span class="keyword">static</span> <span class="keyword">enum</span> <a class="code" href="pixfmt_8h.html#a9a8e335cf3be472042bc9f0cf80cd4c5">AVPixelFormat</a> <a class="code" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a>;</div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a9decdb9a2529baa6bd2a855a12f1f0fc"> 41</a></span> <span class="keyword">static</span> <a class="code" href="structAVStream.html">AVStream</a> *<a class="code" href="demuxing__decoding_8c.html#a9decdb9a2529baa6bd2a855a12f1f0fc">video_stream</a> = NULL, *<a class="code" href="demuxing__decoding_8c.html#ab269038fe8cd6f8fa4ccec9eaf939345">audio_stream</a> = NULL;</div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1"> 42</a></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a> = NULL;</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5"> 43</a></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5">video_dst_filename</a> = NULL;</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467"> 44</a></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467">audio_dst_filename</a> = NULL;</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3"> 45</a></span> <span class="keyword">static</span> FILE *<a class="code" href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3">video_dst_file</a> = NULL;</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6"> 46</a></span> <span class="keyword">static</span> FILE *<a class="code" href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6">audio_dst_file</a> = NULL;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a0b39e94f88658412ecadb5e2116baccc"> 48</a></span> <span class="keyword">static</span> uint8_t *<a class="code" href="demuxing__decoding_8c.html#a0b39e94f88658412ecadb5e2116baccc">video_dst_data</a>[4] = {NULL};</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a8dbcd4dc85b9345bde18395026d0ffe4"> 49</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a8dbcd4dc85b9345bde18395026d0ffe4">video_dst_linesize</a>[4];</div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a849609cb135f2d344ff03e99610b43df"> 50</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a849609cb135f2d344ff03e99610b43df">video_dst_bufsize</a>;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11"> 52</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11">video_stream_idx</a> = -1, <a class="code" href="demuxing__decoding_8c.html#a16cd83c72f483b9fa2844c5516452798">audio_stream_idx</a> = -1;</div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#ad7d33d579a8d4241a5e643e39287a209"> 53</a></span> <span class="keyword">static</span> <a class="code" href="structAVFrame.html">AVFrame</a> *<a class="code" href="demuxing__decoding_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a> = NULL;</div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a3d4c6562f0b27cf0cacbbea5c038c090"> 54</a></span> <span class="keyword">static</span> <a class="code" href="structAVPacket.html">AVPacket</a> <a class="code" href="demuxing__decoding_8c.html#a3d4c6562f0b27cf0cacbbea5c038c090">pkt</a>;</div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#ac9f496a4d3575928c5b94568bbedd753"> 55</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#ac9f496a4d3575928c5b94568bbedd753">video_frame_count</a> = 0;</div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a48eccd48ea840bc45254f44995320463"> 56</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a48eccd48ea840bc45254f44995320463">audio_frame_count</a> = 0;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="comment">/* Enable or disable frame reference counting. You are not supposed to support</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="comment"> * both paths in your application but pick the one most appropriate to your</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="comment"> * needs. Look for the use of refcount in this example to see what are the</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> <span class="comment"> * differences of API usage between them. */</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a6022c8a609170c7365fb96e83cb2df48"> 62</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a6022c8a609170c7365fb96e83cb2df48">refcount</a> = 0;</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span> </div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#af8c0388188ed14c6585580b04d960a2c"> 64</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#af8c0388188ed14c6585580b04d960a2c">decode_packet</a>(<span class="keywordtype">int</span> *got_frame, <span class="keywordtype">int</span> cached)</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> {</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordtype">int</span> ret = 0;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordtype">int</span> decoded = pkt.<a class="code" href="structAVPacket.html#a4d1ea19f63eb107111fd650ca514d1f4">size</a>;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> </div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  *got_frame = 0;</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">if</span> (pkt.<a class="code" href="structAVPacket.html#a0d1cb9b5a32b00fb6edc81ea3aae2a49">stream_index</a> == <a class="code" href="demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11">video_stream_idx</a>) {</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="comment">/* decode video frame */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  ret = <a class="code" href="group__lavc__decoding.html#ga99ee61b6dcffb7817a275d39da58cc74">avcodec_decode_video2</a>(video_dec_ctx, frame, got_frame, &pkt);</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keywordflow">if</span> (ret < 0) {</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  fprintf(stderr, <span class="stringliteral">"Error decoding video frame (%s)\n"</span>, <a class="code" href="group__lavu__error.html#gac4f6e109c242c81aeee21868d3f35e12">av_err2str</a>(ret));</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  }</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">if</span> (*got_frame) {</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordflow">if</span> (frame-><a class="code" href="structAVFrame.html#a1e71ce60cedd5f3b6811714a9f7f9e0a">width</a> != <a class="code" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a> || frame-><a class="code" href="structAVFrame.html#a3f89733f429c98ba5bc64373fb0a3f13">height</a> != <a class="code" href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a> ||</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  frame-><a class="code" href="structAVFrame.html#aed14fa772ce46881020fd1545c86432c">format</a> != <a class="code" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a>) {</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="comment">/* To handle this change, one could call av_image_alloc again and</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="comment"> * decode the following frames into another rawvideo file. */</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  fprintf(stderr, <span class="stringliteral">"Error: Width, height and pixel format have to be "</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="stringliteral">"constant in a rawvideo file, but the width, height or "</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="stringliteral">"pixel format of the input video changed:\n"</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="stringliteral">"old: width = %d, height = %d, format = %s\n"</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="stringliteral">"new: width = %d, height = %d, format = %s\n"</span>,</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <a class="code" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>, <a class="code" href="pixdesc_8h.html#ab92e2a8a9b58c982560c49df9f01e47e">av_get_pix_fmt_name</a>(<a class="code" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a>),</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  frame-><a class="code" href="structAVFrame.html#a1e71ce60cedd5f3b6811714a9f7f9e0a">width</a>, frame-><a class="code" href="structAVFrame.html#a3f89733f429c98ba5bc64373fb0a3f13">height</a>,</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <a class="code" href="pixdesc_8h.html#ab92e2a8a9b58c982560c49df9f01e47e">av_get_pix_fmt_name</a>(frame-><a class="code" href="structAVFrame.html#aed14fa772ce46881020fd1545c86432c">format</a>));</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  }</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  printf(<span class="stringliteral">"video_frame%s n:%d coded_n:%d pts:%s\n"</span>,</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  cached ? <span class="stringliteral">"(cached)"</span> : <span class="stringliteral">""</span>,</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <a class="code" href="demuxing__decoding_8c.html#ac9f496a4d3575928c5b94568bbedd753">video_frame_count</a>++, frame-><a class="code" href="structAVFrame.html#a02ca9bb7f500d3d850f8736f3cb29c6c">coded_picture_number</a>,</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <a class="code" href="timestamp_8h.html#ad344b91ede6b86fc0a530611293f42da">av_ts2timestr</a>(frame-><a class="code" href="structAVFrame.html#a0452833e3ab6ddd7acbf82817a7818a4">pts</a>, &video_dec_ctx-><a class="code" href="structAVCodecContext.html#ab7bfeb9fa5840aac090e2b0bd0ef7589">time_base</a>));</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="comment">/* copy decoded frame to destination buffer:</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="comment"> * this is required since rawvideo expects non aligned data */</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <a class="code" href="group__lavu__picture.html#ga6b5a267e202daadf81cbde6584055d1e">av_image_copy</a>(<a class="code" href="demuxing__decoding_8c.html#a0b39e94f88658412ecadb5e2116baccc">video_dst_data</a>, <a class="code" href="demuxing__decoding_8c.html#a8dbcd4dc85b9345bde18395026d0ffe4">video_dst_linesize</a>,</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  (<span class="keyword">const</span> uint8_t **)(frame-><a class="code" href="structAVFrame.html#a1d0f65014a8d1bf78cec8cbed2304992">data</a>), frame-><a class="code" href="structAVFrame.html#aa52bfc6605f6a3059a0c3226cc0f6567">linesize</a>,</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <a class="code" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a>, <a class="code" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>);</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> </div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="comment">/* write to rawvideo file */</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  fwrite(<a class="code" href="demuxing__decoding_8c.html#a0b39e94f88658412ecadb5e2116baccc">video_dst_data</a>[0], 1, <a class="code" href="demuxing__decoding_8c.html#a849609cb135f2d344ff03e99610b43df">video_dst_bufsize</a>, <a class="code" href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3">video_dst_file</a>);</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  }</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pkt.<a class="code" href="structAVPacket.html#a0d1cb9b5a32b00fb6edc81ea3aae2a49">stream_index</a> == <a class="code" href="demuxing__decoding_8c.html#a16cd83c72f483b9fa2844c5516452798">audio_stream_idx</a>) {</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="comment">/* decode audio frame */</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  ret = <a class="code" href="group__lavc__decoding.html#ga834bb1b062fbcc2de4cf7fb93f154a3e">avcodec_decode_audio4</a>(<a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a>, frame, got_frame, &pkt);</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">if</span> (ret < 0) {</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  fprintf(stderr, <span class="stringliteral">"Error decoding audio frame (%s)\n"</span>, <a class="code" href="group__lavu__error.html#gac4f6e109c242c81aeee21868d3f35e12">av_err2str</a>(ret));</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  }</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="comment">/* Some audio decoders decode only part of the packet, and have to be</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> <span class="comment"> * called again with the remainder of the packet data.</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="comment"> * Sample: fate-suite/lossless-audio/luckynight-partial.shn</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <span class="comment"> * Also, some decoders might over-read the packet. */</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  decoded = <a class="code" href="common_8h.html#a0f84cbd7fd810cd678157c98cbfad4b0">FFMIN</a>(ret, pkt.<a class="code" href="structAVPacket.html#a4d1ea19f63eb107111fd650ca514d1f4">size</a>);</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">if</span> (*got_frame) {</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordtype">size_t</span> unpadded_linesize = frame-><a class="code" href="structAVFrame.html#a02f45ab8191aea1660159f1e464237ea">nb_samples</a> * <a class="code" href="group__lavu__sampfmts.html#ga0c3c218e1dd570ad4917c69a35a6c77d">av_get_bytes_per_sample</a>(frame-><a class="code" href="structAVFrame.html#aed14fa772ce46881020fd1545c86432c">format</a>);</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  printf(<span class="stringliteral">"audio_frame%s n:%d nb_samples:%d pts:%s\n"</span>,</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  cached ? <span class="stringliteral">"(cached)"</span> : <span class="stringliteral">""</span>,</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <a class="code" href="demuxing__decoding_8c.html#a48eccd48ea840bc45254f44995320463">audio_frame_count</a>++, frame-><a class="code" href="structAVFrame.html#a02f45ab8191aea1660159f1e464237ea">nb_samples</a>,</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <a class="code" href="timestamp_8h.html#ad344b91ede6b86fc0a530611293f42da">av_ts2timestr</a>(frame-><a class="code" href="structAVFrame.html#a0452833e3ab6ddd7acbf82817a7818a4">pts</a>, &<a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a>-><a class="code" href="structAVCodecContext.html#ab7bfeb9fa5840aac090e2b0bd0ef7589">time_base</a>));</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="comment">/* Write the raw audio data samples of the first plane. This works</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="comment"> * fine for packed formats (e.g. AV_SAMPLE_FMT_S16). However,</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="comment"> * most audio decoders output planar audio, which uses a separate</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="comment"> * plane of audio samples for each channel (e.g. AV_SAMPLE_FMT_S16P).</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span> <span class="comment"> * In other words, this code will write only the first audio channel</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span> <span class="comment"> * in these cases.</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span> <span class="comment"> * You should use libswresample or libavfilter to convert the frame</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> <span class="comment"> * to packed data. */</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  fwrite(frame-><a class="code" href="structAVFrame.html#afca04d808393822625e09b5ba91c6756">extended_data</a>[0], 1, unpadded_linesize, <a class="code" href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6">audio_dst_file</a>);</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  }</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  }</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span> </div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="comment">/* If we use frame reference counting, we own the data and need</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span> <span class="comment"> * to de-reference it when we don't use it anymore */</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keywordflow">if</span> (*got_frame && <a class="code" href="demuxing__decoding_8c.html#a6022c8a609170c7365fb96e83cb2df48">refcount</a>)</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <a class="code" href="group__lavu__frame.html#ga0a2b687f9c1c5ed0089b01fd61227108">av_frame_unref</a>(frame);</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordflow">return</span> decoded;</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span> }</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span> </div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a85e44b1a7e74c90b84b2298caefb5f73"> 150</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a85e44b1a7e74c90b84b2298caefb5f73">open_codec_context</a>(<span class="keywordtype">int</span> *stream_idx,</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <a class="code" href="structAVFormatContext.html">AVFormatContext</a> *fmt_ctx, <span class="keyword">enum</span> <a class="code" href="group__lavu__misc.html#ga9a84bba4713dfced21a1a56163be1f48">AVMediaType</a> type)</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span> {</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <span class="keywordtype">int</span> ret, stream_index;</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <a class="code" href="structAVStream.html">AVStream</a> *st;</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <a class="code" href="structAVCodecContext.html">AVCodecContext</a> *<a class="code" href="filtering__audio_8c.html#ac2bf6798f37e95d3d2ff2d44e4ab3c12">dec_ctx</a> = NULL;</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <a class="code" href="structAVCodec.html">AVCodec</a> *dec = NULL;</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <a class="code" href="group__lavu__dict.html#ga1d7cc0833bee918994a600556410315f">AVDictionary</a> *opts = NULL;</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  ret = <a class="code" href="group__lavf__decoding.html#gaa6fa468c922ff5c60a6021dcac09aff9">av_find_best_stream</a>(fmt_ctx, type, -1, -1, NULL, 0);</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordflow">if</span> (ret < 0) {</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  fprintf(stderr, <span class="stringliteral">"Could not find %s stream in input file '%s'\n"</span>,</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <a class="code" href="group__lavu__misc.html#gaf21645cfa855b2caf9699d7dc7b2d08e">av_get_media_type_string</a>(type), <a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a>);</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  stream_index = ret;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  st = fmt_ctx-><a class="code" href="structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348">streams</a>[stream_index];</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span> </div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="comment">/* find decoder for the stream */</span></div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  dec_ctx = st-><a class="code" href="structAVStream.html#a56f20051fb99339cc588cd3a07ab8c96">codec</a>;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  dec = <a class="code" href="group__lavc__decoding.html#ga19a0ca553277f019dd5b0fec6e1f9dca">avcodec_find_decoder</a>(dec_ctx-><a class="code" href="structAVCodecContext.html#adc5f65d6099fd8339c1580c091777223">codec_id</a>);</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">if</span> (!dec) {</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  fprintf(stderr, <span class="stringliteral">"Failed to find %s codec\n"</span>,</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <a class="code" href="group__lavu__misc.html#gaf21645cfa855b2caf9699d7dc7b2d08e">av_get_media_type_string</a>(type));</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <span class="keywordflow">return</span> <a class="code" href="group__lavu__error.html#gae4bb6f165973d09584e0ec0f335f69ca">AVERROR</a>(EINVAL);</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  }</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span> </div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="comment">/* Init the decoders, with or without reference counting */</span></div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <a class="code" href="group__lavu__dict.html#ga8d9c2de72b310cef8e6a28c9cd3acbbe">av_dict_set</a>(&opts, <span class="stringliteral">"refcounted_frames"</span>, <a class="code" href="demuxing__decoding_8c.html#a6022c8a609170c7365fb96e83cb2df48">refcount</a> ? <span class="stringliteral">"1"</span> : <span class="stringliteral">"0"</span>, 0);</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">if</span> ((ret = <a class="code" href="group__lavc__core.html#ga11f785a188d7d9df71621001465b0f1d">avcodec_open2</a>(dec_ctx, dec, &opts)) < 0) {</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  fprintf(stderr, <span class="stringliteral">"Failed to open %s codec\n"</span>,</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <a class="code" href="group__lavu__misc.html#gaf21645cfa855b2caf9699d7dc7b2d08e">av_get_media_type_string</a>(type));</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="keywordflow">return</span> ret;</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  }</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  *stream_idx = stream_index;</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  }</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span> </div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span> }</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span> </div>
<div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a5e068fc5e6dc5c59638ec235f7f6db89"> 190</a></span> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a5e068fc5e6dc5c59638ec235f7f6db89">get_format_from_sample_fmt</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> **fmt,</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keyword">enum</span> <a class="code" href="group__lavu__sampfmts.html#gaf9a51ca15301871723577c730b5865c5">AVSampleFormat</a> sample_fmt)</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span> {</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keywordtype">int</span> i;</div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keyword">struct </span>sample_fmt_entry {</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keyword">enum</span> <a class="code" href="group__lavu__sampfmts.html#gaf9a51ca15301871723577c730b5865c5">AVSampleFormat</a> sample_fmt; <span class="keyword">const</span> <span class="keywordtype">char</span> *fmt_be, *fmt_le;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  } sample_fmt_entries[] = {</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  { <a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5adf0f66f21492f8fd5db6debb8b3f932a">AV_SAMPLE_FMT_U8</a>, <span class="stringliteral">"u8"</span>, <span class="stringliteral">"u8"</span> },</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  { <a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5aea6132df57aebc3f76e10665395c46af">AV_SAMPLE_FMT_S16</a>, <span class="stringliteral">"s16be"</span>, <span class="stringliteral">"s16le"</span> },</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  { <a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5ab7ae6bb6718c07cd316778783a57a63b">AV_SAMPLE_FMT_S32</a>, <span class="stringliteral">"s32be"</span>, <span class="stringliteral">"s32le"</span> },</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  { <a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5a5251d62cc3c7f18e56bc8e0c48a27903">AV_SAMPLE_FMT_FLT</a>, <span class="stringliteral">"f32be"</span>, <span class="stringliteral">"f32le"</span> },</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  { <a class="code" href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5ae35a2a6a7593723d9fe4bcefb2876606">AV_SAMPLE_FMT_DBL</a>, <span class="stringliteral">"f64be"</span>, <span class="stringliteral">"f64le"</span> },</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  };</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  *fmt = NULL;</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span> </div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="common_8h.html#a3508a98d3ee7e2c9a4841fe264cf70f7">FF_ARRAY_ELEMS</a>(sample_fmt_entries); i++) {</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  <span class="keyword">struct </span>sample_fmt_entry *entry = &sample_fmt_entries[i];</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="keywordflow">if</span> (sample_fmt == entry->sample_fmt) {</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  *fmt = <a class="code" href="common_8h.html#a309bdca20f6a78431379fc69442d98ea">AV_NE</a>(entry->fmt_be, entry->fmt_le);</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  }</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  }</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span> </div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  fprintf(stderr,</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="stringliteral">"sample format %s is not supported as output format\n"</span>,</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <a class="code" href="group__lavu__sampfmts.html#ga31b9d149b2de9821a65f4f5612970838">av_get_sample_fmt_name</a>(sample_fmt));</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span> }</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span> </div>
<div class="line"><a name="l00219"></a><span class="lineno"><a class="line" href="demuxing__decoding_8c.html#a3c04138a5bfe5d72780bb7e82a18e627"> 219</a></span> <span class="keywordtype">int</span> <a class="code" href="demuxing__decoding_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span> {</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <span class="keywordtype">int</span> ret = 0, got_frame;</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <span class="keywordflow">if</span> (argc != 4 && argc != 5) {</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  fprintf(stderr, <span class="stringliteral">"usage: %s [-refcount] input_file video_output_file audio_output_file\n"</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <span class="stringliteral">"API example program to show how to read frames from an input file.\n"</span></div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  <span class="stringliteral">"This program reads frames from a file, decodes them, and writes decoded\n"</span></div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="stringliteral">"video frames to a rawvideo file named video_output_file, and decoded\n"</span></div>
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="stringliteral">"audio frames to a rawaudio file named audio_output_file.\n\n"</span></div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="stringliteral">"If the -refcount option is specified, the program use the\n"</span></div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="stringliteral">"reference counting frame system which allows keeping a copy of\n"</span></div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <span class="stringliteral">"the data for longer than one decode call.\n"</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="stringliteral">"\n"</span>, argv[0]);</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  exit(1);</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  }</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordflow">if</span> (argc == 5 && !strcmp(argv[1], <span class="stringliteral">"-refcount"</span>)) {</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <a class="code" href="demuxing__decoding_8c.html#a6022c8a609170c7365fb96e83cb2df48">refcount</a> = 1;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  argv++;</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  }</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a> = argv[1];</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <a class="code" href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5">video_dst_filename</a> = argv[2];</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  <a class="code" href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467">audio_dst_filename</a> = argv[3];</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span> </div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <span class="comment">/* register all formats and codecs */</span></div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  <a class="code" href="group__lavf__core.html#ga917265caec45ef5a0646356ed1a507e3">av_register_all</a>();</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span> </div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="comment">/* open input file, and allocate format context */</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  <span class="keywordflow">if</span> (<a class="code" href="group__lavf__decoding.html#ga31d601155e9035d5b0e7efedc894ee49">avformat_open_input</a>(&fmt_ctx, <a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a>, NULL, NULL) < 0) {</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  fprintf(stderr, <span class="stringliteral">"Could not open source file %s\n"</span>, <a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a>);</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  exit(1);</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  }</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span> </div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <span class="comment">/* retrieve stream information */</span></div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordflow">if</span> (<a class="code" href="group__lavf__decoding.html#gad42172e27cddafb81096939783b157bb">avformat_find_stream_info</a>(fmt_ctx, NULL) < 0) {</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  fprintf(stderr, <span class="stringliteral">"Could not find stream information\n"</span>);</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  exit(1);</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  }</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span> </div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <span class="keywordflow">if</span> (<a class="code" href="demuxing__decoding_8c.html#a85e44b1a7e74c90b84b2298caefb5f73">open_codec_context</a>(&<a class="code" href="demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11">video_stream_idx</a>, fmt_ctx, <a class="code" href="group__lavu__misc.html#gga9a84bba4713dfced21a1a56163be1f48ac1a46f59be5c6c2d3412ab172d6b8cf5">AVMEDIA_TYPE_VIDEO</a>) >= 0) {</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  video_stream = fmt_ctx-><a class="code" href="structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348">streams</a>[<a class="code" href="demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11">video_stream_idx</a>];</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  video_dec_ctx = video_stream-><a class="code" href="structAVStream.html#a56f20051fb99339cc588cd3a07ab8c96">codec</a>;</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span> </div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <a class="code" href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3">video_dst_file</a> = fopen(<a class="code" href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5">video_dst_filename</a>, <span class="stringliteral">"wb"</span>);</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keywordflow">if</span> (!<a class="code" href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3">video_dst_file</a>) {</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  fprintf(stderr, <span class="stringliteral">"Could not open destination file %s\n"</span>, <a class="code" href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5">video_dst_filename</a>);</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  ret = 1;</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  <span class="keywordflow">goto</span> end;</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  }</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span> </div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <span class="comment">/* allocate image where the decoded image will be put */</span></div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <a class="code" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a> = video_dec_ctx-><a class="code" href="structAVCodecContext.html#a0d8f46461754e8abea0847dcbc41b956">width</a>;</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <a class="code" href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a> = video_dec_ctx-><a class="code" href="structAVCodecContext.html#a0449afd803eb107bd4dbc8b5ea22e363">height</a>;</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <a class="code" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a> = video_dec_ctx-><a class="code" href="structAVCodecContext.html#a0425c77b3d06d71e5db88b1d7e1b37f2">pix_fmt</a>;</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  ret = <a class="code" href="group__lavu__picture.html#ga841e0a89a642e24141af1918a2c10448">av_image_alloc</a>(<a class="code" href="demuxing__decoding_8c.html#a0b39e94f88658412ecadb5e2116baccc">video_dst_data</a>, <a class="code" href="demuxing__decoding_8c.html#a8dbcd4dc85b9345bde18395026d0ffe4">video_dst_linesize</a>,</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <a class="code" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>, <a class="code" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a>, 1);</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <span class="keywordflow">if</span> (ret < 0) {</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  fprintf(stderr, <span class="stringliteral">"Could not allocate raw video buffer\n"</span>);</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  <span class="keywordflow">goto</span> end;</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  }</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  <a class="code" href="demuxing__decoding_8c.html#a849609cb135f2d344ff03e99610b43df">video_dst_bufsize</a> = ret;</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  }</div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span> </div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <span class="keywordflow">if</span> (<a class="code" href="demuxing__decoding_8c.html#a85e44b1a7e74c90b84b2298caefb5f73">open_codec_context</a>(&<a class="code" href="demuxing__decoding_8c.html#a16cd83c72f483b9fa2844c5516452798">audio_stream_idx</a>, fmt_ctx, <a class="code" href="group__lavu__misc.html#gga9a84bba4713dfced21a1a56163be1f48a7b4e33b8f30ac94d34ce8d9f7c33927a">AVMEDIA_TYPE_AUDIO</a>) >= 0) {</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <a class="code" href="demuxing__decoding_8c.html#ab269038fe8cd6f8fa4ccec9eaf939345">audio_stream</a> = fmt_ctx-><a class="code" href="structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348">streams</a>[<a class="code" href="demuxing__decoding_8c.html#a16cd83c72f483b9fa2844c5516452798">audio_stream_idx</a>];</div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a> = <a class="code" href="demuxing__decoding_8c.html#ab269038fe8cd6f8fa4ccec9eaf939345">audio_stream</a>-><a class="code" href="structAVStream.html#a56f20051fb99339cc588cd3a07ab8c96">codec</a>;</div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <a class="code" href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6">audio_dst_file</a> = fopen(<a class="code" href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467">audio_dst_filename</a>, <span class="stringliteral">"wb"</span>);</div>
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <span class="keywordflow">if</span> (!<a class="code" href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6">audio_dst_file</a>) {</div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  fprintf(stderr, <span class="stringliteral">"Could not open destination file %s\n"</span>, <a class="code" href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467">audio_dst_filename</a>);</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  ret = 1;</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <span class="keywordflow">goto</span> end;</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  }</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  }</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span> </div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  <span class="comment">/* dump input information to stderr */</span></div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  <a class="code" href="group__lavf__misc.html#gae2645941f2dc779c307eb6314fd39f10">av_dump_format</a>(fmt_ctx, 0, <a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a>, 0);</div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span> </div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <span class="keywordflow">if</span> (!<a class="code" href="demuxing__decoding_8c.html#ab269038fe8cd6f8fa4ccec9eaf939345">audio_stream</a> && !video_stream) {</div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  fprintf(stderr, <span class="stringliteral">"Could not find audio or video stream in the input, aborting\n"</span>);</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  ret = 1;</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <span class="keywordflow">goto</span> end;</div>
<div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  }</div>
<div class="line"><a name="l00301"></a><span class="lineno"> 301</span> </div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  frame = <a class="code" href="group__lavu__frame.html#gac700017c5270c79c1e1befdeeb008b2f">av_frame_alloc</a>();</div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <span class="keywordflow">if</span> (!frame) {</div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  fprintf(stderr, <span class="stringliteral">"Could not allocate frame\n"</span>);</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  ret = <a class="code" href="group__lavu__error.html#gae4bb6f165973d09584e0ec0f335f69ca">AVERROR</a>(ENOMEM);</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  <span class="keywordflow">goto</span> end;</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  }</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span> </div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="comment">/* initialize packet, set data to NULL, let the demuxer fill it */</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  <a class="code" href="group__lavc__packet.html#gac9cb9756175b96e7441575803757fb73">av_init_packet</a>(&pkt);</div>
<div class="line"><a name="l00311"></a><span class="lineno"> 311</span>  pkt.<a class="code" href="structAVPacket.html#aaf4fe58dfcc7c232c1f2268b539d8367">data</a> = NULL;</div>
<div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  pkt.<a class="code" href="structAVPacket.html#a4d1ea19f63eb107111fd650ca514d1f4">size</a> = 0;</div>
<div class="line"><a name="l00313"></a><span class="lineno"> 313</span> </div>
<div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  <span class="keywordflow">if</span> (video_stream)</div>
<div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  printf(<span class="stringliteral">"Demuxing video from file '%s' into '%s'\n"</span>, <a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a>, <a class="code" href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5">video_dst_filename</a>);</div>
<div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  <span class="keywordflow">if</span> (<a class="code" href="demuxing__decoding_8c.html#ab269038fe8cd6f8fa4ccec9eaf939345">audio_stream</a>)</div>
<div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  printf(<span class="stringliteral">"Demuxing audio from file '%s' into '%s'\n"</span>, <a class="code" href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a>, <a class="code" href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467">audio_dst_filename</a>);</div>
<div class="line"><a name="l00318"></a><span class="lineno"> 318</span> </div>
<div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  <span class="comment">/* read frames from the file */</span></div>
<div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  <span class="keywordflow">while</span> (<a class="code" href="group__lavf__decoding.html#ga4fdb3084415a82e3810de6ee60e46a61">av_read_frame</a>(fmt_ctx, &pkt) >= 0) {</div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span>  <a class="code" href="structAVPacket.html">AVPacket</a> orig_pkt = <a class="code" href="demuxing__decoding_8c.html#a3d4c6562f0b27cf0cacbbea5c038c090">pkt</a>;</div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span>  <span class="keywordflow">do</span> {</div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  ret = <a class="code" href="demuxing__decoding_8c.html#af8c0388188ed14c6585580b04d960a2c">decode_packet</a>(&got_frame, 0);</div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  <span class="keywordflow">if</span> (ret < 0)</div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  pkt.<a class="code" href="structAVPacket.html#aaf4fe58dfcc7c232c1f2268b539d8367">data</a> += ret;</div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  pkt.<a class="code" href="structAVPacket.html#a4d1ea19f63eb107111fd650ca514d1f4">size</a> -= ret;</div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  } <span class="keywordflow">while</span> (pkt.<a class="code" href="structAVPacket.html#a4d1ea19f63eb107111fd650ca514d1f4">size</a> > 0);</div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <a class="code" href="group__lavc__packet.html#ga63d5a489b419bd5d45cfd09091cbcbc2">av_packet_unref</a>(&orig_pkt);</div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  }</div>
<div class="line"><a name="l00331"></a><span class="lineno"> 331</span> </div>
<div class="line"><a name="l00332"></a><span class="lineno"> 332</span>  <span class="comment">/* flush cached frames */</span></div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  pkt.<a class="code" href="structAVPacket.html#aaf4fe58dfcc7c232c1f2268b539d8367">data</a> = NULL;</div>
<div class="line"><a name="l00334"></a><span class="lineno"> 334</span>  pkt.<a class="code" href="structAVPacket.html#a4d1ea19f63eb107111fd650ca514d1f4">size</a> = 0;</div>
<div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keywordflow">do</span> {</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <a class="code" href="demuxing__decoding_8c.html#af8c0388188ed14c6585580b04d960a2c">decode_packet</a>(&got_frame, 1);</div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  } <span class="keywordflow">while</span> (got_frame);</div>
<div class="line"><a name="l00338"></a><span class="lineno"> 338</span> </div>
<div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  printf(<span class="stringliteral">"Demuxing succeeded.\n"</span>);</div>
<div class="line"><a name="l00340"></a><span class="lineno"> 340</span> </div>
<div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  <span class="keywordflow">if</span> (video_stream) {</div>
<div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  printf(<span class="stringliteral">"Play the output video file with the command:\n"</span></div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  <span class="stringliteral">"ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n"</span>,</div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <a class="code" href="pixdesc_8h.html#ab92e2a8a9b58c982560c49df9f01e47e">av_get_pix_fmt_name</a>(<a class="code" href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a>), <a class="code" href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a>,</div>
<div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  <a class="code" href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5">video_dst_filename</a>);</div>
<div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  }</div>
<div class="line"><a name="l00347"></a><span class="lineno"> 347</span> </div>
<div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  <span class="keywordflow">if</span> (<a class="code" href="demuxing__decoding_8c.html#ab269038fe8cd6f8fa4ccec9eaf939345">audio_stream</a>) {</div>
<div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  <span class="keyword">enum</span> <a class="code" href="group__lavu__sampfmts.html#gaf9a51ca15301871723577c730b5865c5">AVSampleFormat</a> sfmt = <a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a>-><a class="code" href="structAVCodecContext.html#a1bdba69ea111e2a9d03fdaa7a46a4c45">sample_fmt</a>;</div>
<div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <span class="keywordtype">int</span> n_channels = <a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a>-><a class="code" href="structAVCodecContext.html#ac1e6c2cd1269caa7570575725c682a49">channels</a>;</div>
<div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *fmt;</div>
<div class="line"><a name="l00352"></a><span class="lineno"> 352</span> </div>
<div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  <span class="keywordflow">if</span> (<a class="code" href="group__lavu__sampfmts.html#ga06ba8a64dc4382c422789a5d0b6bf592">av_sample_fmt_is_planar</a>(sfmt)) {</div>
<div class="line"><a name="l00354"></a><span class="lineno"> 354</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> *packed = <a class="code" href="group__lavu__sampfmts.html#ga31b9d149b2de9821a65f4f5612970838">av_get_sample_fmt_name</a>(sfmt);</div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  printf(<span class="stringliteral">"Warning: the sample format the decoder produced is planar "</span></div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  <span class="stringliteral">"(%s). This example will output the first channel only.\n"</span>,</div>
<div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  packed ? packed : <span class="stringliteral">"?"</span>);</div>
<div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  sfmt = <a class="code" href="group__lavu__sampfmts.html#ga7817ec0eff4dc6fc0962f31e6d138bca">av_get_packed_sample_fmt</a>(sfmt);</div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  n_channels = 1;</div>
<div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  }</div>
<div class="line"><a name="l00361"></a><span class="lineno"> 361</span> </div>
<div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">if</span> ((ret = <a class="code" href="demuxing__decoding_8c.html#a5e068fc5e6dc5c59638ec235f7f6db89">get_format_from_sample_fmt</a>(&fmt, sfmt)) < 0)</div>
<div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  <span class="keywordflow">goto</span> end;</div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span> </div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  printf(<span class="stringliteral">"Play the output audio file with the command:\n"</span></div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  <span class="stringliteral">"ffplay -f %s -ac %d -ar %d %s\n"</span>,</div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  fmt, n_channels, <a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a>-><a class="code" href="structAVCodecContext.html#a8ff0b000c463361e234af48d03aadfc0">sample_rate</a>,</div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  <a class="code" href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467">audio_dst_filename</a>);</div>
<div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  }</div>
<div class="line"><a name="l00370"></a><span class="lineno"> 370</span> </div>
<div class="line"><a name="l00371"></a><span class="lineno"> 371</span> end:</div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  <a class="code" href="group__lavc__core.html#gaf4daa92361efb3523ef5afeb0b54077f">avcodec_close</a>(video_dec_ctx);</div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <a class="code" href="group__lavc__core.html#gaf4daa92361efb3523ef5afeb0b54077f">avcodec_close</a>(<a class="code" href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a>);</div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  <a class="code" href="group__lavf__decoding.html#gae804b99aec044690162b8b9b110236a4">avformat_close_input</a>(&fmt_ctx);</div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  <span class="keywordflow">if</span> (<a class="code" href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3">video_dst_file</a>)</div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  fclose(<a class="code" href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3">video_dst_file</a>);</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="keywordflow">if</span> (<a class="code" href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6">audio_dst_file</a>)</div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  fclose(<a class="code" href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6">audio_dst_file</a>);</div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  <a class="code" href="group__lavu__frame.html#ga979d73f3228814aee56aeca0636e37cc">av_frame_free</a>(&frame);</div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  <a class="code" href="group__lavu__mem.html#ga0c9096f498624c525aa2315b8a20c411">av_free</a>(<a class="code" href="demuxing__decoding_8c.html#a0b39e94f88658412ecadb5e2116baccc">video_dst_data</a>[0]);</div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span> </div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <span class="keywordflow">return</span> ret < 0;</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span> }</div>
<div class="ttc" id="demuxing__decoding_8c_html_af8c0388188ed14c6585580b04d960a2c"><div class="ttname"><a href="demuxing__decoding_8c.html#af8c0388188ed14c6585580b04d960a2c">decode_packet</a></div><div class="ttdeci">static int decode_packet(int *got_frame, int cached)</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00064">demuxing_decoding.c:64</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a7331e302ea7bb48e0b605a069576e135"><div class="ttname"><a href="demuxing__decoding_8c.html#a7331e302ea7bb48e0b605a069576e135">pix_fmt</a></div><div class="ttdeci">static enum AVPixelFormat pix_fmt</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00040">demuxing_decoding.c:40</a></div></div>
<div class="ttc" id="structAVFrame_html"><div class="ttname"><a href="structAVFrame.html">AVFrame</a></div><div class="ttdoc">This structure describes decoded (raw) audio or video data. </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00181">frame.h:181</a></div></div>
<div class="ttc" id="imgutils_8h_html"><div class="ttname"><a href="imgutils_8h.html">imgutils.h</a></div><div class="ttdoc">misc image utilities </div></div>
<div class="ttc" id="group__lavu__picture_html_ga841e0a89a642e24141af1918a2c10448"><div class="ttname"><a href="group__lavu__picture.html#ga841e0a89a642e24141af1918a2c10448">av_image_alloc</a></div><div class="ttdeci">int av_image_alloc(uint8_t *pointers[4], int linesizes[4], int w, int h, enum AVPixelFormat pix_fmt, int align)</div><div class="ttdoc">Allocate an image with size w and h and pixel format pix_fmt, and fill pointers and linesizes accordi...</div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a409462acdf7aebe5bfbe1bcd811efa5d"><div class="ttname"><a href="demuxing__decoding_8c.html#a409462acdf7aebe5bfbe1bcd811efa5d">fmt_ctx</a></div><div class="ttdeci">static AVFormatContext * fmt_ctx</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00037">demuxing_decoding.c:37</a></div></div>
<div class="ttc" id="structAVPacket_html_a4d1ea19f63eb107111fd650ca514d1f4"><div class="ttname"><a href="structAVPacket.html#a4d1ea19f63eb107111fd650ca514d1f4">AVPacket::size</a></div><div class="ttdeci">int size</div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01468">avcodec.h:1468</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a48eccd48ea840bc45254f44995320463"><div class="ttname"><a href="demuxing__decoding_8c.html#a48eccd48ea840bc45254f44995320463">audio_frame_count</a></div><div class="ttdeci">static int audio_frame_count</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00056">demuxing_decoding.c:56</a></div></div>
<div class="ttc" id="structAVCodecContext_html_a0425c77b3d06d71e5db88b1d7e1b37f2"><div class="ttname"><a href="structAVCodecContext.html#a0425c77b3d06d71e5db88b1d7e1b37f2">AVCodecContext::pix_fmt</a></div><div class="ttdeci">enum AVPixelFormat pix_fmt</div><div class="ttdoc">Pixel format, see AV_PIX_FMT_xxx. </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01752">avcodec.h:1752</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a9decdb9a2529baa6bd2a855a12f1f0fc"><div class="ttname"><a href="demuxing__decoding_8c.html#a9decdb9a2529baa6bd2a855a12f1f0fc">video_stream</a></div><div class="ttdeci">static AVStream * video_stream</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00041">demuxing_decoding.c:41</a></div></div>
<div class="ttc" id="samplefmt_8h_html"><div class="ttname"><a href="samplefmt_8h.html">samplefmt.h</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a3d4c6562f0b27cf0cacbbea5c038c090"><div class="ttname"><a href="demuxing__decoding_8c.html#a3d4c6562f0b27cf0cacbbea5c038c090">pkt</a></div><div class="ttdeci">static AVPacket pkt</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00054">demuxing_decoding.c:54</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ggaf9a51ca15301871723577c730b5865c5a5251d62cc3c7f18e56bc8e0c48a27903"><div class="ttname"><a href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5a5251d62cc3c7f18e56bc8e0c48a27903">AV_SAMPLE_FMT_FLT</a></div><div class="ttdoc">float </div><div class="ttdef"><b>Definition:</b> <a href="samplefmt_8h_source.html#l00064">samplefmt.h:64</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a16cd83c72f483b9fa2844c5516452798"><div class="ttname"><a href="demuxing__decoding_8c.html#a16cd83c72f483b9fa2844c5516452798">audio_stream_idx</a></div><div class="ttdeci">static int audio_stream_idx</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00052">demuxing_decoding.c:52</a></div></div>
<div class="ttc" id="structAVCodec_html"><div class="ttname"><a href="structAVCodec.html">AVCodec</a></div><div class="ttdoc">AVCodec. </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l03392">avcodec.h:3392</a></div></div>
<div class="ttc" id="structAVCodecContext_html_ab7bfeb9fa5840aac090e2b0bd0ef7589"><div class="ttname"><a href="structAVCodecContext.html#ab7bfeb9fa5840aac090e2b0bd0ef7589">AVCodecContext::time_base</a></div><div class="ttdeci">AVRational time_base</div><div class="ttdoc">This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...</div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01661">avcodec.h:1661</a></div></div>
<div class="ttc" id="structAVFormatContext_html"><div class="ttname"><a href="structAVFormatContext.html">AVFormatContext</a></div><div class="ttdoc">Format I/O context. </div><div class="ttdef"><b>Definition:</b> <a href="avformat_8h_source.html#l01314">avformat.h:1314</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_af0d7c67df6575ed6b3b7de4d843ed7a6"><div class="ttname"><a href="demuxing__decoding_8c.html#af0d7c67df6575ed6b3b7de4d843ed7a6">audio_dst_file</a></div><div class="ttdeci">static FILE * audio_dst_file</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00046">demuxing_decoding.c:46</a></div></div>
<div class="ttc" id="structAVCodecContext_html_a1bdba69ea111e2a9d03fdaa7a46a4c45"><div class="ttname"><a href="structAVCodecContext.html#a1bdba69ea111e2a9d03fdaa7a46a4c45">AVCodecContext::sample_fmt</a></div><div class="ttdeci">enum AVSampleFormat sample_fmt</div><div class="ttdoc">audio sample format </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l02295">avcodec.h:2295</a></div></div>
<div class="ttc" id="group__lavu__frame_html_gac700017c5270c79c1e1befdeeb008b2f"><div class="ttname"><a href="group__lavu__frame.html#gac700017c5270c79c1e1befdeeb008b2f">av_frame_alloc</a></div><div class="ttdeci">AVFrame * av_frame_alloc(void)</div><div class="ttdoc">Allocate an AVFrame and set its fields to default values. </div></div>
<div class="ttc" id="demuxing__decoding_8c_html_af35f69f407b98b5244f837e25813bc11"><div class="ttname"><a href="demuxing__decoding_8c.html#af35f69f407b98b5244f837e25813bc11">video_stream_idx</a></div><div class="ttdeci">static int video_stream_idx</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00052">demuxing_decoding.c:52</a></div></div>
<div class="ttc" id="timestamp_8h_html"><div class="ttname"><a href="timestamp_8h.html">timestamp.h</a></div><div class="ttdoc">timestamp utils, mostly useful for debugging/logging purposes </div></div>
<div class="ttc" id="common_8h_html_a309bdca20f6a78431379fc69442d98ea"><div class="ttname"><a href="common_8h.html#a309bdca20f6a78431379fc69442d98ea">AV_NE</a></div><div class="ttdeci">#define AV_NE(be, le)</div><div class="ttdef"><b>Definition:</b> <a href="common_8h_source.html#l00050">common.h:50</a></div></div>
<div class="ttc" id="structAVFrame_html_a0452833e3ab6ddd7acbf82817a7818a4"><div class="ttname"><a href="structAVFrame.html#a0452833e3ab6ddd7acbf82817a7818a4">AVFrame::pts</a></div><div class="ttdeci">int64_t pts</div><div class="ttdoc">Presentation timestamp in time_base units (time when frame should be shown to user). </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00262">frame.h:262</a></div></div>
<div class="ttc" id="structAVFormatContext_html_acfefb6b6cf21e87a0dcbd1a547ba2348"><div class="ttname"><a href="structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348">AVFormatContext::streams</a></div><div class="ttdeci">AVStream ** streams</div><div class="ttdoc">A list of all streams in the file. </div><div class="ttdef"><b>Definition:</b> <a href="avformat_8h_source.html#l01382">avformat.h:1382</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_ad7d33d579a8d4241a5e643e39287a209"><div class="ttname"><a href="demuxing__decoding_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a></div><div class="ttdeci">static AVFrame * frame</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00053">demuxing_decoding.c:53</a></div></div>
<div class="ttc" id="structAVPacket_html_aaf4fe58dfcc7c232c1f2268b539d8367"><div class="ttname"><a href="structAVPacket.html#aaf4fe58dfcc7c232c1f2268b539d8367">AVPacket::data</a></div><div class="ttdeci">uint8_t * data</div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01467">avcodec.h:1467</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a0b39e94f88658412ecadb5e2116baccc"><div class="ttname"><a href="demuxing__decoding_8c.html#a0b39e94f88658412ecadb5e2116baccc">video_dst_data</a></div><div class="ttdeci">static uint8_t * video_dst_data[4]</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00048">demuxing_decoding.c:48</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ggaf9a51ca15301871723577c730b5865c5ab7ae6bb6718c07cd316778783a57a63b"><div class="ttname"><a href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5ab7ae6bb6718c07cd316778783a57a63b">AV_SAMPLE_FMT_S32</a></div><div class="ttdoc">signed 32 bits </div><div class="ttdef"><b>Definition:</b> <a href="samplefmt_8h_source.html#l00063">samplefmt.h:63</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ga06ba8a64dc4382c422789a5d0b6bf592"><div class="ttname"><a href="group__lavu__sampfmts.html#ga06ba8a64dc4382c422789a5d0b6bf592">av_sample_fmt_is_planar</a></div><div class="ttdeci">int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)</div><div class="ttdoc">Check if the sample format is planar. </div></div>
<div class="ttc" id="group__lavf__misc_html_gae2645941f2dc779c307eb6314fd39f10"><div class="ttname"><a href="group__lavf__misc.html#gae2645941f2dc779c307eb6314fd39f10">av_dump_format</a></div><div class="ttdeci">void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)</div><div class="ttdoc">Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base. </div></div>
<div class="ttc" id="group__lavf__decoding_html_gaa6fa468c922ff5c60a6021dcac09aff9"><div class="ttname"><a href="group__lavf__decoding.html#gaa6fa468c922ff5c60a6021dcac09aff9">av_find_best_stream</a></div><div class="ttdeci">int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags)</div><div class="ttdoc">Find the "best" stream in the file. </div></div>
<div class="ttc" id="group__lavc__core_html_gaf4daa92361efb3523ef5afeb0b54077f"><div class="ttname"><a href="group__lavc__core.html#gaf4daa92361efb3523ef5afeb0b54077f">avcodec_close</a></div><div class="ttdeci">int avcodec_close(AVCodecContext *avctx)</div><div class="ttdoc">Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...</div></div>
<div class="ttc" id="structAVFrame_html_a1e71ce60cedd5f3b6811714a9f7f9e0a"><div class="ttname"><a href="structAVFrame.html#a1e71ce60cedd5f3b6811714a9f7f9e0a">AVFrame::width</a></div><div class="ttdeci">int width</div><div class="ttdoc">width and height of the video frame </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00230">frame.h:230</a></div></div>
<div class="ttc" id="group__lavu__mem_html_ga0c9096f498624c525aa2315b8a20c411"><div class="ttname"><a href="group__lavu__mem.html#ga0c9096f498624c525aa2315b8a20c411">av_free</a></div><div class="ttdeci">void av_free(void *ptr)</div><div class="ttdoc">Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...</div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a8dbcd4dc85b9345bde18395026d0ffe4"><div class="ttname"><a href="demuxing__decoding_8c.html#a8dbcd4dc85b9345bde18395026d0ffe4">video_dst_linesize</a></div><div class="ttdeci">static int video_dst_linesize[4]</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00049">demuxing_decoding.c:49</a></div></div>
<div class="ttc" id="group__lavc__decoding_html_ga99ee61b6dcffb7817a275d39da58cc74"><div class="ttname"><a href="group__lavc__decoding.html#ga99ee61b6dcffb7817a275d39da58cc74">avcodec_decode_video2</a></div><div class="ttdeci">int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, const AVPacket *avpkt)</div><div class="ttdoc">Decode the video frame of size avpkt->size from avpkt->data into picture. </div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a9f79f9440c018d4eb8448d849f35f467"><div class="ttname"><a href="demuxing__decoding_8c.html#a9f79f9440c018d4eb8448d849f35f467">audio_dst_filename</a></div><div class="ttdeci">static const char * audio_dst_filename</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00044">demuxing_decoding.c:44</a></div></div>
<div class="ttc" id="group__lavu__error_html_gae4bb6f165973d09584e0ec0f335f69ca"><div class="ttname"><a href="group__lavu__error.html#gae4bb6f165973d09584e0ec0f335f69ca">AVERROR</a></div><div class="ttdeci">#define AVERROR(e)</div><div class="ttdef"><b>Definition:</b> <a href="error_8h_source.html#l00043">error.h:43</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_ab269038fe8cd6f8fa4ccec9eaf939345"><div class="ttname"><a href="demuxing__decoding_8c.html#ab269038fe8cd6f8fa4ccec9eaf939345">audio_stream</a></div><div class="ttdeci">static AVStream * audio_stream</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00041">demuxing_decoding.c:41</a></div></div>
<div class="ttc" id="group__lavu__frame_html_ga979d73f3228814aee56aeca0636e37cc"><div class="ttname"><a href="group__lavu__frame.html#ga979d73f3228814aee56aeca0636e37cc">av_frame_free</a></div><div class="ttdeci">void av_frame_free(AVFrame **frame)</div><div class="ttdoc">Free the frame and any dynamically allocated objects in it, e.g. </div></div>
<div class="ttc" id="timestamp_8h_html_ad344b91ede6b86fc0a530611293f42da"><div class="ttname"><a href="timestamp_8h.html#ad344b91ede6b86fc0a530611293f42da">av_ts2timestr</a></div><div class="ttdeci">#define av_ts2timestr(ts, tb)</div><div class="ttdoc">Convenience macro, the return value should be used only directly in function arguments but never stan...</div><div class="ttdef"><b>Definition:</b> <a href="timestamp_8h_source.html#l00076">timestamp.h:76</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a2e10f5f24d4c8dd311b8eedc376accf5"><div class="ttname"><a href="demuxing__decoding_8c.html#a2e10f5f24d4c8dd311b8eedc376accf5">video_dec_ctx</a></div><div class="ttdeci">static AVCodecContext * video_dec_ctx</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00038">demuxing_decoding.c:38</a></div></div>
<div class="ttc" id="group__lavu__dict_html_ga1d7cc0833bee918994a600556410315f"><div class="ttname"><a href="group__lavu__dict.html#ga1d7cc0833bee918994a600556410315f">AVDictionary</a></div><div class="ttdeci">struct AVDictionary AVDictionary</div><div class="ttdef"><b>Definition:</b> <a href="dict_8h_source.html#l00091">dict.h:91</a></div></div>
<div class="ttc" id="group__lavu__misc_html_gga9a84bba4713dfced21a1a56163be1f48a7b4e33b8f30ac94d34ce8d9f7c33927a"><div class="ttname"><a href="group__lavu__misc.html#gga9a84bba4713dfced21a1a56163be1f48a7b4e33b8f30ac94d34ce8d9f7c33927a">AVMEDIA_TYPE_AUDIO</a></div><div class="ttdef"><b>Definition:</b> <a href="avutil_8h_source.html#l00194">avutil.h:194</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ga31b9d149b2de9821a65f4f5612970838"><div class="ttname"><a href="group__lavu__sampfmts.html#ga31b9d149b2de9821a65f4f5612970838">av_get_sample_fmt_name</a></div><div class="ttdeci">const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)</div><div class="ttdoc">Return the name of sample_fmt, or NULL if sample_fmt is not recognized. </div></div>
<div class="ttc" id="group__lavu__picture_html_ga6b5a267e202daadf81cbde6584055d1e"><div class="ttname"><a href="group__lavu__picture.html#ga6b5a267e202daadf81cbde6584055d1e">av_image_copy</a></div><div class="ttdeci">void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)</div><div class="ttdoc">Copy image in src_data to dst_data. </div></div>
<div class="ttc" id="structAVStream_html_a56f20051fb99339cc588cd3a07ab8c96"><div class="ttname"><a href="structAVStream.html#a56f20051fb99339cc588cd3a07ab8c96">AVStream::codec</a></div><div class="ttdeci">AVCodecContext * codec</div><div class="ttdoc">Codec context associated with this stream. </div><div class="ttdef"><b>Definition:</b> <a href="avformat_8h_source.html#l00896">avformat.h:896</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ggaf9a51ca15301871723577c730b5865c5adf0f66f21492f8fd5db6debb8b3f932a"><div class="ttname"><a href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5adf0f66f21492f8fd5db6debb8b3f932a">AV_SAMPLE_FMT_U8</a></div><div class="ttdoc">unsigned 8 bits </div><div class="ttdef"><b>Definition:</b> <a href="samplefmt_8h_source.html#l00061">samplefmt.h:61</a></div></div>
<div class="ttc" id="common_8h_html_a0f84cbd7fd810cd678157c98cbfad4b0"><div class="ttname"><a href="common_8h.html#a0f84cbd7fd810cd678157c98cbfad4b0">FFMIN</a></div><div class="ttdeci">#define FFMIN(a, b)</div><div class="ttdef"><b>Definition:</b> <a href="common_8h_source.html#l00096">common.h:96</a></div></div>
<div class="ttc" id="structAVCodecContext_html_a0d8f46461754e8abea0847dcbc41b956"><div class="ttname"><a href="structAVCodecContext.html#a0d8f46461754e8abea0847dcbc41b956">AVCodecContext::width</a></div><div class="ttdeci">int width</div><div class="ttdoc">picture width / height. </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01711">avcodec.h:1711</a></div></div>
<div class="ttc" id="group__lavu__error_html_gac4f6e109c242c81aeee21868d3f35e12"><div class="ttname"><a href="group__lavu__error.html#gac4f6e109c242c81aeee21868d3f35e12">av_err2str</a></div><div class="ttdeci">#define av_err2str(errnum)</div><div class="ttdoc">Convenience macro, the return value should be used only directly in function arguments but never stan...</div><div class="ttdef"><b>Definition:</b> <a href="error_8h_source.html#l00119">error.h:119</a></div></div>
<div class="ttc" id="group__lavc__decoding_html_ga834bb1b062fbcc2de4cf7fb93f154a3e"><div class="ttname"><a href="group__lavc__decoding.html#ga834bb1b062fbcc2de4cf7fb93f154a3e">avcodec_decode_audio4</a></div><div class="ttdeci">int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, const AVPacket *avpkt)</div><div class="ttdoc">Decode the audio frame of size avpkt->size from avpkt->data into frame. </div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a6022c8a609170c7365fb96e83cb2df48"><div class="ttname"><a href="demuxing__decoding_8c.html#a6022c8a609170c7365fb96e83cb2df48">refcount</a></div><div class="ttdeci">static int refcount</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00062">demuxing_decoding.c:62</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ggaf9a51ca15301871723577c730b5865c5ae35a2a6a7593723d9fe4bcefb2876606"><div class="ttname"><a href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5ae35a2a6a7593723d9fe4bcefb2876606">AV_SAMPLE_FMT_DBL</a></div><div class="ttdoc">double </div><div class="ttdef"><b>Definition:</b> <a href="samplefmt_8h_source.html#l00065">samplefmt.h:65</a></div></div>
<div class="ttc" id="structAVCodecContext_html_a0449afd803eb107bd4dbc8b5ea22e363"><div class="ttname"><a href="structAVCodecContext.html#a0449afd803eb107bd4dbc8b5ea22e363">AVCodecContext::height</a></div><div class="ttdeci">int height</div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01711">avcodec.h:1711</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a780830fc3afc836feb64d80eef4185b5"><div class="ttname"><a href="demuxing__decoding_8c.html#a780830fc3afc836feb64d80eef4185b5">video_dst_filename</a></div><div class="ttdeci">static const char * video_dst_filename</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00043">demuxing_decoding.c:43</a></div></div>
<div class="ttc" id="structAVStream_html"><div class="ttname"><a href="structAVStream.html">AVStream</a></div><div class="ttdoc">Stream structure. </div><div class="ttdef"><b>Definition:</b> <a href="avformat_8h_source.html#l00877">avformat.h:877</a></div></div>
<div class="ttc" id="structAVFrame_html_aed14fa772ce46881020fd1545c86432c"><div class="ttname"><a href="structAVFrame.html#aed14fa772ce46881020fd1545c86432c">AVFrame::format</a></div><div class="ttdeci">int format</div><div class="ttdoc">format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...</div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00242">frame.h:242</a></div></div>
<div class="ttc" id="common_8h_html_a3508a98d3ee7e2c9a4841fe264cf70f7"><div class="ttname"><a href="common_8h.html#a3508a98d3ee7e2c9a4841fe264cf70f7">FF_ARRAY_ELEMS</a></div><div class="ttdeci">#define FF_ARRAY_ELEMS(a)</div><div class="ttdef"><b>Definition:</b> <a href="common_8h_source.html#l00100">common.h:100</a></div></div>
<div class="ttc" id="structAVFrame_html_a02ca9bb7f500d3d850f8736f3cb29c6c"><div class="ttname"><a href="structAVFrame.html#a02ca9bb7f500d3d850f8736f3cb29c6c">AVFrame::coded_picture_number</a></div><div class="ttdeci">int coded_picture_number</div><div class="ttdoc">picture number in bitstream order </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00279">frame.h:279</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_gaf9a51ca15301871723577c730b5865c5"><div class="ttname"><a href="group__lavu__sampfmts.html#gaf9a51ca15301871723577c730b5865c5">AVSampleFormat</a></div><div class="ttdeci">AVSampleFormat</div><div class="ttdoc">Audio sample formats. </div><div class="ttdef"><b>Definition:</b> <a href="samplefmt_8h_source.html#l00059">samplefmt.h:59</a></div></div>
<div class="ttc" id="structAVCodecContext_html_adc5f65d6099fd8339c1580c091777223"><div class="ttname"><a href="structAVCodecContext.html#adc5f65d6099fd8339c1580c091777223">AVCodecContext::codec_id</a></div><div class="ttdeci">enum AVCodecID codec_id</div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01549">avcodec.h:1549</a></div></div>
<div class="ttc" id="structAVCodecContext_html_a8ff0b000c463361e234af48d03aadfc0"><div class="ttname"><a href="structAVCodecContext.html#a8ff0b000c463361e234af48d03aadfc0">AVCodecContext::sample_rate</a></div><div class="ttdeci">int sample_rate</div><div class="ttdoc">samples per second </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l02287">avcodec.h:2287</a></div></div>
<div class="ttc" id="structAVFrame_html_aa52bfc6605f6a3059a0c3226cc0f6567"><div class="ttname"><a href="structAVFrame.html#aa52bfc6605f6a3059a0c3226cc0f6567">AVFrame::linesize</a></div><div class="ttdeci">int linesize[AV_NUM_DATA_POINTERS]</div><div class="ttdoc">For video, size in bytes of each picture line. </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00209">frame.h:209</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a3c04138a5bfe5d72780bb7e82a18e627"><div class="ttname"><a href="demuxing__decoding_8c.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a></div><div class="ttdeci">int main(int argc, char **argv)</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00219">demuxing_decoding.c:219</a></div></div>
<div class="ttc" id="structAVCodecContext_html"><div class="ttname"><a href="structAVCodecContext.html">AVCodecContext</a></div><div class="ttdoc">main external API structure. </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01532">avcodec.h:1532</a></div></div>
<div class="ttc" id="group__lavc__decoding_html_ga19a0ca553277f019dd5b0fec6e1f9dca"><div class="ttname"><a href="group__lavc__decoding.html#ga19a0ca553277f019dd5b0fec6e1f9dca">avcodec_find_decoder</a></div><div class="ttdeci">AVCodec * avcodec_find_decoder(enum AVCodecID id)</div><div class="ttdoc">Find a registered decoder with a matching codec ID. </div></div>
<div class="ttc" id="group__lavc__packet_html_ga63d5a489b419bd5d45cfd09091cbcbc2"><div class="ttname"><a href="group__lavc__packet.html#ga63d5a489b419bd5d45cfd09091cbcbc2">av_packet_unref</a></div><div class="ttdeci">void av_packet_unref(AVPacket *pkt)</div><div class="ttdoc">Wipe the packet. </div></div>
<div class="ttc" id="group__lavu__dict_html_ga8d9c2de72b310cef8e6a28c9cd3acbbe"><div class="ttname"><a href="group__lavu__dict.html#ga8d9c2de72b310cef8e6a28c9cd3acbbe">av_dict_set</a></div><div class="ttdeci">int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)</div><div class="ttdoc">Set the given entry in *pm, overwriting an existing entry. </div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a5e068fc5e6dc5c59638ec235f7f6db89"><div class="ttname"><a href="demuxing__decoding_8c.html#a5e068fc5e6dc5c59638ec235f7f6db89">get_format_from_sample_fmt</a></div><div class="ttdeci">static int get_format_from_sample_fmt(const char **fmt, enum AVSampleFormat sample_fmt)</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00190">demuxing_decoding.c:190</a></div></div>
<div class="ttc" id="group__lavu__misc_html_ga9a84bba4713dfced21a1a56163be1f48"><div class="ttname"><a href="group__lavu__misc.html#ga9a84bba4713dfced21a1a56163be1f48">AVMediaType</a></div><div class="ttdeci">AVMediaType</div><div class="ttdef"><b>Definition:</b> <a href="avutil_8h_source.html#l00191">avutil.h:191</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_ad3e56268ab4ce7a25e7a17c2e088a3c1"><div class="ttname"><a href="demuxing__decoding_8c.html#ad3e56268ab4ce7a25e7a17c2e088a3c1">src_filename</a></div><div class="ttdeci">static const char * src_filename</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00042">demuxing_decoding.c:42</a></div></div>
<div class="ttc" id="group__lavc__core_html_ga11f785a188d7d9df71621001465b0f1d"><div class="ttname"><a href="group__lavc__core.html#ga11f785a188d7d9df71621001465b0f1d">avcodec_open2</a></div><div class="ttdeci">int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)</div><div class="ttdoc">Initialize the AVCodecContext to use the given AVCodec. </div></div>
<div class="ttc" id="group__lavf__decoding_html_ga4fdb3084415a82e3810de6ee60e46a61"><div class="ttname"><a href="group__lavf__decoding.html#ga4fdb3084415a82e3810de6ee60e46a61">av_read_frame</a></div><div class="ttdeci">int av_read_frame(AVFormatContext *s, AVPacket *pkt)</div><div class="ttdoc">Return the next frame of a stream. </div></div>
<div class="ttc" id="demuxing__decoding_8c_html_adecce4fda9b9d4fc0d6713d461755cfd"><div class="ttname"><a href="demuxing__decoding_8c.html#adecce4fda9b9d4fc0d6713d461755cfd">audio_dec_ctx</a></div><div class="ttdeci">static AVCodecContext * audio_dec_ctx</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00038">demuxing_decoding.c:38</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_ac9f496a4d3575928c5b94568bbedd753"><div class="ttname"><a href="demuxing__decoding_8c.html#ac9f496a4d3575928c5b94568bbedd753">video_frame_count</a></div><div class="ttdeci">static int video_frame_count</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00055">demuxing_decoding.c:55</a></div></div>
<div class="ttc" id="group__lavu__frame_html_ga0a2b687f9c1c5ed0089b01fd61227108"><div class="ttname"><a href="group__lavu__frame.html#ga0a2b687f9c1c5ed0089b01fd61227108">av_frame_unref</a></div><div class="ttdeci">void av_frame_unref(AVFrame *frame)</div><div class="ttdoc">Unreference all the buffers referenced by frame and reset the frame fields. </div></div>
<div class="ttc" id="group__lavu__misc_html_gaf21645cfa855b2caf9699d7dc7b2d08e"><div class="ttname"><a href="group__lavu__misc.html#gaf21645cfa855b2caf9699d7dc7b2d08e">av_get_media_type_string</a></div><div class="ttdeci">const char * av_get_media_type_string(enum AVMediaType media_type)</div><div class="ttdoc">Return a string describing the media_type enum, NULL if media_type is unknown. </div></div>
<div class="ttc" id="structAVFrame_html_a1d0f65014a8d1bf78cec8cbed2304992"><div class="ttname"><a href="structAVFrame.html#a1d0f65014a8d1bf78cec8cbed2304992">AVFrame::data</a></div><div class="ttdeci">uint8_t * data[AV_NUM_DATA_POINTERS]</div><div class="ttdoc">pointer to the picture/channel planes. </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00192">frame.h:192</a></div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ga0c3c218e1dd570ad4917c69a35a6c77d"><div class="ttname"><a href="group__lavu__sampfmts.html#ga0c3c218e1dd570ad4917c69a35a6c77d">av_get_bytes_per_sample</a></div><div class="ttdeci">int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)</div><div class="ttdoc">Return number of bytes per sample. </div></div>
<div class="ttc" id="avformat_8h_html"><div class="ttname"><a href="avformat_8h.html">avformat.h</a></div><div class="ttdoc">Main libavformat public API header. </div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ga7817ec0eff4dc6fc0962f31e6d138bca"><div class="ttname"><a href="group__lavu__sampfmts.html#ga7817ec0eff4dc6fc0962f31e6d138bca">av_get_packed_sample_fmt</a></div><div class="ttdeci">enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)</div><div class="ttdoc">Get the packed alternative form of the given sample format. </div></div>
<div class="ttc" id="group__lavf__decoding_html_gad42172e27cddafb81096939783b157bb"><div class="ttname"><a href="group__lavf__decoding.html#gad42172e27cddafb81096939783b157bb">avformat_find_stream_info</a></div><div class="ttdeci">int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)</div><div class="ttdoc">Read packets of a media file to get stream information. </div></div>
<div class="ttc" id="group__lavu__sampfmts_html_ggaf9a51ca15301871723577c730b5865c5aea6132df57aebc3f76e10665395c46af"><div class="ttname"><a href="group__lavu__sampfmts.html#ggaf9a51ca15301871723577c730b5865c5aea6132df57aebc3f76e10665395c46af">AV_SAMPLE_FMT_S16</a></div><div class="ttdoc">signed 16 bits </div><div class="ttdef"><b>Definition:</b> <a href="samplefmt_8h_source.html#l00062">samplefmt.h:62</a></div></div>
<div class="ttc" id="filtering__audio_8c_html_ac2bf6798f37e95d3d2ff2d44e4ab3c12"><div class="ttname"><a href="filtering__audio_8c.html#ac2bf6798f37e95d3d2ff2d44e4ab3c12">dec_ctx</a></div><div class="ttdeci">static AVCodecContext * dec_ctx</div><div class="ttdef"><b>Definition:</b> <a href="filtering__audio_8c_source.html#l00044">filtering_audio.c:44</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_ac3ad9da7180c9a9baa85e968eb6937e3"><div class="ttname"><a href="demuxing__decoding_8c.html#ac3ad9da7180c9a9baa85e968eb6937e3">video_dst_file</a></div><div class="ttdeci">static FILE * video_dst_file</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00045">demuxing_decoding.c:45</a></div></div>
<div class="ttc" id="group__lavc__packet_html_gac9cb9756175b96e7441575803757fb73"><div class="ttname"><a href="group__lavc__packet.html#gac9cb9756175b96e7441575803757fb73">av_init_packet</a></div><div class="ttdeci">void av_init_packet(AVPacket *pkt)</div><div class="ttdoc">Initialize optional fields of a packet with default values. </div></div>
<div class="ttc" id="group__lavf__decoding_html_gae804b99aec044690162b8b9b110236a4"><div class="ttname"><a href="group__lavf__decoding.html#gae804b99aec044690162b8b9b110236a4">avformat_close_input</a></div><div class="ttdeci">void avformat_close_input(AVFormatContext **s)</div><div class="ttdoc">Close an opened input AVFormatContext. </div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a85e44b1a7e74c90b84b2298caefb5f73"><div class="ttname"><a href="demuxing__decoding_8c.html#a85e44b1a7e74c90b84b2298caefb5f73">open_codec_context</a></div><div class="ttdeci">static int open_codec_context(int *stream_idx, AVFormatContext *fmt_ctx, enum AVMediaType type)</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00150">demuxing_decoding.c:150</a></div></div>
<div class="ttc" id="structAVCodecContext_html_ac1e6c2cd1269caa7570575725c682a49"><div class="ttname"><a href="structAVCodecContext.html#ac1e6c2cd1269caa7570575725c682a49">AVCodecContext::channels</a></div><div class="ttdeci">int channels</div><div class="ttdoc">number of audio channels </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l02288">avcodec.h:2288</a></div></div>
<div class="ttc" id="pixdesc_8h_html_ab92e2a8a9b58c982560c49df9f01e47e"><div class="ttname"><a href="pixdesc_8h.html#ab92e2a8a9b58c982560c49df9f01e47e">av_get_pix_fmt_name</a></div><div class="ttdeci">const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)</div><div class="ttdoc">Return the short name for a pixel format, NULL in case pix_fmt is unknown. </div></div>
<div class="ttc" id="group__lavf__decoding_html_ga31d601155e9035d5b0e7efedc894ee49"><div class="ttname"><a href="group__lavf__decoding.html#ga31d601155e9035d5b0e7efedc894ee49">avformat_open_input</a></div><div class="ttdeci">int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options)</div><div class="ttdoc">Open an input stream and read the header. </div></div>
<div class="ttc" id="structAVFrame_html_a3f89733f429c98ba5bc64373fb0a3f13"><div class="ttname"><a href="structAVFrame.html#a3f89733f429c98ba5bc64373fb0a3f13">AVFrame::height</a></div><div class="ttdeci">int height</div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00230">frame.h:230</a></div></div>
<div class="ttc" id="group__lavu__misc_html_gga9a84bba4713dfced21a1a56163be1f48ac1a46f59be5c6c2d3412ab172d6b8cf5"><div class="ttname"><a href="group__lavu__misc.html#gga9a84bba4713dfced21a1a56163be1f48ac1a46f59be5c6c2d3412ab172d6b8cf5">AVMEDIA_TYPE_VIDEO</a></div><div class="ttdef"><b>Definition:</b> <a href="avutil_8h_source.html#l00193">avutil.h:193</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a849609cb135f2d344ff03e99610b43df"><div class="ttname"><a href="demuxing__decoding_8c.html#a849609cb135f2d344ff03e99610b43df">video_dst_bufsize</a></div><div class="ttdeci">static int video_dst_bufsize</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00050">demuxing_decoding.c:50</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_ad12fc34ce789bce6c8a05d8a17138534"><div class="ttname"><a href="demuxing__decoding_8c.html#ad12fc34ce789bce6c8a05d8a17138534">height</a></div><div class="ttdeci">static int height</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00039">demuxing_decoding.c:39</a></div></div>
<div class="ttc" id="structAVPacket_html_a0d1cb9b5a32b00fb6edc81ea3aae2a49"><div class="ttname"><a href="structAVPacket.html#a0d1cb9b5a32b00fb6edc81ea3aae2a49">AVPacket::stream_index</a></div><div class="ttdeci">int stream_index</div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01469">avcodec.h:1469</a></div></div>
<div class="ttc" id="structAVFrame_html_afca04d808393822625e09b5ba91c6756"><div class="ttname"><a href="structAVFrame.html#afca04d808393822625e09b5ba91c6756">AVFrame::extended_data</a></div><div class="ttdeci">uint8_t ** extended_data</div><div class="ttdoc">pointers to the data planes/channels. </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00225">frame.h:225</a></div></div>
<div class="ttc" id="pixfmt_8h_html_a9a8e335cf3be472042bc9f0cf80cd4c5"><div class="ttname"><a href="pixfmt_8h.html#a9a8e335cf3be472042bc9f0cf80cd4c5">AVPixelFormat</a></div><div class="ttdeci">AVPixelFormat</div><div class="ttdoc">Pixel format. </div><div class="ttdef"><b>Definition:</b> <a href="pixfmt_8h_source.html#l00061">pixfmt.h:61</a></div></div>
<div class="ttc" id="structAVPacket_html"><div class="ttname"><a href="structAVPacket.html">AVPacket</a></div><div class="ttdoc">This structure stores compressed data. </div><div class="ttdef"><b>Definition:</b> <a href="avcodec_8h_source.html#l01444">avcodec.h:1444</a></div></div>
<div class="ttc" id="group__lavf__core_html_ga917265caec45ef5a0646356ed1a507e3"><div class="ttname"><a href="group__lavf__core.html#ga917265caec45ef5a0646356ed1a507e3">av_register_all</a></div><div class="ttdeci">void av_register_all(void)</div><div class="ttdoc">Initialize libavformat and register all the muxers, demuxers and protocols. </div></div>
<div class="ttc" id="structAVFrame_html_a02f45ab8191aea1660159f1e464237ea"><div class="ttname"><a href="structAVFrame.html#a02f45ab8191aea1660159f1e464237ea">AVFrame::nb_samples</a></div><div class="ttdeci">int nb_samples</div><div class="ttdoc">number of audio samples (per channel) described by this frame </div><div class="ttdef"><b>Definition:</b> <a href="frame_8h_source.html#l00235">frame.h:235</a></div></div>
<div class="ttc" id="demuxing__decoding_8c_html_a2474a5474cbff19523a51eb1de01cda4"><div class="ttname"><a href="demuxing__decoding_8c.html#a2474a5474cbff19523a51eb1de01cda4">width</a></div><div class="ttdeci">static int width</div><div class="ttdef"><b>Definition:</b> <a href="demuxing__decoding_8c_source.html#l00039">demuxing_decoding.c:39</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<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.8.6
</small></address>
</body>
</html>