Copyright | © 2016–2017 Mark Karpov |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov92@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
The module contains a Haskell interface to FLAC stream decoder.
How to use this module
Just call the decodeFlac
function with DecoderSettings
, input and
output file names. The decodeFlac
function can produce vanilla WAVE and
RF64.
Low-level details
The implementation uses the reference implementation of FLAC—libFLAC (C library) under the hood. This means you'll need at least version 1.3.0 of libFLAC (released 26 May 2013) installed for the binding to work.
The binding works with minimal overhead compared to the C implementation.
Decoding speed is equal to that of flac
command line tool. Memory
consumption is minimal and remains constant regardless of the size of
file to decode.
- data DecoderSettings = DecoderSettings {}
- data DecoderException
- data DecoderInitStatus
- data DecoderState
- decodeFlac :: MonadIO m => DecoderSettings -> FilePath -> FilePath -> m ()
Documentation
data DecoderSettings Source #
Parameters of the stream decoder.
DecoderSettings | |
|
data DecoderException Source #
Exception that is thrown when decoding fails for some reason.
DecoderInitFailed DecoderInitStatus | Decoder initialization failed. |
DecoderFailed DecoderState | Decoder failed. |
data DecoderInitStatus Source #
Status of decoder initialization process.
DecoderInitStatusOK | Initialization was successful. |
DecoderInitStatusUnsupportedContainer | The library was not compiled with support for the given container format. |
DecoderInitStatusInvalidCallbacks | A required callback was not supplied. |
DecoderInitStatusMemoryAllocationError | An error occurred allocating memory. |
DecoderInitStatusErrorOpeningFile | fopen() failed. |
DecoderInitStatusAlreadyInitialized | Initialization was attempted on already initialized decoder. |
data DecoderState Source #
Enumeration of decoder states.
DecoderStateSearchForMetadata | The decoder is ready to search for metadata. |
DecoderStateReadMetadata | The decoder is ready to or is in the process of reading metadata. |
DecoderStateSearchForFrameSync | The decoder is ready to or is in the process of searching for the frame sync code. |
DecoderStateReadFrame | The decoder is ready to or is in the process of reading a frame. |
DecoderStateEndOfStream | The decoder has reached the end of the stream. |
DecoderStateOggError | An error occurred in the underlying Ogg layer. |
DecoderStateSeekError | An error occurred while seeking. The decoder must be flushed or reset before decoding can continue. |
DecoderStateAborted | The decoder was aborted by the read callback. |
DecoderStateMemoryAllocationError | An error occurred allocating memory. The decoder is in an invalid state and can no longer be used. |
DecoderStateUnititialized | The decoder is in the uninitialized state. |
:: MonadIO m | |
=> DecoderSettings | Decoder settings |
-> FilePath | File to decode |
-> FilePath | Where to save the resulting WAVE file |
-> m () |
Decode a FLAC file to WAVE.
DecoderException
is thrown when underlying FLAC decoder reports a
problem.