packages feed

gi-gst-0.1.6.13: GI/Gst/Structs/MetaInfo.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 #GstMetaInfo provides information about a specific metadata
structure.
-}

module GI.Gst.Structs.MetaInfo
    ( 

-- * Exported types
    MetaInfo(..)                            ,
    newZeroMetaInfo                         ,
    noMetaInfo                              ,


 -- * Properties
-- ** Api
    metaInfoReadApi                         ,


-- ** Size
    metaInfoReadSize                        ,


-- ** Type
    metaInfoReadType                        ,




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

noMetaInfo :: Maybe MetaInfo
noMetaInfo = Nothing

metaInfoReadApi :: MetaInfo -> IO GType
metaInfoReadApi s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CGType
    let val' = GType val
    return val'

metaInfoReadType :: MetaInfo -> IO GType
metaInfoReadType s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CGType
    let val' = GType val
    return val'

metaInfoReadSize :: MetaInfo -> IO Word64
metaInfoReadSize s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Word64
    return val

-- XXX Skipped getter for "MetaInfo:init_func" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

-- XXX Skipped getter for "MetaInfo:free_func" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

-- XXX Skipped getter for "MetaInfo:transform_func" :: Not implemented: "Wrapping foreign callbacks is not supported yet"

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

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

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