gi-gst-1.0.23: GStreamer bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gst.Objects.DeviceMonitor

Description

Applications should create a DeviceMonitor when they want to probe, list and monitor devices of a specific type. The DeviceMonitor will create the appropriate DeviceProvider objects and manage them. It will then post messages on its 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: %sn", 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: %sn", 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

Synopsis

Exported types

newtype DeviceMonitor Source #

Memory-managed wrapper type.

Constructors

DeviceMonitor (ManagedPtr DeviceMonitor) 

Instances

Instances details
Eq DeviceMonitor Source # 
Instance details

Defined in GI.Gst.Objects.DeviceMonitor

GObject DeviceMonitor Source # 
Instance details

Defined in GI.Gst.Objects.DeviceMonitor

ManagedPtrNewtype DeviceMonitor Source # 
Instance details

Defined in GI.Gst.Objects.DeviceMonitor

Methods

toManagedPtr :: DeviceMonitor -> ManagedPtr DeviceMonitor

TypedObject DeviceMonitor Source # 
Instance details

Defined in GI.Gst.Objects.DeviceMonitor

Methods

glibType :: IO GType

IsGValue DeviceMonitor Source #

Convert DeviceMonitor to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gst.Objects.DeviceMonitor

Methods

toGValue :: DeviceMonitor -> IO GValue

fromGValue :: GValue -> IO DeviceMonitor

HasParentTypes DeviceMonitor Source # 
Instance details

Defined in GI.Gst.Objects.DeviceMonitor

type ParentTypes DeviceMonitor Source # 
Instance details

Defined in GI.Gst.Objects.DeviceMonitor

type ParentTypes DeviceMonitor = '[Object, Object]

class (GObject o, IsDescendantOf DeviceMonitor o) => IsDeviceMonitor o Source #

Type class for types which can be safely cast to DeviceMonitor, for instance with toDeviceMonitor.

Instances

Instances details
(GObject o, IsDescendantOf DeviceMonitor o) => IsDeviceMonitor o Source # 
Instance details

Defined in GI.Gst.Objects.DeviceMonitor

toDeviceMonitor :: (MonadIO m, IsDeviceMonitor o) => o -> m DeviceMonitor Source #

Cast to DeviceMonitor, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

addFilter

deviceMonitorAddFilter Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: a device monitor

-> Maybe Text

classes: device classes to use as filter or Nothing for any class

-> Maybe Caps

caps: the 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.

Adds a filter for which Device will be monitored, any device that matches all these classes and the 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 Caps supported by the device as returned by deviceGetCaps are not intersected with caps filters added using this function.

Filters must be added before the DeviceMonitor is started.

Since: 1.4

getBus

deviceMonitorGetBus Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: a DeviceProvider

-> m Bus

Returns: a Bus

Gets the Bus of this DeviceMonitor

Since: 1.4

getDevices

deviceMonitorGetDevices Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: A DeviceProvider

-> m [Device]

Returns: a List of 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

getProviders

deviceMonitorGetProviders Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: a DeviceMonitor

-> m [Text]

Returns: A list of device provider factory names that are currently being monitored by monitor or Nothing when nothing is being monitored.

Get a list of the currently selected device provider factories.

This

Since: 1.6

getShowAllDevices

deviceMonitorGetShowAllDevices Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: a DeviceMonitor

-> m Bool

Returns: True when all devices will be shown.

Get if monitor is curretly showing all devices, even those from hidden providers.

Since: 1.6

new

deviceMonitorNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m DeviceMonitor

Returns: a new device monitor.

Create a new DeviceMonitor

Since: 1.4

removeFilter

deviceMonitorRemoveFilter Source #

Arguments

:: (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

Removes a filter from the DeviceMonitor using the id that was returned by deviceMonitorAddFilter.

Since: 1.4

setShowAllDevices

deviceMonitorSetShowAllDevices Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: a DeviceMonitor

-> Bool

showAll: show all devices

-> m () 

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

start

deviceMonitorStart Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: A DeviceMonitor

-> m Bool

Returns: True if the device monitoring could be started

Starts monitoring the devices, one this has succeeded, the MessageTypeDeviceAdded and MessageTypeDeviceRemoved messages will be emitted on the bus when the list of devices changes.

Since: 1.4

stop

deviceMonitorStop Source #

Arguments

:: (HasCallStack, MonadIO m, IsDeviceMonitor a) 
=> a

monitor: A DeviceProvider

-> m () 

Stops monitoring the devices.

Since: 1.4

Properties

showAll

No description available in the introspection data.

constructDeviceMonitorShowAll :: (IsDeviceMonitor o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “show-all” property. This is rarely needed directly, but it is used by new.

getDeviceMonitorShowAll :: (MonadIO m, IsDeviceMonitor o) => o -> m Bool Source #

Get the value of the “show-all” property. When overloading is enabled, this is equivalent to

get deviceMonitor #showAll

setDeviceMonitorShowAll :: (MonadIO m, IsDeviceMonitor o) => o -> Bool -> m () Source #

Set the value of the “show-all” property. When overloading is enabled, this is equivalent to

set deviceMonitor [ #showAll := value ]