Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 2cb03934542209c23596f112b5517568 > files > 24

ocaml-flac-devel-0.1.1-6.mga4.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Flac.Decoder.html">
<link rel="Up" href="Flac.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Flac" rel="Chapter" href="Flac.html">
<link title="Ogg_flac" rel="Chapter" href="Ogg_flac.html">
<link title="Ogg_demuxer_flac_decoder" rel="Chapter" href="Ogg_demuxer_flac_decoder.html"><link title="Usage" rel="Section" href="#3_Usage">
<link title="Types" rel="Section" href="#3_Types">
<link title="Exceptions" rel="Section" href="#3_Exceptions">
<link title="Functions" rel="Section" href="#3_Functions">
<link title="Convenience" rel="Section" href="#3_Convenience">
<title>Flac.Encoder</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Flac.Decoder.html" title="Flac.Decoder">Previous</a>
&nbsp;<a class="up" href="Flac.html" title="Flac">Up</a>
&nbsp;</div>
<h1>Module <a href="type_Flac.Encoder.html">Flac.Encoder</a></h1>

<pre><span class="keyword">module</span> Encoder: <code class="code">sig</code> <a href="Flac.Encoder.html">..</a> <code class="code">end</code></pre><div class="info module top">
Encode native FLAC data<br>
</div>
<hr width="100%">
<br>
<h3 id="3_Usage">Usage</h3><br>
<br>
A typical use of the FLAC encoder is the following:
 <pre class="verbatim"> (* A function to write encoded data *)
 let write = (..a function of type write..) in
 (* Create the encoding callbacks *)
 let callbacks = Flac.Encoder.get_callbacks write in
 (* Define the parameters and comments *)
 let params = (..a value of type params ..) in
 let comments = [("title","FLAC encoding example")] in
 (* Create an encoder *)
 let enc = Flac.Encoder.create ~comments params callbacks in
 (* Encode data *)
 let data = (..a value of type float array array.. in 
  Flac.Encoder.process enc callbacks data ;
 (..repeat encoding process..)
 (* Close encoder *)
 Flac.Encoder.finish enc callbacks</pre>
<p>

 Remarks: <ul>
<li>Exceptions raised by the callbacks should be treated
   as fatal. The behaviour of the FLAC encoding library is
   unknown after interrupted by an exception.</li>
<li>Encoded data should have the same number of channels as
   specified in encoder's parameters and the same number of
   samples in each channels. </li>
<li>See FLAC documentation for informations about the callbacks.
   Note in particular that some information about encoded data
   such as md5 sum and total samples are only written when a 
   <code class="code">seek</code> callback is given. </li>
<li>Variant types for callbacks and encoder are used to make sure
   that different type of callbacks (generic, file, ogg) are always
   used with the corresponding decoder type.</li>
</ul>
<br>
<br>
<h3 id="3_Types">Types</h3><br>

<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> </pre>
<div class="info ">
Type of an encoder.<br>
</div>


<pre><span id="TYPEwrite"><span class="keyword">type</span> <code class="type"></code>write</span> = <code class="type">string -> unit</code> </pre>
<div class="info ">
Type of a write callback<br>
</div>


<pre><span id="TYPEcallbacks"><span class="keyword">type</span> <code class="type">'a</code> callbacks</span> </pre>
<div class="info ">
Type of a set of callbacks<br>
</div>


<pre><span id="TYPEgeneric"><span class="keyword">type</span> <code class="type"></code>generic</span> </pre>
<div class="info ">
Generic type for an encoder<br>
</div>


<pre><code><span id="TYPEparams"><span class="keyword">type</span> <code class="type"></code>params</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTparams.channels">channels</span>&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTparams.bits_per_sample">bits_per_sample</span>&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTparams.sample_rate">sample_rate</span>&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTparams.compression_level">compression_level</span>&nbsp;: <code class="type">int option</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTparams.total_samples">total_samples</span>&nbsp;: <code class="type">int64 option</code>;</code></td>

</tr></table>
}

<div class="info ">
Type of encoding parameters<br>
</div>


<pre><span id="TYPEcomments"><span class="keyword">type</span> <code class="type"></code>comments</span> = <code class="type">(string * string) list</code> </pre>
<div class="info ">
(Vorbis) comments for encoding<br>
</div>

<br>
<h3 id="3_Exceptions">Exceptions</h3><br>

<pre><span id="EXCEPTIONInvalid_data"><span class="keyword">exception</span> Invalid_data</span></pre>
<div class="info ">
Raised when submiting invalid data to
 encode<br>
</div>
<br>
<h3 id="3_Functions">Functions</h3><br>

<pre><span id="VALget_callbacks"><span class="keyword">val</span> get_callbacks</span> : <code class="type">?seek:(int64 -> unit) -><br>       ?tell:(unit -> int64) -><br>       <a href="Flac.Encoder.html#TYPEwrite">write</a> -> <a href="Flac.Encoder.html#TYPEgeneric">generic</a> <a href="Flac.Encoder.html#TYPEcallbacks">callbacks</a></code></pre><div class="info ">
Create a set of encoding callbacks<br>
</div>

<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">?comments:<a href="Flac.Encoder.html#TYPEcomments">comments</a> -><br>       <a href="Flac.Encoder.html#TYPEparams">params</a> -> 'a <a href="Flac.Encoder.html#TYPEcallbacks">callbacks</a> -> 'a <a href="Flac.Encoder.html#TYPEt">t</a></code></pre><div class="info ">
Create an encoder<br>
</div>

<pre><span id="VALprocess"><span class="keyword">val</span> process</span> : <code class="type">'a <a href="Flac.Encoder.html#TYPEt">t</a> -> 'a <a href="Flac.Encoder.html#TYPEcallbacks">callbacks</a> -> float array array -> unit</code></pre><div class="info ">
Encode some data<br>
</div>

<pre><span id="VALfinish"><span class="keyword">val</span> finish</span> : <code class="type">'a <a href="Flac.Encoder.html#TYPEt">t</a> -> 'a <a href="Flac.Encoder.html#TYPEcallbacks">callbacks</a> -> unit</code></pre><div class="info ">
Terminate an encoder. Causes the encoder to
 flush remaining encoded data. The encoder should
 not be used anymore afterwards.<br>
</div>
<br>
<h3 id="3_Convenience">Convenience</h3><br>

<pre><span id="VALfrom_s16le"><span class="keyword">val</span> from_s16le</span> : <code class="type">string -> int -> float array array</code></pre><div class="info ">
Convert S16LE pcm data to an audio array for 
 encoding WAV and raw PCM to flac.<br>
</div>

<pre><span class="keyword">module</span> <a href="Flac.Encoder.File.html">File</a>: <code class="code">sig</code> <a href="Flac.Encoder.File.html">..</a> <code class="code">end</code></pre><div class="info">
Encode to a local file
</div>
</body></html>