1<html> 2 3<head> 4<title>libvorbisenc - function - vorbis_encode_init</title> 5<link rel=stylesheet href="style.css" type="text/css"> 6</head> 7 8<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> 9<table border=0 width=100%> 10<tr> 11<td><p class=tiny>libvorbisenc documentation</p></td> 12<td align=right><p class=tiny>libvorbisenc release 1.1 - 20040709</p></td> 13</tr> 14</table> 15 16<h1>vorbis_encode_init</h1> 17 18<p><i>declared in "vorbis/vorbisenc.h";</i></p> 19 20<p>This is the primary function within libvorbisenc for setting up managed bitrate modes. 21<p>Before this function is called, the <a href="vorbis_info.html">vorbis_info</a> struct should be initialized by using vorbis_info_init() from the libvorbis API. After encoding, vorbis_info_clear should be called. 22<p>The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set constraints for the encoded file. This function uses these settings to select the appropriate encoding mode and set it up. 23<p> 24<br><br> 25<table border=0 color=black cellspacing=0 cellpadding=7> 26<tr bgcolor=#cccccc> 27 <td> 28<pre><b> 29extern int vorbis_encode_init(<a href="vorbis_info.html">vorbis_info</a> *vi, 30 long channels, 31 long rate, 32 33 long max_bitrate, 34 long nominal_bitrate, 35 long min_bitrate); 36 37</b></pre> 38 </td> 39</tr> 40</table> 41 42<h3>Parameters</h3> 43<dl> 44<dt><i>vi</i></dt> 45<dd>Pointer to an initialized <a href="vorbis_info.html">vorbis_info</a> struct.</dd> 46<dt><i>channels</i></dt> 47<dd>The number of channels to be encoded.</dd> 48<dt><i>rate</i></dt> 49<dd>The sampling rate of the source audio.</dd> 50<dt><i>max_bitrate</i></dt> 51<dd>Desired maximum bitrate (limit). -1 indicates unset.</dd> 52<dt><i>nominal_bitrate</i></dt> 53<dd>Desired average, or central, bitrate. -1 indicates unset.</dd> 54<dt><i>min_bitrate</i></dt> 55<dd>Desired minimum bitrate. -1 indicates unset.</dd> 56</dl> 57 58 59<h3>Return Values</h3> 60<blockquote> 61<li> 620 for success</li> 63 64<li>less than zero for failure:</li> 65<ul> 66<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li> 67<li>OV_EINVAL - Invalid setup request, eg, out of range argument. </li> 68<li>OV_EIMPL - Unimplemented mode; unable to comply with bitrate request.</li> 69</ul> 70</blockquote> 71<p> 72 73<br><br> 74<hr noshade> 75<table border=0 width=100%> 76<tr valign=top> 77<td><p class=tiny>copyright © 2004 xiph.org</p></td> 78<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td> 79</tr><tr> 80<td><p class=tiny>libvorbisenc documentation</p></td> 81<td align=right><p class=tiny>libvorbisenc release 1.1 - 20040709</p></td> 82</tr> 83</table> 84 85 86</body> 87 88</html> 89