-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 1c2b533 🚀
- Loading branch information
Showing
83 changed files
with
2,447 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>File (flac.Flac.Decoder.File)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../../index.html">flac</a> » <a href="../../index.html">Flac</a> » <a href="../index.html">Decoder</a> » File</nav><header class="odoc-preamble"><h1>Module <code><span>Decoder.File</span></code></h1><p>Local file decoding.</p><p>Convenience module to * decode local files</p></header><nav class="odoc-toc"><ul><li><a href="#types">Types</a></li><li><a href="#functions">Functions</a></li></ul></nav><div class="odoc-content"><h4 id="types"><a href="#types" class="anchor"></a>Types</h4><div class="odoc-spec"><div class="spec type anchored" id="type-handle"><a href="#type-handle" class="anchor"></a><code><span><span class="keyword">type</span> handle</span><span> = </span><span>{</span></code><ol><li id="type-handle.fd" class="def record field anchored"><a href="#type-handle.fd" class="anchor"></a><code><span>fd : <span class="xref-unresolved">Unix</span>.file_descr;</span></code></li><li id="type-handle.dec" class="def record field anchored"><a href="#type-handle.dec" class="anchor"></a><code><span>dec : <a href="../index.html#type-t">t</a>;</span></code></li><li id="type-handle.info" class="def record field anchored"><a href="#type-handle.info" class="anchor"></a><code><span>info : <a href="../index.html#type-info">info</a>;</span></code></li><li id="type-handle.comments" class="def record field anchored"><a href="#type-handle.comments" class="anchor"></a><code><span>comments : <span><span>(string * <span><span>(string * string)</span> list</span>)</span> option</span>;</span></code></li></ol><code><span>}</span></code></div></div><h4 id="functions"><a href="#functions" class="anchor"></a>Functions</h4><div class="odoc-spec"><div class="spec value anchored" id="val-create_from_fd"><a href="#val-create_from_fd" class="anchor"></a><code><span><span class="keyword">val</span> create_from_fd : | ||
<span><span class="label">write</span>:<span>(<span><span><span>float array</span> array</span> <span class="arrow">-></span></span> unit)</span> <span class="arrow">-></span></span> | ||
<span><span class="xref-unresolved">Unix</span>.file_descr <span class="arrow">-></span></span> | ||
<a href="#type-handle">handle</a></span></code></div><div class="spec-doc"><p>Create a file decoder from a Unix file * descriptor * * Note: this decoder requires seeking thus will only work on seekable * file descriptor.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-create"><a href="#val-create" class="anchor"></a><code><span><span class="keyword">val</span> create : <span><span class="label">write</span>:<span>(<span><span><span>float array</span> array</span> <span class="arrow">-></span></span> unit)</span> <span class="arrow">-></span></span> <span>string <span class="arrow">-></span></span> <a href="#type-handle">handle</a></span></code></div><div class="spec-doc"><p>Create a file decoder from a file URI</p></div></div></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Decoder (flac.Flac.Decoder)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../index.html">flac</a> » <a href="../index.html">Flac</a> » Decoder</nav><header class="odoc-preamble"><h1>Module <code><span>Flac.Decoder</span></code></h1><p>Decode native FLAC data</p></header><nav class="odoc-toc"><ul><li><a href="#usage">Usage</a></li><li><a href="#types">Types</a></li><li><a href="#exceptions">Exceptions</a></li><li><a href="#functions">Functions</a></li><li><a href="#convenience">Convenience</a></li></ul></nav><div class="odoc-content"><h4 id="usage"><a href="#usage" class="anchor"></a>Usage</h4><p>A typical use of the FLAC decoder is the following: * * </p><pre> (* Raise this when streams has ended. *) | ||
* exception End_of_stream | ||
* (* Define a read function *) | ||
* let input = (..a function of type read..) in | ||
* (* Define a write function *) | ||
* let output = (..a function of type write..) in | ||
* (* Create callbacks *) | ||
* let callbacks = Flac.Decoder.get_callbacks input write in | ||
* (* Create an unitialized decoder *) | ||
* let decoder = Flac.Decoder.create callbacks in | ||
* (* Initialize decoder *) | ||
* let decoder,info,comments = Flac.Decoder.init decoder callbacks in | ||
* (..do something with info and comments..) | ||
* (* Decode data *) | ||
* match Flac.Decoder.state decoder c with | ||
* | `Search_for_metadata | ||
* | `Read_metadata | ||
* | `Search_for_frame_sync | ||
* | `Read_frame -> | ||
* Flac.Decoder.process decoder callbacks | ||
* | _ -> raise End_of_stream</pre><p>* * Some remarks: * - Exceptions raised by callbacks should be treated * as fatal errors. The dehaviour of the flac library * after being interrupted by an exception is unknown. * The only notable exception is Ogg/flac decoding, where * the read callback raises <code>Ogg.Not_enough_data</code>. * - The state of the decoder should be checked prior to calling * <code>process</code>. Termination may not be detected nor raise an * exception so it is the caller's responsibility to check * on this. * - See FLAC documentation for the information on the * callbacks. * - The variant type for decoder and callbacks is used * to make sure that different type of decoders * (generic, file, ogg) are only used with the same * type of callbacks.</p><h4 id="types"><a href="#types" class="anchor"></a>Types</h4><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-info"><a href="#type-info" class="anchor"></a><code><span><span class="keyword">type</span> info</span><span> = </span><span>{</span></code><ol><li id="type-info.sample_rate" class="def record field anchored"><a href="#type-info.sample_rate" class="anchor"></a><code><span>sample_rate : int;</span></code></li><li id="type-info.channels" class="def record field anchored"><a href="#type-info.channels" class="anchor"></a><code><span>channels : int;</span></code></li><li id="type-info.bits_per_sample" class="def record field anchored"><a href="#type-info.bits_per_sample" class="anchor"></a><code><span>bits_per_sample : int;</span></code></li><li id="type-info.total_samples" class="def record field anchored"><a href="#type-info.total_samples" class="anchor"></a><code><span>total_samples : int64;</span></code></li><li id="type-info.md5sum" class="def record field anchored"><a href="#type-info.md5sum" class="anchor"></a><code><span>md5sum : string;</span></code></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-comments"><a href="#type-comments" class="anchor"></a><code><span><span class="keyword">type</span> comments</span><span> = string * <span><span>(string * string)</span> list</span></span></code></div><div class="spec-doc"><p>(Vorbis) comments of decoded FLAC data.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-state"><a href="#type-state" class="anchor"></a><code><span><span class="keyword">type</span> state</span><span> = </span><span>[ </span></code><ol><li id="type-state.Search_for_metadata" class="def variant constructor anchored"><a href="#type-state.Search_for_metadata" class="anchor"></a><code><span>| </span><span>`Search_for_metadata</span></code></li><li id="type-state.Read_metadata" class="def variant constructor anchored"><a href="#type-state.Read_metadata" class="anchor"></a><code><span>| </span><span>`Read_metadata</span></code></li><li id="type-state.Search_for_frame_sync" class="def variant constructor anchored"><a href="#type-state.Search_for_frame_sync" class="anchor"></a><code><span>| </span><span>`Search_for_frame_sync</span></code></li><li id="type-state.Read_frame" class="def variant constructor anchored"><a href="#type-state.Read_frame" class="anchor"></a><code><span>| </span><span>`Read_frame</span></code></li><li id="type-state.End_of_stream" class="def variant constructor anchored"><a href="#type-state.End_of_stream" class="anchor"></a><code><span>| </span><span>`End_of_stream</span></code></li><li id="type-state.Ogg_error" class="def variant constructor anchored"><a href="#type-state.Ogg_error" class="anchor"></a><code><span>| </span><span>`Ogg_error</span></code></li><li id="type-state.Seek_error" class="def variant constructor anchored"><a href="#type-state.Seek_error" class="anchor"></a><code><span>| </span><span>`Seek_error</span></code></li><li id="type-state.Aborted" class="def variant constructor anchored"><a href="#type-state.Aborted" class="anchor"></a><code><span>| </span><span>`Aborted</span></code></li><li id="type-state.Memory_allocation_error" class="def variant constructor anchored"><a href="#type-state.Memory_allocation_error" class="anchor"></a><code><span>| </span><span>`Memory_allocation_error</span></code></li><li id="type-state.Uninitialized" class="def variant constructor anchored"><a href="#type-state.Uninitialized" class="anchor"></a><code><span>| </span><span>`Uninitialized</span></code></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>Possible states of a decoder.</p></div></div><h4 id="exceptions"><a href="#exceptions" class="anchor"></a>Exceptions</h4><div class="odoc-spec"><div class="spec exception anchored" id="exception-Lost_sync"><a href="#exception-Lost_sync" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Lost_sync</span></span></code></div><div class="spec-doc"><p>An error in the stream caused the decoder to lose synchronization.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Bad_header"><a href="#exception-Bad_header" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Bad_header</span></span></code></div><div class="spec-doc"><p>The decoder encountered a corrupted frame header.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Frame_crc_mismatch"><a href="#exception-Frame_crc_mismatch" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Frame_crc_mismatch</span></span></code></div><div class="spec-doc"><p>The frame's data did not match the CRC in the footer.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Unparseable_stream"><a href="#exception-Unparseable_stream" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Unparseable_stream</span></span></code></div><div class="spec-doc"><p>The decoder encountered reserved fields in use in the stream.</p></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Not_flac"><a href="#exception-Not_flac" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Not_flac</span></span></code></div><div class="spec-doc"><p>Raised if trying to decode a stream that * is not flac.</p></div></div><h4 id="functions"><a href="#functions" class="anchor"></a>Functions</h4><div class="odoc-spec"><div class="spec value anchored" id="val-create"><a href="#val-create" class="anchor"></a><code><span><span class="keyword">val</span> create : | ||
<span><span class="optlabel">?seek</span>:<span>(<span>int64 <span class="arrow">-></span></span> unit)</span> <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?tell</span>:<span>(<span>unit <span class="arrow">-></span></span> int64)</span> <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?length</span>:<span>(<span>unit <span class="arrow">-></span></span> int64)</span> <span class="arrow">-></span></span> | ||
<span><span class="optlabel">?eof</span>:<span>(<span>unit <span class="arrow">-></span></span> bool)</span> <span class="arrow">-></span></span> | ||
<span><span class="label">read</span>:<span>(<span>bytes <span class="arrow">-></span></span> <span>int <span class="arrow">-></span></span> <span>int <span class="arrow">-></span></span> int)</span> <span class="arrow">-></span></span> | ||
<span><span class="label">write</span>:<span>(<span><span><span>float array</span> array</span> <span class="arrow">-></span></span> unit)</span> <span class="arrow">-></span></span> | ||
<span>unit <span class="arrow">-></span></span> | ||
<a href="#type-t">t</a> * <a href="#type-info">info</a> * <span><a href="#type-comments">comments</a> option</span></span></code></div><div class="spec-doc"><p>Create a decoder. The decoder will be used to decode * all metadata. Initial audio data shall be immediatly available * after this call.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-process"><a href="#val-process" class="anchor"></a><code><span><span class="keyword">val</span> process : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Decode one frame of audio data.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-seek"><a href="#val-seek" class="anchor"></a><code><span><span class="keyword">val</span> seek : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <span><span class="xref-unresolved">Stdlib</span>.Int64.t <span class="arrow">-></span></span> bool</span></code></div><div class="spec-doc"><p>Flush the input and seek to an absolute sample. * Decoding will resume at the given sample. Note * that because of this, the next write callback may * contain a partial block. The client must support seeking * the input or this function will fail and return <code>false</code>. * Furthermore, if the decoder state is <code>`Seek_error</code> * then the decoder must be flushed or reset * before decoding can continue.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-flush"><a href="#val-flush" class="anchor"></a><code><span><span class="keyword">val</span> flush : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> bool</span></code></div><div class="spec-doc"><p>Flush the stream input. * The decoder's input buffer will be cleared and the state set to * <code>`Search_for_frame_sync</code>. This will also turn * off MD5 checking.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-reset"><a href="#val-reset" class="anchor"></a><code><span><span class="keyword">val</span> reset : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> bool</span></code></div><div class="spec-doc"><p>Reset the decoding process. * The decoder's input buffer will be cleared and the state set to * <code>`Search_for_metadata</code>. MD5 checking will be restored to its original * setting. * * If the decoder is seekable, the decoder will also attempt to seek to * the beginning of the stream. If this rewind fails, this function will * return <code>false</code>. It follows that <code>reset</code> cannot be used when decoding * from <code>stdin</code>. * * If the decoder is not seekable (i.e. no seek callback was provided) * it is the duty of the client to start feeding data from the beginning * of the stream on the next <code>process</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-state"><a href="#val-state" class="anchor"></a><code><span><span class="keyword">val</span> state : <span><a href="#type-t">t</a> <span class="arrow">-></span></span> <a href="#type-state">state</a></span></code></div><div class="spec-doc"><p>Get the state of a decoder.</p></div></div><h4 id="convenience"><a href="#convenience" class="anchor"></a>Convenience</h4><div class="odoc-spec"><div class="spec value anchored" id="val-to_s16le"><a href="#val-to_s16le" class="anchor"></a><code><span><span class="keyword">val</span> to_s16le : <span><span><span>float array</span> array</span> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p>Convert an audio array to a S16LE string for * decoding FLAC to WAV and raw PCM</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-File"><a href="#module-File" class="anchor"></a><code><span><span class="keyword">module</span> <a href="File/index.html">File</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Local file decoding.</p></div></div></div></body></html> |
Oops, something went wrong.