gi-gst-0.1.6.13: GI/Gst/Structs/MapInfo.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)
A structure containing the result of a map operation such as
gst_memory_map(). It contains the data and size.
-}
module GI.Gst.Structs.MapInfo
(
-- * Exported types
MapInfo(..) ,
newZeroMapInfo ,
noMapInfo ,
-- * Properties
-- ** Flags
mapInfoReadFlags ,
-- ** Maxsize
mapInfoReadMaxsize ,
-- ** Memory
mapInfoReadMemory ,
-- ** Size
mapInfoReadSize ,
) 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 MapInfo = MapInfo (ForeignPtr MapInfo)
-- | Construct a `MapInfo` struct initialized to zero.
newZeroMapInfo :: MonadIO m => m MapInfo
newZeroMapInfo = liftIO $ callocBytes 104 >>= wrapPtr MapInfo
noMapInfo :: Maybe MapInfo
noMapInfo = Nothing
mapInfoReadMemory :: MapInfo -> IO Memory
mapInfoReadMemory s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr Memory)
val' <- (newBoxed Memory) val
return val'
mapInfoReadFlags :: MapInfo -> IO [MapFlags]
mapInfoReadFlags s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CUInt
let val' = wordToGFlags val
return val'
-- XXX Skipped getter for "MapInfo:data" :: Not implemented: "Don't know how to unpack C array of type TCArray False (-1) 3 (TBasicType TUInt8)"
mapInfoReadSize :: MapInfo -> IO Word64
mapInfoReadSize s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO Word64
return val
mapInfoReadMaxsize :: MapInfo -> IO Word64
mapInfoReadMaxsize s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO Word64
return val
-- XXX Skipped getter for "MapInfo:user_data" :: Not implemented: "Don't know how to unpack C array of type TCArray False 4 (-1) (TBasicType TVoid)"
type family ResolveMapInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveMapInfoMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveMapInfoMethod t MapInfo, MethodInfo info MapInfo p) => IsLabelProxy t (MapInfo -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveMapInfoMethod t MapInfo, MethodInfo info MapInfo p) => IsLabel t (MapInfo -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif