]> gitweb @ CieloNegro.org - wavpack.git/commitdiff
WVBitstream should have BitString
authorPHO <pho@cielonegro.org>
Tue, 11 Jan 2011 06:26:00 +0000 (15:26 +0900)
committerPHO <pho@cielonegro.org>
Tue, 11 Jan 2011 06:26:00 +0000 (15:26 +0900)
Codec/Audio/WavPack/Metadata.hs

index def1cb3c422b14d085af14ed9568d5797117df74..fcd873b5776ef17f7ad1767e1328848a0a978ad6 100644 (file)
@@ -20,6 +20,7 @@ module Codec.Audio.WavPack.Metadata
     , Unknown(..)
     )
     where
+import qualified Codec.Audio.WavPack.BitString as B
 import Codec.Audio.WavPack.Internal
 import Control.Monad
 import Data.Binary
@@ -274,17 +275,17 @@ instance Binary EntropyVars where
 -- | WV Bitstream
 data WVBitstream
     = WVBitstream {
-        wvStream ∷ !L.ByteString
+        wvStream ∷ !B.BitString
       }
     deriving (Eq, Show, Typeable)
 
 instance Metadata WVBitstream where
     metaID _ = 0x0A
-    metaSize = fromIntegral ∘ L.length ∘ wvStream
+    metaSize = (`div` 8) ∘ B.length ∘ wvStream
 
 instance Binary WVBitstream where
-    put = putLazyByteString ∘ wvStream
-    get = fmap WVBitstream getRemainingLazyByteString
+    put = putLazyByteString ∘ B.toByteString ∘ wvStream
+    get = fmap (WVBitstream ∘ B.fromByteString) getRemainingLazyByteString
 
 -- | RIFF header for .wav files (before audio)
 data RIFFHeader