flac-0.1.0: Complete high-level binding to libFLAC

Copyright© 2016–2017 Mark Karpov
LicenseBSD 3 clause
MaintainerMark Karpov <markkarpov@openmailbox.org>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

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 pure C implementation. Decoding speed is equal to that of flac command line tool. Memory consumption is minimal and remains constant regardless of size of file to decode.

Synopsis

Documentation

data DecoderSettings Source #

Parameters of stream decoder.

Constructors

DecoderSettings 

Fields

  • decoderMd5Checking :: !Bool

    If True, the decoder will compute the MD5 signature of the unencoded audio data while decoding and compare it to the signature from the STREAMINFO block. Default value: False.

  • decoderWaveFormat :: !WaveFormat

    This specifies WAVE format in which to save the decoded file. You can choose between WaveVanilla and WaveRF64; choose the latter if uncompressed file is expected to be longer than 4 Gb. Default value: WaveVanilla.

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

Bounded DecoderInitStatus Source # 
Enum DecoderInitStatus Source # 
Eq DecoderInitStatus Source # 
Ord DecoderInitStatus Source # 
Read DecoderInitStatus Source # 
Show DecoderInitStatus Source # 

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.

decodeFlac Source #

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.