packages feed

flac 0.1.1 → 0.1.2

raw patch · 27 files changed

+181/−459 lines, 27 filesdep ~containersdep ~exceptionsdep ~flacPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: containers, exceptions, flac, temporary, wave

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## FLAC 0.1.2++* Documentation and metadata improvements.+ ## FLAC 0.1.1  * Added support for `DiscTotal` Vorbis comment field.
Codec/Audio/FLAC/Metadata.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -12,7 +12,7 @@ -- -- === How to use this module ----- Just like other modules of this library, the API is file-centered — no+-- Just like the other modules of this library, the API is file-centered—no -- streaming support is available at this time (in libFLAC as well). -- Retrieving and editing metadata information is very easy, you only need -- three functions: 'runFlacMeta', 'retrieve', and @('=->')@.@@ -29,7 +29,7 @@ -- >   retrieve (VorbisComment Artist) >>= liftIO . print -- -- Normally you would just return them packed in a tuple from the monad, of--- course. We print the values just for demonstration.+-- course. We print the values just for a demonstration. -- -- The next example shows how to set a couple of tags: --@@ -50,14 +50,14 @@ -- -- === Low-level details ----- The implementation uses the reference implementation of FLAC — libFLAC (C+-- 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. ----- This module in particular uses level 2 metadata interface and it's not--- possible to choose other interface (such as level 0 and 1). This should--- not be of any concern to end-user, however, as level 2 supports more--- functionality than the other levels.+-- This module in particular uses the level 2 metadata interface and it's+-- not possible to choose other interface (such as level 0 and 1). However,+-- this should not be of any concern to the end-user, as the level 2+-- supports more functionality than the other levels.  {-# LANGUAGE CPP                        #-} {-# LANGUAGE ConstrainedClassMethods    #-}@@ -171,11 +171,11 @@            , MonadCatch            , MonadMask ) --- | Non-public shortcut for inner monad stack of 'FlacMeta'.+-- | A non-public shortcut for the inner monad stack of 'FlacMeta'.  type Inner a = ReaderT Context IO a --- | Context that 'Inner' passes around.+-- | The context that 'Inner' passes around.  data Context = Context   { metaChain    :: MetaChain     -- ^ Metadata chain@@ -188,7 +188,7 @@ data MetaSettings = MetaSettings   { metaAutoVacuum :: !Bool     -- ^ Whether to traverse all metadata blocks just before padding sorting-    -- (if enabled, see 'metaSortPadding') and writing data to file,+    -- (if enabled, see 'metaSortPadding') and writing data to a file,     -- deleting all metadata blocks that appear to be empty, e.g. vorbis     -- comment block without any comments (tags) in it. Default value:     -- 'True'.@@ -204,7 +204,7 @@     -- entire file. Default value: 'True'.   , metaPreserveFileStats :: !Bool     -- ^ If 'True', the owner and modification time will be preserved even-    -- if new FLAC file is written (this is for the cases when we need to+    -- if a new FLAC file is written (this is for the cases when we need to     -- write entire FLAC file and thus a copy of the file is written).     -- Default value: 'True'.   } deriving (Show, Read, Eq, Ord)@@ -220,11 +220,12 @@ -- subtle and rather low-level details of metadata editing, just pass 'def' -- unless you know what you are doing. 'FilePath' specifies location of FLAC -- file to read\/edit in the file system. 'FlacMeta' is a monadic action--- that describes what to do with metadata. Compose it from 'retrieve' and--- @('=->')@.+-- that describes what to do with the metadata. Compose it from 'retrieve'+-- and @('=->')@. ----- The action will throw 'Data.Text.Encoding.Error.UnicodeException' if text--- data like Vorbis Comment entries cannot be read as UTF-8-encoded value.+-- The action will throw 'Data.Text.Encoding.Error.UnicodeException' if the+-- text data like Vorbis Comment entries cannot be read as a UTF-8-encoded+-- value. -- -- If a problem occurs, 'MetaException' is thrown with attached -- 'MetaChainStatus' that should help investigating what went wrong.@@ -252,11 +253,12 @@ ---------------------------------------------------------------------------- -- Meta values --- | A class for types that specify which metadata attributes to+-- | A class for the types that specify which metadata attributes to -- read\/write. It's not expected that users of the library will define new--- metadata attributes other than via combination of existing ones, which is--- also useful. For example, 'Duration' and 'BitRate' are not read from FLAC--- file metadata directly, but defined in terms of other attributes.+-- metadata attributes other than via combination of the existing ones,+-- which is also useful. For example, 'Duration' and 'BitRate' are not read+-- from FLAC file metadata directly, but defined in terms of other+-- attributes.  class MetaValue a where @@ -266,8 +268,8 @@    type MetaType a :: * -  -- | Associated type of kind 'Constraint' that controls whether particular-  -- piece of metadata is writable or not.+  -- | Associated type of the kind 'Constraint' that controls whether a+  -- particular piece of metadata is writable or not.    type MetaWritable a :: Constraint @@ -277,7 +279,7 @@    retrieve :: a -> FlacMeta (MetaType a) -  -- | Given value that determines what to write and a value to write,+  -- | Given a value that determines what to write and a value to write,   -- add\/replace a piece of metadata information. This is how you edit   -- metadata. To delete something, set it to 'Nothing' (well, it should be   -- something that /can be missing/, for example you cannot delete@@ -511,7 +513,7 @@  -- | Seek table as a 'Vector' of 'SeekPoint's. Seek points within a table -- must be sorted in ascending order by sample number. If you try to write--- an invalid seek table, 'MetaException' will be raised using+-- an invalid seek table, 'MetaException' will be raised using the -- 'MetaInvalidSeekTable' constructor. -- -- __Writable__ optional attribute represented as a @'Maybe' ('Vector'@@ -578,11 +580,11 @@ -- entries.  data VorbisField-  = Title              -- ^ Track\/Work name.+  = Title              -- ^ Track\/work name.   | Version            -- ^ The version field may be used to differentiate                        -- multiple versions of the same track title in a                        -- single collection (e.g. remix info).-  | Album              -- ^ The collection name to which this track belongs+  | Album              -- ^ The collection name to which this track belongs.   | TrackNumber        -- ^ The track number of this piece if part of a                        -- specific larger collection or album.   | TrackTotal         -- ^ Total number of tracks in the collection this@@ -616,7 +618,8 @@                        -- distributors of the track. This could be a URL, an                        -- email address, the physical address of the                        -- producing label.-  | ISRC               -- ^ ISRC number for the track, see <http://isrc.ifpi.org/en>.+  | ISRC               -- ^ ISRC number for the track, see+                       -- <http://isrc.ifpi.org/en>.   | Rating             -- ^ Rating, usually mapped as 1–5 stars with actual                        -- values “20”, “40”, “60”, “80”, “100” stored.   | RGTrackPeak        -- ^ Replay gain track peak, e.g. “0.99996948”.@@ -643,7 +646,7 @@       setModified  -- | A CUE sheet stored in FLAC metadata. If you try to write an invalid CUE--- sheet 'MetaException' will be raised with 'MetaInvalidCueSheet'+-- sheet 'MetaException' will be raised with the 'MetaInvalidCueSheet' -- constructor which includes a 'Text' value with explanation why the CUE -- sheet was considered invalid. Import "Codec.Audio.FLAC.Metadata.CueSheet" -- to manipulate 'CueSheetData' and 'CueTrack's.@@ -744,7 +747,7 @@ ---------------------------------------------------------------------------- -- Debugging and testing --- | Return list of all 'MetadataType's of metadata blocks detected in+-- | Return a list of all 'MetadataType's of metadata blocks detected in -- order.  getMetaChain :: FlacMeta (NonEmpty MetadataType)@@ -772,11 +775,11 @@     liftIO . (iteratorGetBlock >=> f)  -- | Given 'MetadataType' (type of metadata block) and an action that uses--- an iterator which points to a block of specified type, perform that+-- an iterator which points to a block of the specified type, perform that -- action and return its result wrapped in 'Just' if block of requested type--- was found, 'Nothing' otherwise. If there are several blocks of given--- type, action will be performed for each of them, but only first result--- will be returned.+-- was found, 'Nothing' otherwise. If there are several blocks of the given+-- type, action will be performed for each of them, but only the first+-- result will be returned.  withMetaBlock   :: MetadataType      -- ^ Type of block to find@@ -810,8 +813,8 @@   where     idCheck = fmap (== givenId) . liftIO . getApplicationId --- | Just like 'applicationBlock', but creates a new 'ApplicationBlock' with--- given id if no such block can be found.+-- | Just like 'withApplicationBlock', but creates a new 'ApplicationBlock'+-- with given id if no such block can be found.  withApplicationBlock'   :: ApplicationId     -- ^ Application id to find@@ -910,7 +913,7 @@       liftBool (iteratorDeleteBlock i)     return Nothing --- | Determine if given metadata block is empty.+-- | Determine if a given 'Metadata' block is empty.  isMetaBlockEmpty :: MonadIO m => MetadataType -> Metadata -> m Bool isMetaBlockEmpty SeekTableBlock block =@@ -946,7 +949,7 @@   modified <- asks metaModified   liftIO (writeIORef modified True) --- | Map 'VorbisField' to its ASCII name in form of a 'ByteString'.+-- | Map 'VorbisField' to its ASCII name in the form of a 'ByteString'.  vorbisFieldName :: VorbisField -> ByteString vorbisFieldName RGTrackPeak = "REPLAYGAIN_TRACK_PEAK"@@ -955,7 +958,7 @@ vorbisFieldName RGAlbumGain = "REPLAYGAIN_ALBUM_GAIN" vorbisFieldName field = (B8.pack . fmap toUpper . show) field --- | Map number of channels to a 'Set' of 'SpeakerPosition's as per FLAC+-- | Map the number of channels to a 'Set' of 'SpeakerPosition's as per FLAC -- specification.  toChannelMask :: Word32 -> Set SpeakerPosition
Codec/Audio/FLAC/Metadata/CueSheet.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --
Codec/Audio/FLAC/Metadata/Internal/Level2Interface.hs view
@@ -3,12 +3,12 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable ----- Low-level Haskell wrapper around C functions to work with level 2 FLAC--- metadata interface, see:+-- Low-level Haskell wrapper around C functions to work with the level 2+-- FLAC metadata interface, see: -- -- <https://xiph.org/flac/api/group__flac__metadata__level2.html>. @@ -43,7 +43,7 @@ -- Chain  -- | Create and use a 'MetaChain' (metadata chain). The chain is guaranteed--- to be freed even in case of exception.+-- to be freed even in the case of exception thrown. -- -- If memory for the chain cannot be allocated, corresponding -- 'MetaException' is raised.@@ -64,7 +64,8 @@ foreign import ccall unsafe "FLAC__metadata_chain_new"   c_chain_new :: IO MetaChain --- | Free a chain instance. Deletes the object pointed to by chain.+-- | Free a 'MetaChain' instance. Delete the object pointed to by+-- 'MetaChain'.  chainDelete :: MetaChain -> IO () chainDelete = c_chain_delete@@ -72,8 +73,8 @@ foreign import ccall unsafe "FLAC__metadata_chain_delete"   c_chain_delete :: MetaChain -> IO () --- | Check status of given 'MetaChain'. This can be used to find out what--- went wrong. Also resets status to 'MetaChainStatusOK'.+-- | Check status of a given 'MetaChain'. This can be used to find out what+-- went wrong. It also resets status to 'MetaChainStatusOK'.  chainStatus :: MetaChain -> IO MetaChainStatus chainStatus = fmap toEnum' . c_chain_status@@ -109,7 +110,7 @@ -- on the current chain will become invalid after this call. You should -- delete the iterator and get a new one. ----- Note: this function does not write to the FLAC file, it only modifies the+-- NOTE: this function does not write to the FLAC file, it only modifies the -- chain.  chainSortPadding :: MetaChain -> IO ()@@ -124,7 +125,7 @@ -- | Traverse all metadata blocks from beginning to end collecting 'Just' -- values and possibly performing some actions. This is the only way to -- traverse metadata chain and get access to 'MetaIterator' and by exporting--- only this, we eliminate certain class of possible errors making finding+-- only this, we eliminate a certain class of possible errors making finding -- and traversing metadata blocks always correct and safe. -- -- If memory for the iterator cannot be allocated, corresponding@@ -164,7 +165,7 @@ foreign import ccall unsafe "FLAC__metadata_iterator_new"   c_iterator_new :: IO MetaIterator --- | Free an iterator instance. Deletes the object pointed to by+-- | Free an iterator instance. Delete the object pointed to by -- 'MetaIterator'.  iteratorDelete :: MetaIterator -> IO ()@@ -211,8 +212,8 @@ foreign import ccall unsafe "FLAC__metadata_iterator_get_block"   c_iterator_get_block :: MetaIterator -> IO Metadata --- | Write given 'Metadata' block at position pointed to by 'MetaIterator'--- replacing existing block.+-- | Write given 'Metadata' block at the position pointed to by+-- 'MetaIterator' replacing an existing block.  iteratorSetBlock :: MetaIterator -> Metadata -> IO Bool iteratorSetBlock = c_iterator_set_block
Codec/Audio/FLAC/Metadata/Internal/Level2Interface/Helpers.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -337,8 +337,8 @@   (cueTracks, cueLeadOutTrack) <-     case numTracks of       0 ->-        -- NOTE Should probably never happen unless FLAC file is invalid with-        -- respect to the spec.+        -- NOTE Should probably never happen unless FLAC file is invalid+        -- with respect to the spec.         throwM (MetaInvalidCueSheet "Cannot read CUE sheet without tracks")       1 -> ([],) <$> getCueSheetTrack block 0       _ -> do@@ -381,7 +381,9 @@       pregapIndex <- if hasPregap         then Just <$> c_get_cue_sheet_track_index block n 0         else return Nothing-      trackIndices <- mapM (c_get_cue_sheet_track_index block n) (NE.fromList range)+      trackIndices <- mapM+        (c_get_cue_sheet_track_index block n)+        (NE.fromList range)       return (pregapIndex, trackIndices)   return CueTrack {..} @@ -445,7 +447,7 @@ foreign import ccall unsafe "FLAC__metadata_set_cue_sheet_is_cd"   c_set_cue_sheet_is_cd :: Metadata -> Bool -> IO () --- | Poke a 'CueTrack' an specified index.+-- | Poke a 'CueTrack' at a specified index.  setCueSheetTrack :: Metadata -> CueTrack -> Word8 -> Word8 -> IO Bool setCueSheetTrack block CueTrack {..} n n' = do@@ -489,7 +491,7 @@ -- Picture  -- | Get type of picture assuming that given 'Metadata' block is a--- 'PictureBolck'.+-- 'PictureBlock'.  getPictureType :: Metadata -> IO PictureType getPictureType = fmap toEnum' . c_get_picture_type@@ -497,7 +499,7 @@ foreign import ccall unsafe "FLAC__metadata_get_picture_type"   c_get_picture_type :: Metadata -> IO CUInt --- | Get picture data from given 'Metadata' block.+-- | Get picture data from a given 'Metadata' block.  getPictureData :: Metadata -> IO PictureData getPictureData block = do@@ -534,7 +536,7 @@ foreign import ccall unsafe "FLAC__metadata_get_picture_data"   c_get_picture_data :: Metadata -> Ptr Word32 -> IO CString --- | Set 'PictureType' to given 'Metadata' block that should be a+-- | Set 'PictureType' to a given 'Metadata' block that should be a -- 'PictureBlock'.  setPictureType :: Metadata -> PictureType -> IO ()@@ -577,7 +579,7 @@  -- | Execute a collection of actions that return 'False' on failure. As soon -- as failure is reported, stop the execution and return 'False'. Return--- 'True' in case of success.+-- 'True' in the case of success.  shortcutFalse :: [IO Bool] -> IO Bool shortcutFalse []     = return True
Codec/Audio/FLAC/Metadata/Internal/Object.hs view
@@ -3,11 +3,11 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable ----- Wrappers for functions to work with metadata objects, see:+-- Wrappers for the functions to work with metadata objects, see: -- -- <https://xiph.org/flac/api/group__flac__metadata__object.html>. @@ -89,7 +89,7 @@   c_object_cuesheet_track_resize_indices :: Metadata -> CUInt -> CUInt -> IO Bool  -- | Check a CUE sheet to see if it conforms to the FLAC specification. If--- something is wrong, the explanation is return in 'Just', otherwise+-- something is wrong, the explanation is returned in 'Just', otherwise -- 'Nothing' is returned.  objectCueSheetIsLegal :: Metadata -> Bool -> IO (Maybe Text)
Codec/Audio/FLAC/Metadata/Internal/Types.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -37,16 +37,17 @@ import qualified Data.ByteString       as B import qualified Data.ByteString.Char8 as B8 --- | An opaque newtype wrapper around 'Ptr' 'Void', serves to represent--- pointer to metadata chain.+-- | An opaque newtype wrapper around @'Ptr' 'Void'@, serves to represent a+-- pointer to a metadata chain.  newtype MetaChain = MetaChain (Ptr Void) --- | Same as 'MetaChain', this one for pointer to metadata iterator.+-- | The same as 'MetaChain', this one is for pointers to metadata iterator.  newtype MetaIterator = MetaIterator (Ptr Void) --- | Same as 'MetaChain', this one for pointer to metadata structure itself.+-- | The same as 'MetaChain', this one for pointers to metadata structure+-- itself.  newtype Metadata = Metadata (Ptr Void) @@ -105,8 +106,8 @@     -- ^ Should not ever happen when you use this binding.   deriving (Show, Read, Eq, Ord, Bounded, Enum) --- | Exception that is thrown when manipulation of FLAC metadata fails for--- some reason.+-- | The exception that is thrown when manipulation of FLAC metadata fails+-- for some reason.  data MetaException   = MetaGeneralProblem MetaChainStatus@@ -126,8 +127,8 @@ -- | A normalizing wrapper around 'ByteString' that makes sure that the -- 'ByteString' inside is a valid FLAC application name. You can create -- values of this type using Haskell string literals with--- @OverloadedStrings@ or with 'mkApplicationId'. Extract the inner--- 'ByteString' with 'unApplicationId'.+-- @OverloadedStrings@ or with the 'mkApplicationId' smart constructor.+-- Extract the inner 'ByteString' with 'unApplicationId'.  newtype ApplicationId = ApplicationId ByteString   deriving (Eq, Ord)@@ -151,7 +152,7 @@ unApplicationId :: ApplicationId -> ByteString unApplicationId (ApplicationId appId) = appId --- | The datatype represents a single point in a seek table metadata block.+-- | Single point in a seek table metadata block.  data SeekPoint = SeekPoint   { seekPointSampleNumber :: !Word64@@ -163,8 +164,8 @@     -- ^ The number of samples in the target frame   } deriving (Eq, Ord, Show, Read) --- | The data type represents CUE sheet as stored in FLAC metadata. This--- differs from traditional CUE sheets stored in “.cue” files (see+-- | CUE sheet as stored in FLAC metadata. This differs from traditional CUE+-- sheets stored in “.cue” files (see -- <https://hackage.haskell.org/package/cue-sheet> to work with those).  data CueSheetData = CueSheetData@@ -192,10 +193,10 @@   , cueTracks :: ![CueTrack]     -- ^ Collection of actual tracks in the CUE sheet, see 'CueTrack'.   , cueLeadOutTrack :: !CueTrack-    -- ^ The obligatory lead-out track, will be written with index 170.+    -- ^ The obligatory lead-out track, will be written with the index 170.   } deriving (Eq, Ord, Show, Read) --- | Data type representing a single track is CUE sheet.+-- | Single track in a CUE sheet.  data CueTrack = CueTrack   { cueTrackOffset :: !Word64@@ -226,7 +227,7 @@   } deriving (Eq, Ord, Show, Read)  -- | Type of picture FLAC metadata can contain. There may be several--- metadata blocks containing pictures of different “types”.+-- metadata blocks containing pictures of different types.  data PictureType   = PictureOther             -- ^ Other
Codec/Audio/FLAC/StreamDecoder.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -17,14 +17,14 @@ -- -- === Low-level details ----- The implementation uses the reference implementation of FLAC — libFLAC (C+-- 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.+-- 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.  {-# LANGUAGE RecordWildCards #-} @@ -53,7 +53,7 @@ import System.Directory import System.IO --- | Parameters of stream decoder.+-- | Parameters of the stream decoder.  data DecoderSettings = DecoderSettings   { decoderMd5Checking :: !Bool@@ -127,7 +127,7 @@ -- Helpers  -- | Execute an initializing action that returns 'False' on failure and take--- care of error reporting. In case of trouble, @'DecoderInitFailed'+-- care of error reporting. In the case of trouble, @'DecoderInitFailed' -- 'DecoderInitStatusAlreadyInitialized'@ is thrown.  liftInit :: IO Bool -> IO ()@@ -136,13 +136,13 @@     t = throwIO (DecoderInitFailed DecoderInitStatusAlreadyInitialized)  -- | Execute an action that returns 'False' on failure into taking care of--- error reporting. In case of trouble @'EncoderFailed'@ with encoder status--- attached is thrown.+-- error reporting. In the case of trouble @'EncoderFailed'@ with encoder+-- status attached is thrown.  liftBool :: Decoder -> IO Bool -> IO () liftBool encoder m = liftIO m >>= bool (throwState encoder) (return ()) --- | Get 'EncoderState' from given 'Encoder' and throw it immediately.+-- | Get 'DecoderState' from a given 'Decoder' and throw it immediately.  throwState :: Decoder -> IO a throwState = decoderGetState >=> throwIO . DecoderFailed
Codec/Audio/FLAC/StreamDecoder/Internal.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -28,7 +28,7 @@ import Foreign.C.Types  -- | Create and use a 'Decoder'. The decoder is guaranteed to be freed even--- in case of exception.+-- in the case of exception. -- -- If memory for the encoder cannot be allocated, corresponding -- 'DecoderException' is raised.@@ -40,8 +40,8 @@       (DecoderFailed DecoderStateMemoryAllocationError)     Just x -> f x --- | Create a new stream decoder instance with default settings. In the case--- of memory allocation problem 'Nothing' is returned.+-- | Create a new stream decoder instance with the default settings. In the+-- case of memory allocation problem 'Nothing' is returned.  decoderNew :: IO (Maybe Decoder) decoderNew = maybePtr <$> c_decoder_new@@ -59,7 +59,7 @@  -- | Set MD5 signature checking. If 'True' the decoder will compute the MD5 -- signature of the unencoded audio data while decoding and compare it to--- the signature from the stream info block+-- the signature from the stream info block.  decoderSetMd5Checking :: Decoder -> Bool -> IO Bool decoderSetMd5Checking = c_decoder_set_md5_checking@@ -67,7 +67,7 @@ foreign import ccall unsafe "FLAC__stream_decoder_set_md5_checking"   c_decoder_set_md5_checking :: Decoder -> Bool -> IO Bool --- | Get current decoder state.+-- | Get the current decoder state.  decoderGetState :: Decoder -> IO DecoderState decoderGetState = fmap toEnum' . c_decoder_get_state@@ -75,7 +75,7 @@ foreign import ccall unsafe "FLAC__stream_decoder_get_state"   c_decoder_get_state :: Decoder -> IO CUInt --- | Get frame size as number of inter-channel samples of last decoded+-- | Get frame size as a number of inter-channel samples of last decoded -- frame.  decoderGetBlockSize :: Decoder -> IO Word32@@ -92,7 +92,7 @@ foreign import ccall unsafe "FLAC__stream_decoder_process_single"   c_decoder_process_single :: Decoder -> IO Bool --- | Decode until the end of the metadata. We use this to skip to audio+-- | Decode until the end of the metadata. We use this to skip to the audio -- stream.  decoderProcessUntilEndOfMetadata :: Decoder -> IO Bool@@ -102,7 +102,7 @@   c_decoder_process_until_end_of_metadata :: Decoder -> IO Bool  -- | Finish the decoding process and release resources (also resets decoder--- and its settings). Return 'False' in case of trouble.+-- and its settings). Return 'False' in the case of trouble.  decoderFinish :: Decoder -> IO Bool decoderFinish = c_decoder_finish
Codec/Audio/FLAC/StreamDecoder/Internal/Helpers.hs view
@@ -3,11 +3,11 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable ----- Wrappers around helpers written to help work with stream decoder.+-- Wrappers around helpers written to help work with the stream decoder.  module Codec.Audio.FLAC.StreamDecoder.Internal.Helpers   ( decoderInitHelper )
Codec/Audio/FLAC/StreamDecoder/Internal/Types.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -21,7 +21,7 @@ import Data.Void import Foreign --- | An opaque newtype wrapper around 'Ptr' 'Void', serves to represent+-- | An opaque newtype wrapper around @'Ptr' 'Void'@, serves to represent -- point to decoder instance.  newtype Decoder = Decoder (Ptr Void)
Codec/Audio/FLAC/StreamEncoder.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -17,14 +17,14 @@ -- -- === Low-level details ----- The implementation uses the reference implementation of FLAC — libFLAC (C+-- 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. Encoding speed is equal to that of @flac@ command line--- tool. Memory consumption is minimal and remains constant regardless of--- size of file to decode.+-- The binding works with minimal overhead compared to the C implementation.+-- Encoding speed is equal to that of @flac@ command line tool. Memory+-- consumption is minimal and remains constant regardless of size of file to+-- decode.  {-# LANGUAGE RecordWildCards #-} @@ -50,7 +50,7 @@ import Data.Word import System.Directory --- | Parameters of stream encoder. Note that the 'encoderCompression'+-- | Parameters of the stream encoder. Note that the 'encoderCompression' -- parameter influences a number of other parameters on its own as specified -- here -- <https://xiph.org/flac/api/group__flac__stream__encoder.html#gae49cf32f5256cb47eecd33779493ac85>.@@ -176,7 +176,7 @@     (liftInit . encoderSetMinResidualPartitionOrder e . fst)   forM_ encoderResidualPartitionOrders     (liftInit . encoderSetMaxResidualPartitionOrder e . snd)-  -- Set the estimate (which is likely correct!), to avoid rewrite of+  -- Set the estimate (which is likely correct), to avoid rewrite of   -- STREAMINFO metadata block after encoding.   liftInit (encoderSetTotalSamplesEstimate e totalSamples)   withTempFile' opath $ \otemp -> do
Codec/Audio/FLAC/StreamEncoder/Apodization.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --
Codec/Audio/FLAC/StreamEncoder/Internal.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -47,7 +47,7 @@ import qualified Data.ByteString as B  -- | Create and use an 'Encoder'. The encoder is guaranteed to be freed even--- in case of exception.+-- in the case of exception. -- -- If memory for the encoder cannot be allocated, corresponding -- 'EncoderException' is raised.@@ -59,8 +59,8 @@       (EncoderFailed EncoderStateMemoryAllocationError)     Just x -> f x --- | Create a new stream encoder instance with default settings. In the case--- of memory allocation problem 'Nothing' is returned.+-- | Create a new stream encoder instance with the default settings. In the+-- case of memory allocation problem 'Nothing' is returned.  encoderNew :: IO (Maybe Encoder) encoderNew = maybePtr <$> c_encoder_new@@ -86,7 +86,7 @@ foreign import ccall unsafe "FLAC__stream_encoder_set_channels"   c_encoder_set_channels :: Encoder -> CUInt -> IO Bool --- | Set the same resolution of the input to be encoded. Return 'False' if+-- | Set the sample resolution of the input to be encoded. Return 'False' if -- encoder is already initialized.  encoderSetBitsPerSample :: Encoder -> Word32 -> IO Bool@@ -223,7 +223,7 @@ foreign import ccall unsafe "FLAC__stream_encoder_set_total_samples_estimate"   c_encoder_set_total_samples_estimate :: Encoder -> Word64 -> IO Bool --- | Set the “verify” flag. If true, the encoder will verify it's own+-- | Set the “verify” flag. If 'True', the encoder will verify it's own -- encoded output by feeding it through an internal decoder and comparing -- the original signal against the decoded signal. If a mismatch occurs, the -- process call will return false. Note that this will slow the encoding@@ -235,7 +235,7 @@ foreign import ccall unsafe "FLAC__stream_encoder_set_verify"   c_encoder_set_verify :: Encoder -> Bool -> IO Bool --- | Get current encoder state.+-- | Get the current encoder state.  encoderGetState :: Encoder -> IO EncoderState encoderGetState = fmap toEnum' . c_encoder_get_state
Codec/Audio/FLAC/StreamEncoder/Internal/Helpers.hs view
@@ -3,11 +3,11 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable ----- Wrappers around helpers written to help work with stream encoder.+-- Wrappers around helpers written to help work with the stream encoder.  {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE OverloadedStrings        #-}
Codec/Audio/FLAC/StreamEncoder/Internal/Types.hs view
@@ -3,7 +3,7 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable --@@ -23,8 +23,8 @@ import Foreign import Numeric.Natural --- | An opaque newtype wrapper around 'Ptr' 'Void', serves to represent--- pointer to encoder instance.+-- | An opaque newtype wrapper around @'Ptr' 'Void'@, serves to represent a+-- pointer to an encoder instance.  newtype Encoder = Encoder (Ptr Void) @@ -41,9 +41,9 @@   | EncoderInitStatusInvalidCallbacks     -- ^ A required callback was not supplied.   | EncoderInitStatusInvalidNumberOfChannels-    -- ^ The encoder has an invalid setting for number of channels.+    -- ^ The encoder has an invalid setting for the number of channels.   | EncoderInitStatusInvalidBitsPerSample-    -- ^ The encoder has an invalid setting for bits-per-sample. FLAC+    -- ^ The encoder has an invalid setting for the bits-per-sample. FLAC     -- supports 4-32 bps but the reference encoder currently supports only     -- up to 24 bps.   | EncoderInitStatusInvalidSampleRate
Codec/Audio/FLAC/Util.hs view
@@ -3,12 +3,14 @@ -- Copyright   :  © 2016–2017 Mark Karpov -- License     :  BSD 3 clause ----- Maintainer  :  Mark Karpov <markkarpov@openmailbox.org>+-- Maintainer  :  Mark Karpov <markkarpov92@gmail.com> -- Stability   :  experimental -- Portability :  portable -- -- Random non-public helpers. +{-# LANGUAGE FlexibleContexts #-}+ module Codec.Audio.FLAC.Util   ( maybePtr   , toEnum'@@ -19,13 +21,13 @@ where  import Control.Exception+import Data.Coerce import Data.Text (Text) import Foreign import Foreign.C.String import System.Directory import System.FilePath import System.IO-import Unsafe.Coerce import qualified Data.ByteString    as B import qualified Data.Text          as T import qualified Data.Text.Encoding as T@@ -34,10 +36,10 @@ -- it is, otherwise return the given pointer unchanged. Needless to say that -- this thing is unsafe. -maybePtr :: a -> Maybe a+maybePtr :: Coercible a (Ptr p) => a -> Maybe a maybePtr a-  | unsafeCoerce a == nullPtr = Nothing-  | otherwise                 = Just a+  | coerce a == nullPtr = Nothing+  | otherwise           = Just a  -- | A version of 'toEnum' that converts from any 'Integral' type. @@ -59,21 +61,21 @@  withCStringText :: Text -> (CString -> IO a) -> IO a withCStringText text = B.useAsCString bytes-  where bytes = T.encodeUtf8 (T.filter (/= '\0') text)+  where+    bytes = T.encodeUtf8 (T.filter (/= '\0') text)  -- | A custom wrapper for creating temporary files in the same directory as -- given file. 'Handle' is not opened, you only get 'FilePath' in the -- callback.  withTempFile' :: FilePath -> (FilePath -> IO a) -> IO a-withTempFile' path = bracketOnError acquire cleanup+withTempFile' path m = bracketOnError acquire cleanup $+  \(path', h) -> hClose h >> m path'   where-    acquire = do-      (path',h) <- openBinaryTempFile dir file-      hClose h-      return path'-    cleanup = ignoringIOErrors . removeFile -- in case exception strikes-              -- before we create the actual file+    acquire = openBinaryTempFile dir file+    -- NOTE We need ignoringIOErrors in the case exception strikes before we+    -- create the actual file.+    cleanup = ignoringIOErrors . removeFile . fst     dir     = takeDirectory path     file    = takeFileName  path 
README.md view
@@ -17,8 +17,13 @@ * [License](#license)  This is a complete high-level Haskell binding-to [libFLAC](https://xiph.org/flac/).+to [libFLAC](https://xiph.org/flac/)—reference FLAC implementation. +> As the maintainer of the C FLAC code base, I must say I'm impressed. Quite+> honestly, I think the C API is horrible.+>+> —[Erik de Castro Lopo](https://www.reddit.com/r/haskell/comments/5lyk70/announcing_flac_a_complete_highlevel_binding_to/dc00yb7/)+ ## Aims of the project  Here are several ideas the project follows:@@ -31,8 +36,7 @@   supported by this package. This is in the hope to prevent fragmentation   and proliferation of different libraries to work with FLAC with each of   them covering only some 80% of functionality the library author needed and-  neglecting other 20%. A lot of effort was put to make the first libFLAC-  binding so good so you don't need another one.+  neglecting other 20%.  * Be as efficient as the underlying C implementation, avoid adding any sort   of overhead (memory/speed/or otherwise).@@ -54,24 +58,24 @@ love to manipulate. We have [`hsndfile`](https://hackage.haskell.org/package/hsndfile), but I don't really want to read FLAC data into a buffer or Haskell `Vector`. How simple-it is (if possible) to decode a FLAC file using that library? How simple it-is to figure out where to begin with such a task? With `flac` it's-`decodeFlac def "myfile.falc" "myfile.wav"` — done, average song in a-fraction of second.+is it (if possible) to decode a FLAC file using that library? How simple is+it to figure out where to begin with such a task? With `flac` it's+`decodeFlac def "myfile.flac" "myfile.wav"`—done, average song in a fraction+of second.  ## Provided functionality  Here we go: -* Metadata — full support for reading/writing/deleting of all audio+* Metadata—full support for reading/writing/deleting of all audio   parameters, application data, seek tables, vorbis comments of all sorts,   CUE sheets, and even pictures. -* Stream decoder — simple interface for decoding to vanilla WAVE and RF64+* Stream decoder—simple interface for decoding to vanilla WAVE and RF64   (support for files larger than 4 Gb). -* Stream encoder — a lot of options to tweak, everything that libFLAC has,-  but you can also use `def` and just encode vanilla WAVE or RF64 file into+* Stream encoder—a lot of options to tweak, everything that libFLAC has, but+  you can also use `def` and just encode vanilla WAVE or RF64 file into   native FLAC. Simple and efficient.  ## Limitations@@ -83,7 +87,7 @@  * It's not possible to use custom callbacks for printing decoding/encoding   progress in real-time and stuff like that. Not a big issue IMO, given that-  we get easy and safe API instead.+  we get nice and safe API instead.  * Only works on little-endian architectures so far, I'll accept a PR lifting   this limitation.@@ -92,21 +96,20 @@  The best way to start using `flac` is to take a look at [the Haddocks](https://hackage.haskell.org/package/flac). Encoding and-decoding is so simple that a baby could handle it, and for metadata there-are examples and a lot of details in the docs. Feel free to ask me question-if you get stuck with something though.+decoding are so simple that even a baby could handle it, and for metadata+there are examples and a lot of details in the docs. Feel free to ask me a+question if you get stuck with something though.  ## Related packages  The following packages are designed to be used with `flac`: -* [`flac-picture`](https://hackage.haskell.org/package/flac-picture) — add+* [`flac-picture`](https://hackage.haskell.org/package/flac-picture)—add   pictures to FLAC metadata easier.  ## Contribution -Please kindly direct all issues, bugs, and questions-to+Please kindly direct all issues, bugs, and questions to [the GitHub issue tracker for this project](https://github.com/mrkkrp/flac/issues).  Pull requests are also welcome and will be reviewed quickly.
cbits/metadata_level2_helpers.c view
@@ -1,36 +1,3 @@-/*- * This file is part of ‘flac’ package.- *- * Copyright © 2016–2017 Mark Karpov- *- * All rights reserved.- *- * Redistribution and use in source and binary forms, with or without- * modification, are permitted provided that the following conditions are met:- *- * * Redistributions of source code must retain the above copyright notice,- *   this list of conditions and the following disclaimer.- *- * * Redistributions in binary form must reproduce the above copyright- *   notice, this list of conditions and the following disclaimer in the- *   documentation and/or other materials provided with the distribution.- *- * * Neither the name Mark Karpov nor the names of contributors may be used to- *   endorse or promote products derived from this software without specific- *   prior written permission.- *- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN- * NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.- */- #include "metadata_level2_helpers.h"  /* Stream info */
cbits/metadata_level2_helpers.h view
@@ -1,36 +1,3 @@-/*- * This file is part of ‘flac’ package.- *- * Copyright © 2016–2017 Mark Karpov- *- * All rights reserved.- *- * Redistribution and use in source and binary forms, with or without- * modification, are permitted provided that the following conditions are met:- *- * * Redistributions of source code must retain the above copyright notice,- *   this list of conditions and the following disclaimer.- *- * * Redistributions in binary form must reproduce the above copyright- *   notice, this list of conditions and the following disclaimer in the- *   documentation and/or other materials provided with the distribution.- *- * * Neither the name Mark Karpov nor the names of contributors may be used to- *   endorse or promote products derived from this software without specific- *   prior written permission.- *- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN- * NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.- */- #ifndef FLAC__METADATA_LEVEL2_HELPERS_H #define FLAC__METADATA_LEVEL2_HELPERS_H 
cbits/stream_decoder_helpers.c view
@@ -1,36 +1,3 @@-/*- * This file is part of ‘flac’ package.- *- * Copyright © 2016–2017 Mark Karpov- *- * All rights reserved.- *- * Redistribution and use in source and binary forms, with or without- * modification, are permitted provided that the following conditions are met:- *- * * Redistributions of source code must retain the above copyright notice,- *   this list of conditions and the following disclaimer.- *- * * Redistributions in binary form must reproduce the above copyright- *   notice, this list of conditions and the following disclaimer in the- *   documentation and/or other materials provided with the distribution.- *- * * Neither the name Mark Karpov nor the names of contributors may be used to- *   endorse or promote products derived from this software without specific- *   prior written permission.- *- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN- * NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.- */- #include "stream_decoder_helpers.h"  static unsigned round_to_bytes(unsigned bits)
cbits/stream_decoder_helpers.h view
@@ -1,36 +1,3 @@-/*- * This file is part of ‘flac’ package.- *- * Copyright © 2016–2017 Mark Karpov- *- * All rights reserved.- *- * Redistribution and use in source and binary forms, with or without- * modification, are permitted provided that the following conditions are met:- *- * * Redistributions of source code must retain the above copyright notice,- *   this list of conditions and the following disclaimer.- *- * * Redistributions in binary form must reproduce the above copyright- *   notice, this list of conditions and the following disclaimer in the- *   documentation and/or other materials provided with the distribution.- *- * * Neither the name Mark Karpov nor the names of contributors may be used to- *   endorse or promote products derived from this software without specific- *   prior written permission.- *- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN- * NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.- */- #ifndef FLAC__STREAM_DECODER_HELPERS_H #define FLAC__STREAM_DECODER_HELPERS_H 
cbits/stream_encoder_helpers.c view
@@ -1,36 +1,3 @@-/*- * This file is part of ‘flac’ package.- *- * Copyright © 2016–2017 Mark Karpov- *- * All rights reserved.- *- * Redistribution and use in source and binary forms, with or without- * modification, are permitted provided that the following conditions are met:- *- * * Redistributions of source code must retain the above copyright notice,- *   this list of conditions and the following disclaimer.- *- * * Redistributions in binary form must reproduce the above copyright- *   notice, this list of conditions and the following disclaimer in the- *   documentation and/or other materials provided with the distribution.- *- * * Neither the name Mark Karpov nor the names of contributors may be used to- *   endorse or promote products derived from this software without specific- *   prior written permission.- *- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN- * NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.- */- #include "stream_encoder_helpers.h"  static unsigned round_to_bytes(unsigned bits)
cbits/stream_encoder_helpers.h view
@@ -1,36 +1,3 @@-/*- * This file is part of ‘flac’ package.- *- * Copyright © 2016–2017 Mark Karpov- *- * All rights reserved.- *- * Redistribution and use in source and binary forms, with or without- * modification, are permitted provided that the following conditions are met:- *- * * Redistributions of source code must retain the above copyright notice,- *   this list of conditions and the following disclaimer.- *- * * Redistributions in binary form must reproduce the above copyright- *   notice, this list of conditions and the following disclaimer in the- *   documentation and/or other materials provided with the distribution.- *- * * Neither the name Mark Karpov nor the names of contributors may be used to- *   endorse or promote products derived from this software without specific- *   prior written permission.- *- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY EXPRESS- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN- * NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.- */- #ifndef FLAC__STREAM_ENCODER_HELPERS_H #define FLAC__STREAM_ENCODER_HELPERS_H 
flac.cabal view
@@ -1,42 +1,11 @@------ Cabal configuration for ‘flac’ package.------ Copyright © 2016–2017 Mark Karpov <markkarpov@openmailbox.org>------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,---   this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright---   notice, this list of conditions and the following disclaimer in the---   documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used---   to endorse or promote products derived from this software without---   specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.- name:                 flac-version:              0.1.1+version:              0.1.2 cabal-version:        >= 1.10+tested-with:          GHC==7.10.3, GHC==8.0.2, GHC==8.2.1 license:              BSD3 license-file:         LICENSE.md-author:               Mark Karpov <markkarpov@openmailbox.org>-maintainer:           Mark Karpov <markkarpov@openmailbox.org>+author:               Mark Karpov <markkarpov92@gmail.com>+maintainer:           Mark Karpov <markkarpov92@gmail.com> homepage:             https://github.com/mrkkrp/flac bug-reports:          https://github.com/mrkkrp/flac/issues category:             Codec, Audio@@ -64,13 +33,13 @@                     , bytestring       >= 0.2    && < 0.11                     , containers       >= 0.5    && < 0.6                     , data-default-class-                    , directory        >= 1.2.2  && < 1.3+                    , directory        >= 1.2.2  && < 1.4                     , exceptions       >= 0.6    && < 0.9                     , filepath         >= 1.2    && < 1.5                     , mtl              >= 2.0    && < 3.0                     , text             >= 0.2    && < 1.3                     , transformers     >= 0.4    && < 0.6-                    , vector           >= 0.10   && < 0.12+                    , vector           >= 0.10   && < 0.13                     , wave             >= 0.1.2  && < 0.2   if !impl(ghc >= 8.0)     build-depends:    semigroups       == 0.18.*@@ -91,7 +60,6 @@                     , Codec.Audio.FLAC.StreamEncoder.Internal.Helpers                     , Codec.Audio.FLAC.StreamEncoder.Internal.Types                     , Codec.Audio.FLAC.Util-  extra-libraries:    FLAC   c-sources:          cbits/metadata_level2_helpers.c                     , cbits/stream_decoder_helpers.c                     , cbits/stream_encoder_helpers.c@@ -111,13 +79,13 @@   build-depends:      base             >= 4.8    && < 5.0                     , bytestring       >= 0.2    && < 0.11                     , data-default-class-                    , directory        >= 1.2.2  && < 1.3+                    , directory        >= 1.2.2  && < 1.4                     , filepath         >= 1.2    && < 1.5-                    , flac             >= 0.1.1+                    , flac                     , hspec            >= 2.0    && < 3.0                     , temporary        >= 1.1    && < 1.3                     , transformers     >= 0.4    && < 0.6-                    , vector           >= 0.10   && < 0.12+                    , vector           >= 0.10   && < 0.13                     , wave             >= 0.1.2  && < 0.2   if !impl(ghc >= 8.0)     build-depends:    semigroups       == 0.18.*
tests/Codec/Audio/FLAC/MetadataSpec.hs view
@@ -1,35 +1,3 @@------ Test suite for metadata manipulation.------ Copyright © 2016–2017 Mark Karpov <markkarpov@openmailbox.org>------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,---   this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright---   notice, this list of conditions and the following disclaimer in the---   documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used---   to endorse or promote products derived from this software without---   specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.- {-# LANGUAGE OverloadedStrings #-}  module Codec.Audio.FLAC.MetadataSpec
tests/Codec/Audio/FLAC/StreamEncoderSpec.hs view
@@ -1,35 +1,3 @@------ Test suite for stream encoder.------ Copyright © 2016–2017 Mark Karpov <markkarpov@openmailbox.org>------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,---   this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright---   notice, this list of conditions and the following disclaimer in the---   documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used---   to endorse or promote products derived from this software without---   specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.- {-# LANGUAGE RecordWildCards #-}  module Codec.Audio.FLAC.StreamEncoderSpec