{- | 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 describing the color info. -} module GI.GstVideo.Structs.VideoColorimetry ( -- * Exported types VideoColorimetry(..) , newZeroVideoColorimetry , noVideoColorimetry , -- * Methods -- ** videoColorimetryFromString VideoColorimetryFromStringMethodInfo , videoColorimetryFromString , -- ** videoColorimetryIsEqual VideoColorimetryIsEqualMethodInfo , videoColorimetryIsEqual , -- ** videoColorimetryMatches VideoColorimetryMatchesMethodInfo , videoColorimetryMatches , -- ** videoColorimetryToString VideoColorimetryToStringMethodInfo , videoColorimetryToString , -- * Properties -- ** Matrix videoColorimetryReadMatrix , -- ** Primaries videoColorimetryReadPrimaries , -- ** Range videoColorimetryReadRange , -- ** Transfer videoColorimetryReadTransfer , ) 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 newtype VideoColorimetry = VideoColorimetry (ForeignPtr VideoColorimetry) -- | Construct a `VideoColorimetry` struct initialized to zero. newZeroVideoColorimetry :: MonadIO m => m VideoColorimetry newZeroVideoColorimetry = liftIO $ callocBytes 16 >>= wrapPtr VideoColorimetry noVideoColorimetry :: Maybe VideoColorimetry noVideoColorimetry = Nothing videoColorimetryReadRange :: VideoColorimetry -> IO VideoColorRange videoColorimetryReadRange s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO CUInt let val' = (toEnum . fromIntegral) val return val' videoColorimetryReadMatrix :: VideoColorimetry -> IO VideoColorMatrix videoColorimetryReadMatrix s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 4) :: IO CUInt let val' = (toEnum . fromIntegral) val return val' videoColorimetryReadTransfer :: VideoColorimetry -> IO VideoTransferFunction videoColorimetryReadTransfer s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO CUInt let val' = (toEnum . fromIntegral) val return val' videoColorimetryReadPrimaries :: VideoColorimetry -> IO VideoColorPrimaries videoColorimetryReadPrimaries s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 12) :: IO CUInt let val' = (toEnum . fromIntegral) val return val' -- method VideoColorimetry::from_string -- method type : OrdinaryMethod -- Args : [Arg {argCName = "_obj", argType = TInterface "GstVideo" "VideoColorimetry", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "color", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "gst_video_colorimetry_from_string" gst_video_colorimetry_from_string :: Ptr VideoColorimetry -> -- _obj : TInterface "GstVideo" "VideoColorimetry" CString -> -- color : TBasicType TUTF8 IO CInt videoColorimetryFromString :: (MonadIO m) => VideoColorimetry -- _obj -> T.Text -- color -> m Bool -- result videoColorimetryFromString _obj color = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj color' <- textToCString color result <- gst_video_colorimetry_from_string _obj' color' let result' = (/= 0) result touchManagedPtr _obj freeMem color' return result' data VideoColorimetryFromStringMethodInfo instance (signature ~ (T.Text -> m Bool), MonadIO m) => MethodInfo VideoColorimetryFromStringMethodInfo VideoColorimetry signature where overloadedMethod _ = videoColorimetryFromString -- method VideoColorimetry::is_equal -- method type : OrdinaryMethod -- Args : [Arg {argCName = "_obj", argType = TInterface "GstVideo" "VideoColorimetry", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "other", argType = TInterface "GstVideo" "VideoColorimetry", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "gst_video_colorimetry_is_equal" gst_video_colorimetry_is_equal :: Ptr VideoColorimetry -> -- _obj : TInterface "GstVideo" "VideoColorimetry" Ptr VideoColorimetry -> -- other : TInterface "GstVideo" "VideoColorimetry" IO CInt videoColorimetryIsEqual :: (MonadIO m) => VideoColorimetry -- _obj -> VideoColorimetry -- other -> m Bool -- result videoColorimetryIsEqual _obj other = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let other' = unsafeManagedPtrGetPtr other result <- gst_video_colorimetry_is_equal _obj' other' let result' = (/= 0) result touchManagedPtr _obj touchManagedPtr other return result' data VideoColorimetryIsEqualMethodInfo instance (signature ~ (VideoColorimetry -> m Bool), MonadIO m) => MethodInfo VideoColorimetryIsEqualMethodInfo VideoColorimetry signature where overloadedMethod _ = videoColorimetryIsEqual -- method VideoColorimetry::matches -- method type : OrdinaryMethod -- Args : [Arg {argCName = "_obj", argType = TInterface "GstVideo" "VideoColorimetry", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "color", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "gst_video_colorimetry_matches" gst_video_colorimetry_matches :: Ptr VideoColorimetry -> -- _obj : TInterface "GstVideo" "VideoColorimetry" CString -> -- color : TBasicType TUTF8 IO CInt videoColorimetryMatches :: (MonadIO m) => VideoColorimetry -- _obj -> T.Text -- color -> m Bool -- result videoColorimetryMatches _obj color = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj color' <- textToCString color result <- gst_video_colorimetry_matches _obj' color' let result' = (/= 0) result touchManagedPtr _obj freeMem color' return result' data VideoColorimetryMatchesMethodInfo instance (signature ~ (T.Text -> m Bool), MonadIO m) => MethodInfo VideoColorimetryMatchesMethodInfo VideoColorimetry signature where overloadedMethod _ = videoColorimetryMatches -- method VideoColorimetry::to_string -- method type : OrdinaryMethod -- Args : [Arg {argCName = "_obj", argType = TInterface "GstVideo" "VideoColorimetry", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "gst_video_colorimetry_to_string" gst_video_colorimetry_to_string :: Ptr VideoColorimetry -> -- _obj : TInterface "GstVideo" "VideoColorimetry" IO CString videoColorimetryToString :: (MonadIO m) => VideoColorimetry -- _obj -> m T.Text -- result videoColorimetryToString _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- gst_video_colorimetry_to_string _obj' checkUnexpectedReturnNULL "gst_video_colorimetry_to_string" result result' <- cstringToText result freeMem result touchManagedPtr _obj return result' data VideoColorimetryToStringMethodInfo instance (signature ~ (m T.Text), MonadIO m) => MethodInfo VideoColorimetryToStringMethodInfo VideoColorimetry signature where overloadedMethod _ = videoColorimetryToString type family ResolveVideoColorimetryMethod (t :: Symbol) (o :: *) :: * where ResolveVideoColorimetryMethod "fromString" o = VideoColorimetryFromStringMethodInfo ResolveVideoColorimetryMethod "isEqual" o = VideoColorimetryIsEqualMethodInfo ResolveVideoColorimetryMethod "matches" o = VideoColorimetryMatchesMethodInfo ResolveVideoColorimetryMethod "toString" o = VideoColorimetryToStringMethodInfo ResolveVideoColorimetryMethod l o = MethodResolutionFailed l o instance (info ~ ResolveVideoColorimetryMethod t VideoColorimetry, MethodInfo info VideoColorimetry p) => IsLabelProxy t (VideoColorimetry -> p) where fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveVideoColorimetryMethod t VideoColorimetry, MethodInfo info VideoColorimetry p) => IsLabel t (VideoColorimetry -> p) where fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info) #endif