{-# LANGUAGE ForeignFunctionInterface #-}
module Codec.Audio.FLAC.StreamDecoder.Internal.Helpers
( decoderInitHelper,
)
where
import Codec.Audio.FLAC.StreamDecoder.Internal.Types
import Codec.Audio.FLAC.Util
import Data.Void
import Foreign
import Foreign.C.String
import Foreign.C.Types
decoderInitHelper ::
Decoder ->
FilePath ->
Ptr Void ->
IO DecoderInitStatus
decoderInitHelper :: Decoder -> FilePath -> Ptr Void -> IO DecoderInitStatus
decoderInitHelper decoder :: Decoder
decoder ipath :: FilePath
ipath buffer :: Ptr Void
buffer =
FilePath
-> (CString -> IO DecoderInitStatus) -> IO DecoderInitStatus
forall a. FilePath -> (CString -> IO a) -> IO a
withCString FilePath
ipath ((CString -> IO DecoderInitStatus) -> IO DecoderInitStatus)
-> (CString -> IO DecoderInitStatus) -> IO DecoderInitStatus
forall a b. (a -> b) -> a -> b
$ \ipathPtr :: CString
ipathPtr ->
CUInt -> DecoderInitStatus
forall a b. (Integral a, Enum b) => a -> b
toEnum'
(CUInt -> DecoderInitStatus) -> IO CUInt -> IO DecoderInitStatus
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder -> CString -> Ptr Void -> IO CUInt
c_decoder_init_helper
Decoder
decoder
CString
ipathPtr
Ptr Void
buffer
foreign import ccall unsafe "FLAC__stream_decoder_init_helper"
c_decoder_init_helper ::
Decoder ->
CString ->
Ptr Void ->
IO CUInt