packages feed

gi-gstbase-0.1.6.13: GI/GstBase/Structs/CollectData.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)

Structure used by the collect_pads.
-}

module GI.GstBase.Structs.CollectData
    ( 

-- * Exported types
    CollectData(..)                         ,
    newZeroCollectData                      ,
    noCollectData                           ,


 -- * Properties
-- ** Buffer
    collectDataReadBuffer                   ,


-- ** Collect
    collectDataReadCollect                  ,


-- ** Pad
    collectDataReadPad                      ,


-- ** Pos
    collectDataReadPos                      ,


-- ** Segment
    collectDataReadSegment                  ,




    ) 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.GstBase.Types
import GI.GstBase.Callbacks
import qualified GI.Gst as Gst

newtype CollectData = CollectData (ForeignPtr CollectData)
-- | Construct a `CollectData` struct initialized to zero.
newZeroCollectData :: MonadIO m => m CollectData
newZeroCollectData = liftIO $ callocBytes 168 >>= wrapPtr CollectData

noCollectData :: Maybe CollectData
noCollectData = Nothing

collectDataReadCollect :: CollectData -> IO CollectPads
collectDataReadCollect s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (Ptr CollectPads)
    val' <- (newObject CollectPads) val
    return val'

collectDataReadPad :: CollectData -> IO Gst.Pad
collectDataReadPad s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO (Ptr Gst.Pad)
    val' <- (newObject Gst.Pad) val
    return val'

collectDataReadBuffer :: CollectData -> IO Gst.Buffer
collectDataReadBuffer s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO (Ptr Gst.Buffer)
    val' <- (newBoxed Gst.Buffer) val
    return val'

collectDataReadPos :: CollectData -> IO Word32
collectDataReadPos s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO Word32
    return val

collectDataReadSegment :: CollectData -> IO Gst.Segment
collectDataReadSegment s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 32) :: IO (Ptr Gst.Segment)
    val' <- (newBoxed Gst.Segment) val
    return val'

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

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

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