packages feed

gi-gst-0.1.6.13: GI/Gst/Structs/BufferPoolAcquireParams.hs


{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

Parameters passed to the gst_buffer_pool_acquire_buffer() function to control the
allocation of the buffer.

The default implementation ignores the @start and @stop members but other
implementations can use this extra information to decide what buffer to
return.
-}

module GI.Gst.Structs.BufferPoolAcquireParams
    ( 

-- * Exported types
    BufferPoolAcquireParams(..)             ,
    newZeroBufferPoolAcquireParams          ,
    noBufferPoolAcquireParams               ,


 -- * Properties
-- ** Flags
    bufferPoolAcquireParamsReadFlags        ,


-- ** Format
    bufferPoolAcquireParamsReadFormat       ,


-- ** Start
    bufferPoolAcquireParamsReadStart        ,


-- ** Stop
    bufferPoolAcquireParamsReadStop         ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gst.Types
import GI.Gst.Callbacks

newtype BufferPoolAcquireParams = BufferPoolAcquireParams (ForeignPtr BufferPoolAcquireParams)
-- | Construct a `BufferPoolAcquireParams` struct initialized to zero.
newZeroBufferPoolAcquireParams :: MonadIO m => m BufferPoolAcquireParams
newZeroBufferPoolAcquireParams = liftIO $ callocBytes 64 >>= wrapPtr BufferPoolAcquireParams

noBufferPoolAcquireParams :: Maybe BufferPoolAcquireParams
noBufferPoolAcquireParams = Nothing

bufferPoolAcquireParamsReadFormat :: BufferPoolAcquireParams -> IO Format
bufferPoolAcquireParamsReadFormat s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CUInt
    let val' = (toEnum . fromIntegral) val
    return val'

bufferPoolAcquireParamsReadStart :: BufferPoolAcquireParams -> IO Int64
bufferPoolAcquireParamsReadStart s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO Int64
    return val

bufferPoolAcquireParamsReadStop :: BufferPoolAcquireParams -> IO Int64
bufferPoolAcquireParamsReadStop s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Int64
    return val

bufferPoolAcquireParamsReadFlags :: BufferPoolAcquireParams -> IO [BufferPoolAcquireFlags]
bufferPoolAcquireParamsReadFlags s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO CUInt
    let val' = wordToGFlags val
    return val'

type family ResolveBufferPoolAcquireParamsMethod (t :: Symbol) (o :: *) :: * where
    ResolveBufferPoolAcquireParamsMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveBufferPoolAcquireParamsMethod t BufferPoolAcquireParams, MethodInfo info BufferPoolAcquireParams p) => IsLabelProxy t (BufferPoolAcquireParams -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveBufferPoolAcquireParamsMethod t BufferPoolAcquireParams, MethodInfo info BufferPoolAcquireParams p) => IsLabel t (BufferPoolAcquireParams -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif