packages feed

gi-gstvideo-0.1.6.13: GI/GstVideo/Structs/VideoCropMeta.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)

Extra buffer metadata describing image cropping.
-}

module GI.GstVideo.Structs.VideoCropMeta
    ( 

-- * Exported types
    VideoCropMeta(..)                       ,
    newZeroVideoCropMeta                    ,
    noVideoCropMeta                         ,


 -- * Methods
-- ** videoCropMetaGetInfo
    videoCropMetaGetInfo                    ,




 -- * Properties
-- ** Height
    videoCropMetaReadHeight                 ,


-- ** Meta
    videoCropMetaReadMeta                   ,


-- ** Width
    videoCropMetaReadWidth                  ,


-- ** X
    videoCropMetaReadX                      ,


-- ** Y
    videoCropMetaReadY                      ,




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

newtype VideoCropMeta = VideoCropMeta (ForeignPtr VideoCropMeta)
-- | Construct a `VideoCropMeta` struct initialized to zero.
newZeroVideoCropMeta :: MonadIO m => m VideoCropMeta
newZeroVideoCropMeta = liftIO $ callocBytes 32 >>= wrapPtr VideoCropMeta

noVideoCropMeta :: Maybe VideoCropMeta
noVideoCropMeta = Nothing

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

videoCropMetaReadX :: VideoCropMeta -> IO Word32
videoCropMetaReadX s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Word32
    return val

videoCropMetaReadY :: VideoCropMeta -> IO Word32
videoCropMetaReadY s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO Word32
    return val

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

videoCropMetaReadHeight :: VideoCropMeta -> IO Word32
videoCropMetaReadHeight s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 28) :: IO Word32
    return val

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

foreign import ccall "gst_video_crop_meta_get_info" gst_video_crop_meta_get_info :: 
    IO (Ptr Gst.MetaInfo)


videoCropMetaGetInfo ::
    (MonadIO m) =>
    m Gst.MetaInfo                          -- result
videoCropMetaGetInfo  = liftIO $ do
    result <- gst_video_crop_meta_get_info
    checkUnexpectedReturnNULL "gst_video_crop_meta_get_info" result
    result' <- (newPtr 80 Gst.MetaInfo) result
    return result'

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

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

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