packages feed

gi-gst-0.1.6.13: GI/Gst/Structs/ParentBufferMeta.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)

The #GstParentBufferMeta is a #GstMeta which can be attached to a #GstBuffer
to hold a reference to another buffer that is only released when the child
#GstBuffer is released.

Typically, #GstParentBufferMeta is used when the child buffer is directly
using the #GstMemory of the parent buffer, and wants to prevent the parent
buffer from being returned to a buffer pool until the #GstMemory is available
for re-use.
-}

module GI.Gst.Structs.ParentBufferMeta
    ( 

-- * Exported types
    ParentBufferMeta(..)                    ,
    newZeroParentBufferMeta                 ,
    noParentBufferMeta                      ,


 -- * Methods
-- ** parentBufferMetaGetInfo
    parentBufferMetaGetInfo                 ,




 -- * Properties
-- ** Buffer
    parentBufferMetaReadBuffer              ,


-- ** Parent
    parentBufferMetaReadParent              ,




    ) 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 ParentBufferMeta = ParentBufferMeta (ForeignPtr ParentBufferMeta)
-- | Construct a `ParentBufferMeta` struct initialized to zero.
newZeroParentBufferMeta :: MonadIO m => m ParentBufferMeta
newZeroParentBufferMeta = liftIO $ callocBytes 24 >>= wrapPtr ParentBufferMeta

noParentBufferMeta :: Maybe ParentBufferMeta
noParentBufferMeta = Nothing

parentBufferMetaReadParent :: ParentBufferMeta -> IO Meta
parentBufferMetaReadParent s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (Ptr Meta)
    val' <- (newPtr 16 Meta) val
    return val'

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

-- method ParentBufferMeta::get_info
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : TInterface "Gst" "MetaInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gst_parent_buffer_meta_get_info" gst_parent_buffer_meta_get_info :: 
    IO (Ptr MetaInfo)


parentBufferMetaGetInfo ::
    (MonadIO m) =>
    m MetaInfo                              -- result
parentBufferMetaGetInfo  = liftIO $ do
    result <- gst_parent_buffer_meta_get_info
    checkUnexpectedReturnNULL "gst_parent_buffer_meta_get_info" result
    result' <- (newPtr 80 MetaInfo) result
    return result'

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

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

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