gi-gst-1.0.18: GI/Gst/Objects/DeviceMonitor.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
Applications should create a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' when they want
to probe, list and monitor devices of a specific type. The
'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' will create the appropriate
'GI.Gst.Objects.DeviceProvider.DeviceProvider' objects and manage them. It will then post
messages on its 'GI.Gst.Objects.Bus.Bus' for devices that have been added and
removed.
The device monitor will monitor all devices matching the filters that
the application has set.
The basic use pattern of a device monitor is as follows:
>
> static gboolean
> my_bus_func (GstBus * bus, GstMessage * message, gpointer user_data)
> {
> GstDevice *device;
> gchar *name;
>
> switch (GST_MESSAGE_TYPE (message)) {
> case GST_MESSAGE_DEVICE_ADDED:
> gst_message_parse_device_added (message, &device);
> name = gst_device_get_display_name (device);
> g_print("Device added: %s\n", name);
> g_free (name);
> gst_object_unref (device);
> break;
> case GST_MESSAGE_DEVICE_REMOVED:
> gst_message_parse_device_removed (message, &device);
> name = gst_device_get_display_name (device);
> g_print("Device removed: %s\n", name);
> g_free (name);
> gst_object_unref (device);
> break;
> default:
> break;
> }
>
> return G_SOURCE_CONTINUE;
> }
>
> GstDeviceMonitor *
> setup_raw_video_source_device_monitor (void) {
> GstDeviceMonitor *monitor;
> GstBus *bus;
> GstCaps *caps;
>
> monitor = gst_device_monitor_new ();
>
> bus = gst_device_monitor_get_bus (monitor);
> gst_bus_add_watch (bus, my_bus_func, NULL);
> gst_object_unref (bus);
>
> caps = gst_caps_new_empty_simple ("video/x-raw");
> gst_device_monitor_add_filter (monitor, "Video/Source", caps);
> gst_caps_unref (caps);
>
> gst_device_monitor_start (monitor);
>
> return monitor;
> }
/Since: 1.4/
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gst.Objects.DeviceMonitor
(
-- * Exported types
DeviceMonitor(..) ,
IsDeviceMonitor ,
toDeviceMonitor ,
noDeviceMonitor ,
-- * Methods
-- ** addFilter #method:addFilter#
#if ENABLE_OVERLOADING
DeviceMonitorAddFilterMethodInfo ,
#endif
deviceMonitorAddFilter ,
-- ** getBus #method:getBus#
#if ENABLE_OVERLOADING
DeviceMonitorGetBusMethodInfo ,
#endif
deviceMonitorGetBus ,
-- ** getDevices #method:getDevices#
#if ENABLE_OVERLOADING
DeviceMonitorGetDevicesMethodInfo ,
#endif
deviceMonitorGetDevices ,
-- ** getProviders #method:getProviders#
#if ENABLE_OVERLOADING
DeviceMonitorGetProvidersMethodInfo ,
#endif
deviceMonitorGetProviders ,
-- ** getShowAllDevices #method:getShowAllDevices#
#if ENABLE_OVERLOADING
DeviceMonitorGetShowAllDevicesMethodInfo,
#endif
deviceMonitorGetShowAllDevices ,
-- ** new #method:new#
deviceMonitorNew ,
-- ** removeFilter #method:removeFilter#
#if ENABLE_OVERLOADING
DeviceMonitorRemoveFilterMethodInfo ,
#endif
deviceMonitorRemoveFilter ,
-- ** setShowAllDevices #method:setShowAllDevices#
#if ENABLE_OVERLOADING
DeviceMonitorSetShowAllDevicesMethodInfo,
#endif
deviceMonitorSetShowAllDevices ,
-- ** start #method:start#
#if ENABLE_OVERLOADING
DeviceMonitorStartMethodInfo ,
#endif
deviceMonitorStart ,
-- ** stop #method:stop#
#if ENABLE_OVERLOADING
DeviceMonitorStopMethodInfo ,
#endif
deviceMonitorStop ,
-- * Properties
-- ** showAll #attr:showAll#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
DeviceMonitorShowAllPropertyInfo ,
#endif
constructDeviceMonitorShowAll ,
#if ENABLE_OVERLOADING
deviceMonitorShowAll ,
#endif
getDeviceMonitorShowAll ,
setDeviceMonitorShowAll ,
) 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.ManagedPtr as B.ManagedPtr
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.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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Bus as Gst.Bus
import {-# SOURCE #-} qualified GI.Gst.Objects.Device as Gst.Device
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
-- | Memory-managed wrapper type.
newtype DeviceMonitor = DeviceMonitor (ManagedPtr DeviceMonitor)
foreign import ccall "gst_device_monitor_get_type"
c_gst_device_monitor_get_type :: IO GType
instance GObject DeviceMonitor where
gobjectType = c_gst_device_monitor_get_type
-- | Type class for types which can be safely cast to `DeviceMonitor`, for instance with `toDeviceMonitor`.
class (GObject o, O.IsDescendantOf DeviceMonitor o) => IsDeviceMonitor o
instance (GObject o, O.IsDescendantOf DeviceMonitor o) => IsDeviceMonitor o
instance O.HasParentTypes DeviceMonitor
type instance O.ParentTypes DeviceMonitor = '[Gst.Object.Object, GObject.Object.Object]
-- | Cast to `DeviceMonitor`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDeviceMonitor :: (MonadIO m, IsDeviceMonitor o) => o -> m DeviceMonitor
toDeviceMonitor = liftIO . unsafeCastTo DeviceMonitor
-- | A convenience alias for `Nothing` :: `Maybe` `DeviceMonitor`.
noDeviceMonitor :: Maybe DeviceMonitor
noDeviceMonitor = Nothing
#if ENABLE_OVERLOADING
type family ResolveDeviceMonitorMethod (t :: Symbol) (o :: *) :: * where
ResolveDeviceMonitorMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
ResolveDeviceMonitorMethod "addFilter" o = DeviceMonitorAddFilterMethodInfo
ResolveDeviceMonitorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDeviceMonitorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDeviceMonitorMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
ResolveDeviceMonitorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDeviceMonitorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDeviceMonitorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDeviceMonitorMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
ResolveDeviceMonitorMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
ResolveDeviceMonitorMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
ResolveDeviceMonitorMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
ResolveDeviceMonitorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDeviceMonitorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDeviceMonitorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDeviceMonitorMethod "ref" o = Gst.Object.ObjectRefMethodInfo
ResolveDeviceMonitorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDeviceMonitorMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
ResolveDeviceMonitorMethod "removeFilter" o = DeviceMonitorRemoveFilterMethodInfo
ResolveDeviceMonitorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDeviceMonitorMethod "start" o = DeviceMonitorStartMethodInfo
ResolveDeviceMonitorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDeviceMonitorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDeviceMonitorMethod "stop" o = DeviceMonitorStopMethodInfo
ResolveDeviceMonitorMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
ResolveDeviceMonitorMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
ResolveDeviceMonitorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDeviceMonitorMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
ResolveDeviceMonitorMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
ResolveDeviceMonitorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDeviceMonitorMethod "getBus" o = DeviceMonitorGetBusMethodInfo
ResolveDeviceMonitorMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
ResolveDeviceMonitorMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
ResolveDeviceMonitorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDeviceMonitorMethod "getDevices" o = DeviceMonitorGetDevicesMethodInfo
ResolveDeviceMonitorMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
ResolveDeviceMonitorMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
ResolveDeviceMonitorMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
ResolveDeviceMonitorMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
ResolveDeviceMonitorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDeviceMonitorMethod "getProviders" o = DeviceMonitorGetProvidersMethodInfo
ResolveDeviceMonitorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDeviceMonitorMethod "getShowAllDevices" o = DeviceMonitorGetShowAllDevicesMethodInfo
ResolveDeviceMonitorMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
ResolveDeviceMonitorMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
ResolveDeviceMonitorMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
ResolveDeviceMonitorMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
ResolveDeviceMonitorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDeviceMonitorMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
ResolveDeviceMonitorMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
ResolveDeviceMonitorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDeviceMonitorMethod "setShowAllDevices" o = DeviceMonitorSetShowAllDevicesMethodInfo
ResolveDeviceMonitorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDeviceMonitorMethod t DeviceMonitor, O.MethodInfo info DeviceMonitor p) => OL.IsLabel t (DeviceMonitor -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
-- VVV Prop "show-all"
-- Type: TBasicType TBoolean
-- Flags: [PropertyReadable,PropertyWritable]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@show-all@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' deviceMonitor #showAll
@
-}
getDeviceMonitorShowAll :: (MonadIO m, IsDeviceMonitor o) => o -> m Bool
getDeviceMonitorShowAll obj = liftIO $ B.Properties.getObjectPropertyBool obj "show-all"
{- |
Set the value of the “@show-all@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' deviceMonitor [ #showAll 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDeviceMonitorShowAll :: (MonadIO m, IsDeviceMonitor o) => o -> Bool -> m ()
setDeviceMonitorShowAll obj val = liftIO $ B.Properties.setObjectPropertyBool obj "show-all" val
{- |
Construct a `GValueConstruct` with valid value for the “@show-all@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDeviceMonitorShowAll :: (IsDeviceMonitor o) => Bool -> IO (GValueConstruct o)
constructDeviceMonitorShowAll val = B.Properties.constructObjectPropertyBool "show-all" val
#if ENABLE_OVERLOADING
data DeviceMonitorShowAllPropertyInfo
instance AttrInfo DeviceMonitorShowAllPropertyInfo where
type AttrAllowedOps DeviceMonitorShowAllPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint DeviceMonitorShowAllPropertyInfo = (~) Bool
type AttrBaseTypeConstraint DeviceMonitorShowAllPropertyInfo = IsDeviceMonitor
type AttrGetType DeviceMonitorShowAllPropertyInfo = Bool
type AttrLabel DeviceMonitorShowAllPropertyInfo = "show-all"
type AttrOrigin DeviceMonitorShowAllPropertyInfo = DeviceMonitor
attrGet _ = getDeviceMonitorShowAll
attrSet _ = setDeviceMonitorShowAll
attrConstruct _ = constructDeviceMonitorShowAll
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList DeviceMonitor
type instance O.AttributeList DeviceMonitor = DeviceMonitorAttributeList
type DeviceMonitorAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("showAll", DeviceMonitorShowAllPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
deviceMonitorShowAll :: AttrLabelProxy "showAll"
deviceMonitorShowAll = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList DeviceMonitor = DeviceMonitorSignalList
type DeviceMonitorSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method DeviceMonitor::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_new" gst_device_monitor_new ::
IO (Ptr DeviceMonitor)
{- |
Create a new 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor'
/Since: 1.4/
-}
deviceMonitorNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m DeviceMonitor
{- ^ __Returns:__ a new device monitor. -}
deviceMonitorNew = liftIO $ do
result <- gst_device_monitor_new
checkUnexpectedReturnNULL "deviceMonitorNew" result
result' <- (wrapObject DeviceMonitor) result
return result'
#if ENABLE_OVERLOADING
#endif
-- method DeviceMonitor::add_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a device monitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "classes", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "device classes to use as filter or %NULL for any class", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GstCaps to filter or %NULL for ANY", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_add_filter" gst_device_monitor_add_filter ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
CString -> -- classes : TBasicType TUTF8
Ptr Gst.Caps.Caps -> -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
IO Word32
{- |
Adds a filter for which 'GI.Gst.Objects.Device.Device' will be monitored, any device that matches
all these classes and the 'GI.Gst.Structs.Caps.Caps' will be returned.
If this function is called multiple times to add more filters, each will be
matched independently. That is, adding more filters will not further restrict
what devices are matched.
The 'GI.Gst.Structs.Caps.Caps' supported by the device as returned by 'GI.Gst.Objects.Device.deviceGetCaps' are
not intersected with caps filters added using this function.
Filters must be added before the 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' is started.
/Since: 1.4/
-}
deviceMonitorAddFilter ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: a device monitor -}
-> Maybe (T.Text)
{- ^ /@classes@/: device classes to use as filter or 'Nothing' for any class -}
-> Maybe (Gst.Caps.Caps)
{- ^ /@caps@/: the 'GI.Gst.Structs.Caps.Caps' to filter or 'Nothing' for ANY -}
-> m Word32
{- ^ __Returns:__ The id of the new filter or 0 if no provider matched the filter\'s
classes. -}
deviceMonitorAddFilter monitor classes caps = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
maybeClasses <- case classes of
Nothing -> return nullPtr
Just jClasses -> do
jClasses' <- textToCString jClasses
return jClasses'
maybeCaps <- case caps of
Nothing -> return nullPtr
Just jCaps -> do
jCaps' <- unsafeManagedPtrGetPtr jCaps
return jCaps'
result <- gst_device_monitor_add_filter monitor' maybeClasses maybeCaps
touchManagedPtr monitor
whenJust caps touchManagedPtr
freeMem maybeClasses
return result
#if ENABLE_OVERLOADING
data DeviceMonitorAddFilterMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (Gst.Caps.Caps) -> m Word32), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorAddFilterMethodInfo a signature where
overloadedMethod _ = deviceMonitorAddFilter
#endif
-- method DeviceMonitor::get_bus
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDeviceProvider", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Bus"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_get_bus" gst_device_monitor_get_bus ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
IO (Ptr Gst.Bus.Bus)
{- |
Gets the 'GI.Gst.Objects.Bus.Bus' of this 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor'
/Since: 1.4/
-}
deviceMonitorGetBus ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: a 'GI.Gst.Objects.DeviceProvider.DeviceProvider' -}
-> m Gst.Bus.Bus
{- ^ __Returns:__ a 'GI.Gst.Objects.Bus.Bus' -}
deviceMonitorGetBus monitor = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
result <- gst_device_monitor_get_bus monitor'
checkUnexpectedReturnNULL "deviceMonitorGetBus" result
result' <- (wrapObject Gst.Bus.Bus) result
touchManagedPtr monitor
return result'
#if ENABLE_OVERLOADING
data DeviceMonitorGetBusMethodInfo
instance (signature ~ (m Gst.Bus.Bus), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorGetBusMethodInfo a signature where
overloadedMethod _ = deviceMonitorGetBus
#endif
-- method DeviceMonitor::get_devices
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstDeviceProvider", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "Device"})))
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_get_devices" gst_device_monitor_get_devices ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
IO (Ptr (GList (Ptr Gst.Device.Device)))
{- |
Gets a list of devices from all of the relevant monitors. This may actually
probe the hardware if the monitor is not currently started.
/Since: 1.4/
-}
deviceMonitorGetDevices ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: A 'GI.Gst.Objects.DeviceProvider.DeviceProvider' -}
-> m [Gst.Device.Device]
{- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
'GI.Gst.Objects.Device.Device' -}
deviceMonitorGetDevices monitor = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
result <- gst_device_monitor_get_devices monitor'
result' <- unpackGList result
result'' <- mapM (wrapObject Gst.Device.Device) result'
g_list_free result
touchManagedPtr monitor
return result''
#if ENABLE_OVERLOADING
data DeviceMonitorGetDevicesMethodInfo
instance (signature ~ (m [Gst.Device.Device]), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorGetDevicesMethodInfo a signature where
overloadedMethod _ = deviceMonitorGetDevices
#endif
-- method DeviceMonitor::get_providers
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDeviceMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_get_providers" gst_device_monitor_get_providers ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
IO (Ptr CString)
{- |
Get a list of the currently selected device provider factories.
This
/Since: 1.6/
-}
deviceMonitorGetProviders ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' -}
-> m [T.Text]
{- ^ __Returns:__
A list of device provider factory names that are currently being
monitored by /@monitor@/ or 'Nothing' when nothing is being monitored. -}
deviceMonitorGetProviders monitor = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
result <- gst_device_monitor_get_providers monitor'
checkUnexpectedReturnNULL "deviceMonitorGetProviders" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr monitor
return result'
#if ENABLE_OVERLOADING
data DeviceMonitorGetProvidersMethodInfo
instance (signature ~ (m [T.Text]), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorGetProvidersMethodInfo a signature where
overloadedMethod _ = deviceMonitorGetProviders
#endif
-- method DeviceMonitor::get_show_all_devices
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDeviceMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_get_show_all_devices" gst_device_monitor_get_show_all_devices ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
IO CInt
{- |
Get if /@monitor@/ is curretly showing all devices, even those from hidden
providers.
/Since: 1.6/
-}
deviceMonitorGetShowAllDevices ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' -}
-> m Bool
{- ^ __Returns:__ 'True' when all devices will be shown. -}
deviceMonitorGetShowAllDevices monitor = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
result <- gst_device_monitor_get_show_all_devices monitor'
let result' = (/= 0) result
touchManagedPtr monitor
return result'
#if ENABLE_OVERLOADING
data DeviceMonitorGetShowAllDevicesMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorGetShowAllDevicesMethodInfo a signature where
overloadedMethod _ = deviceMonitorGetShowAllDevices
#endif
-- method DeviceMonitor::remove_filter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a device monitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter_id", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the id of the filter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_remove_filter" gst_device_monitor_remove_filter ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
Word32 -> -- filter_id : TBasicType TUInt
IO CInt
{- |
Removes a filter from the 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' using the id that was returned
by 'GI.Gst.Objects.DeviceMonitor.deviceMonitorAddFilter'.
/Since: 1.4/
-}
deviceMonitorRemoveFilter ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: a device monitor -}
-> Word32
{- ^ /@filterId@/: the id of the filter -}
-> m Bool
{- ^ __Returns:__ 'True' of the filter id was valid, 'False' otherwise -}
deviceMonitorRemoveFilter monitor filterId = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
result <- gst_device_monitor_remove_filter monitor' filterId
let result' = (/= 0) result
touchManagedPtr monitor
return result'
#if ENABLE_OVERLOADING
data DeviceMonitorRemoveFilterMethodInfo
instance (signature ~ (Word32 -> m Bool), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorRemoveFilterMethodInfo a signature where
overloadedMethod _ = deviceMonitorRemoveFilter
#endif
-- method DeviceMonitor::set_show_all_devices
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstDeviceMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "show_all", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "show all devices", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_set_show_all_devices" gst_device_monitor_set_show_all_devices ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
CInt -> -- show_all : TBasicType TBoolean
IO ()
{- |
Set if all devices should be visible, even those devices from hidden
providers. Setting /@showAll@/ to true might show some devices multiple times.
/Since: 1.6/
-}
deviceMonitorSetShowAllDevices ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' -}
-> Bool
{- ^ /@showAll@/: show all devices -}
-> m ()
deviceMonitorSetShowAllDevices monitor showAll = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
let showAll' = (fromIntegral . fromEnum) showAll
gst_device_monitor_set_show_all_devices monitor' showAll'
touchManagedPtr monitor
return ()
#if ENABLE_OVERLOADING
data DeviceMonitorSetShowAllDevicesMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorSetShowAllDevicesMethodInfo a signature where
overloadedMethod _ = deviceMonitorSetShowAllDevices
#endif
-- method DeviceMonitor::start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstDeviceMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_start" gst_device_monitor_start ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
IO CInt
{- |
Starts monitoring the devices, one this has succeeded, the
'GI.Gst.Flags.MessageTypeDeviceAdded' and 'GI.Gst.Flags.MessageTypeDeviceRemoved' messages
will be emitted on the bus when the list of devices changes.
/Since: 1.4/
-}
deviceMonitorStart ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: A 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor' -}
-> m Bool
{- ^ __Returns:__ 'True' if the device monitoring could be started -}
deviceMonitorStart monitor = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
result <- gst_device_monitor_start monitor'
let result' = (/= 0) result
touchManagedPtr monitor
return result'
#if ENABLE_OVERLOADING
data DeviceMonitorStartMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorStartMethodInfo a signature where
overloadedMethod _ = deviceMonitorStart
#endif
-- method DeviceMonitor::stop
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gst", name = "DeviceMonitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstDeviceProvider", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_device_monitor_stop" gst_device_monitor_stop ::
Ptr DeviceMonitor -> -- monitor : TInterface (Name {namespace = "Gst", name = "DeviceMonitor"})
IO ()
{- |
Stops monitoring the devices.
/Since: 1.4/
-}
deviceMonitorStop ::
(B.CallStack.HasCallStack, MonadIO m, IsDeviceMonitor a) =>
a
{- ^ /@monitor@/: A 'GI.Gst.Objects.DeviceProvider.DeviceProvider' -}
-> m ()
deviceMonitorStop monitor = liftIO $ do
monitor' <- unsafeManagedPtrCastPtr monitor
gst_device_monitor_stop monitor'
touchManagedPtr monitor
return ()
#if ENABLE_OVERLOADING
data DeviceMonitorStopMethodInfo
instance (signature ~ (m ()), MonadIO m, IsDeviceMonitor a) => O.MethodInfo DeviceMonitorStopMethodInfo a signature where
overloadedMethod _ = deviceMonitorStop
#endif