Copyright | © 2016–present Mark Karpov |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov92@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Codec.Audio.FLAC.StreamDecoder
Description
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.
Synopsis
- data DecoderSettings = DecoderSettings {
- decoderMd5Checking :: !Bool
- decoderWaveFormat :: !WaveFormat
- defaultDecoderSettings :: DecoderSettings
- data DecoderException
- data DecoderInitStatus
- data DecoderState
- decodeFlac :: MonadIO m => DecoderSettings -> FilePath -> FilePath -> m ()
Documentation
data DecoderSettings Source #
Parameters of the stream decoder.
Constructors
DecoderSettings | |
Fields
|
Instances
defaultDecoderSettings :: DecoderSettings Source #
Default DecoderSettings
.
Since: 0.2.0
data DecoderException Source #
Exception that is thrown when decoding fails for some reason.
Constructors
DecoderInitFailed DecoderInitStatus | Decoder initialization failed. |
DecoderFailed DecoderState | Decoder failed. |
Instances
Eq DecoderException Source # | |
Defined in Codec.Audio.FLAC.StreamDecoder.Internal.Types Methods (==) :: DecoderException -> DecoderException -> Bool # (/=) :: DecoderException -> DecoderException -> Bool # | |
Read DecoderException Source # | |
Defined in Codec.Audio.FLAC.StreamDecoder.Internal.Types Methods readsPrec :: Int -> ReadS DecoderException # readList :: ReadS [DecoderException] # | |
Show DecoderException Source # | |
Defined in Codec.Audio.FLAC.StreamDecoder.Internal.Types Methods showsPrec :: Int -> DecoderException -> ShowS # show :: DecoderException -> String # showList :: [DecoderException] -> ShowS # | |
Exception DecoderException Source # | |
Defined in Codec.Audio.FLAC.StreamDecoder.Internal.Types Methods toException :: DecoderException -> SomeException # |
data DecoderInitStatus Source #
Status of decoder initialization process.
Constructors
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. |
Instances
data DecoderState Source #
Enumeration of decoder states.
Constructors
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. |
Instances
Arguments
:: 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.