{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gst.Objects.ControlSource
(
ControlSource(..) ,
IsControlSource ,
toControlSource ,
#if defined(ENABLE_OVERLOADING)
ResolveControlSourceMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ControlSourceControlSourceGetValueMethodInfo,
#endif
controlSourceControlSourceGetValue ,
#if defined(ENABLE_OVERLOADING)
ControlSourceControlSourceGetValueArrayMethodInfo,
#endif
controlSourceControlSourceGetValueArray ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
newtype ControlSource = ControlSource (SP.ManagedPtr ControlSource)
deriving (ControlSource -> ControlSource -> Bool
(ControlSource -> ControlSource -> Bool)
-> (ControlSource -> ControlSource -> Bool) -> Eq ControlSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControlSource -> ControlSource -> Bool
$c/= :: ControlSource -> ControlSource -> Bool
== :: ControlSource -> ControlSource -> Bool
$c== :: ControlSource -> ControlSource -> Bool
Eq)
instance SP.ManagedPtrNewtype ControlSource where
toManagedPtr :: ControlSource -> ManagedPtr ControlSource
toManagedPtr (ControlSource ManagedPtr ControlSource
p) = ManagedPtr ControlSource
p
foreign import ccall "gst_control_source_get_type"
c_gst_control_source_get_type :: IO B.Types.GType
instance B.Types.TypedObject ControlSource where
glibType :: IO GType
glibType = IO GType
c_gst_control_source_get_type
instance B.Types.GObject ControlSource
class (SP.GObject o, O.IsDescendantOf ControlSource o) => IsControlSource o
instance (SP.GObject o, O.IsDescendantOf ControlSource o) => IsControlSource o
instance O.HasParentTypes ControlSource
type instance O.ParentTypes ControlSource = '[Gst.Object.Object, GObject.Object.Object]
toControlSource :: (MIO.MonadIO m, IsControlSource o) => o -> m ControlSource
toControlSource :: forall (m :: * -> *) o.
(MonadIO m, IsControlSource o) =>
o -> m ControlSource
toControlSource = IO ControlSource -> m ControlSource
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ControlSource -> m ControlSource)
-> (o -> IO ControlSource) -> o -> m ControlSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ControlSource -> ControlSource)
-> o -> IO ControlSource
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ControlSource -> ControlSource
ControlSource
instance B.GValue.IsGValue (Maybe ControlSource) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gst_control_source_get_type
gvalueSet_ :: Ptr GValue -> Maybe ControlSource -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ControlSource
P.Nothing = Ptr GValue -> Ptr ControlSource -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ControlSource
forall a. Ptr a
FP.nullPtr :: FP.Ptr ControlSource)
gvalueSet_ Ptr GValue
gv (P.Just ControlSource
obj) = ControlSource -> (Ptr ControlSource -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ControlSource
obj (Ptr GValue -> Ptr ControlSource -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe ControlSource)
gvalueGet_ Ptr GValue
gv = do
Ptr ControlSource
ptr <- Ptr GValue -> IO (Ptr ControlSource)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ControlSource)
if Ptr ControlSource
ptr Ptr ControlSource -> Ptr ControlSource -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ControlSource
forall a. Ptr a
FP.nullPtr
then ControlSource -> Maybe ControlSource
forall a. a -> Maybe a
P.Just (ControlSource -> Maybe ControlSource)
-> IO ControlSource -> IO (Maybe ControlSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr ControlSource -> ControlSource)
-> Ptr ControlSource -> IO ControlSource
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr ControlSource -> ControlSource
ControlSource Ptr ControlSource
ptr
else Maybe ControlSource -> IO (Maybe ControlSource)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ControlSource
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveControlSourceMethod (t :: Symbol) (o :: *) :: * where
ResolveControlSourceMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
ResolveControlSourceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveControlSourceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveControlSourceMethod "controlSourceGetValue" o = ControlSourceControlSourceGetValueMethodInfo
ResolveControlSourceMethod "controlSourceGetValueArray" o = ControlSourceControlSourceGetValueArrayMethodInfo
ResolveControlSourceMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
ResolveControlSourceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveControlSourceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveControlSourceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveControlSourceMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
ResolveControlSourceMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
ResolveControlSourceMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
ResolveControlSourceMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
ResolveControlSourceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveControlSourceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveControlSourceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveControlSourceMethod "ref" o = Gst.Object.ObjectRefMethodInfo
ResolveControlSourceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveControlSourceMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
ResolveControlSourceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveControlSourceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveControlSourceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveControlSourceMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
ResolveControlSourceMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
ResolveControlSourceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveControlSourceMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
ResolveControlSourceMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
ResolveControlSourceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveControlSourceMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
ResolveControlSourceMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
ResolveControlSourceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveControlSourceMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
ResolveControlSourceMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
ResolveControlSourceMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
ResolveControlSourceMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
ResolveControlSourceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveControlSourceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveControlSourceMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
ResolveControlSourceMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
ResolveControlSourceMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
ResolveControlSourceMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
ResolveControlSourceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveControlSourceMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveControlSourceMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
ResolveControlSourceMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
ResolveControlSourceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveControlSourceMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveControlSourceMethod t ControlSource, O.OverloadedMethod info ControlSource p) => OL.IsLabel t (ControlSource -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveControlSourceMethod t ControlSource, O.OverloadedMethod info ControlSource p, R.HasField t ControlSource p) => R.HasField t ControlSource p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveControlSourceMethod t ControlSource, O.OverloadedMethodInfo info ControlSource) => OL.IsLabel t (O.MethodProxy info ControlSource) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ControlSource
type instance O.AttributeList ControlSource = ControlSourceAttributeList
type ControlSourceAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ControlSource = ControlSourceSignalList
type ControlSourceSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gst_control_source_get_value" gst_control_source_get_value ::
Ptr ControlSource ->
Word64 ->
Ptr CDouble ->
IO CInt
controlSourceControlSourceGetValue ::
(B.CallStack.HasCallStack, MonadIO m, IsControlSource a) =>
a
-> Word64
-> m ((Bool, Double))
controlSourceControlSourceGetValue :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsControlSource a) =>
a -> Word64 -> m (Bool, Double)
controlSourceControlSourceGetValue a
self Word64
timestamp = IO (Bool, Double) -> m (Bool, Double)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Double) -> m (Bool, Double))
-> IO (Bool, Double) -> m (Bool, Double)
forall a b. (a -> b) -> a -> b
$ do
Ptr ControlSource
self' <- a -> IO (Ptr ControlSource)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr CDouble
value <- IO (Ptr CDouble)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CDouble)
CInt
result <- Ptr ControlSource -> Word64 -> Ptr CDouble -> IO CInt
gst_control_source_get_value Ptr ControlSource
self' Word64
timestamp Ptr CDouble
value
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
CDouble
value' <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek Ptr CDouble
value
let value'' :: Double
value'' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
value'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
Ptr CDouble -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CDouble
value
(Bool, Double) -> IO (Bool, Double)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Double
value'')
#if defined(ENABLE_OVERLOADING)
data ControlSourceControlSourceGetValueMethodInfo
instance (signature ~ (Word64 -> m ((Bool, Double))), MonadIO m, IsControlSource a) => O.OverloadedMethod ControlSourceControlSourceGetValueMethodInfo a signature where
overloadedMethod = controlSourceControlSourceGetValue
instance O.OverloadedMethodInfo ControlSourceControlSourceGetValueMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Objects.ControlSource.controlSourceControlSourceGetValue",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Objects-ControlSource.html#v:controlSourceControlSourceGetValue"
})
#endif
foreign import ccall "gst_control_source_get_value_array" gst_control_source_get_value_array ::
Ptr ControlSource ->
Word64 ->
Word64 ->
Word32 ->
Ptr CDouble ->
IO CInt
controlSourceControlSourceGetValueArray ::
(B.CallStack.HasCallStack, MonadIO m, IsControlSource a) =>
a
-> Word64
-> Word64
-> [Double]
-> m Bool
controlSourceControlSourceGetValueArray :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsControlSource a) =>
a -> Word64 -> Word64 -> [Double] -> m Bool
controlSourceControlSourceGetValueArray a
self Word64
timestamp Word64
interval [Double]
values = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
let nValues :: Word32
nValues = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [Double] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Double]
values
Ptr ControlSource
self' <- a -> IO (Ptr ControlSource)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr CDouble
values' <- ((Double -> CDouble) -> [Double] -> IO (Ptr CDouble)
forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b)
packMapStorableArray Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac) [Double]
values
CInt
result <- Ptr ControlSource
-> Word64 -> Word64 -> Word32 -> Ptr CDouble -> IO CInt
gst_control_source_get_value_array Ptr ControlSource
self' Word64
timestamp Word64
interval Word32
nValues Ptr CDouble
values'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
Ptr CDouble -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CDouble
values'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data ControlSourceControlSourceGetValueArrayMethodInfo
instance (signature ~ (Word64 -> Word64 -> [Double] -> m Bool), MonadIO m, IsControlSource a) => O.OverloadedMethod ControlSourceControlSourceGetValueArrayMethodInfo a signature where
overloadedMethod = controlSourceControlSourceGetValueArray
instance O.OverloadedMethodInfo ControlSourceControlSourceGetValueArrayMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Objects.ControlSource.controlSourceControlSourceGetValueArray",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Objects-ControlSource.html#v:controlSourceControlSourceGetValueArray"
})
#endif