Class DeviceProvider
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
DeviceProvider.DeviceProvider$Impl
A GstDeviceProvider subclass is provided by a plugin that handles devices
if there is a way to programmatically list connected devices. It can also
optionally provide updates to the list of connected devices.
Each GstDeviceProvider subclass is a singleton, a plugin should
normally provide a single subclass for all devices.
Applications would normally use a GstDeviceMonitor to monitor devices
from all relevant providers.
- Since:
- 1.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeviceProvider.Builder<B extends DeviceProvider.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe DeviceProvider$Impl type represents a native instance of the abstract DeviceProvider class.static classThe structure of the baseGstDeviceProviderClassstatic interfaceFunctional interface declaration of theProviderHiddenCallbackcallback.static interfaceFunctional interface declaration of theProviderUnhiddenCallbackcallback.Nested classes/interfaces inherited from class GstObject
GstObject.DeepNotifyCallback, GstObject.Object$Impl, GstObject.ObjectClassNested classes/interfaces inherited from class InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new DeviceProvider.DeviceProvider(MemorySegment address) Create a DeviceProvider instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected DeviceProviderasParent()Return this instance as if it were its parent type.booleanvoidPosts a message on the provider'sGstBusto inform applications that a new device has been added.voiddeviceChanged(Device device, Device changedDevice) This function is used whenchangedDevicewas modified into its new formdevice.This will post aDEVICE_CHANGEDmessage on the bus to let the application know that the device was modified.voiddeviceRemove(Device device) Posts a message on the provider'sGstBusto inform applications that a device has been removed.voidemitProviderHidden(String object) voidemitProviderUnhidden(String object) getBus()Gets theGstBusof thisGstDeviceProviderGets a list of devices that this provider understands.@Nullable DeviceProviderFactoryRetrieves the factory that was used to create this device provider.String[]Get the provider factory names of theGstDeviceProviderinstances that are hidden byprovider.static MemoryLayoutThe memory layout of the native struct.getMetadata(String key) Get metadata withkeyinprovider.static @Nullable TypegetType()Get the GType of the DeviceProvider class.voidhideProvider(String name) Make this DeviceProvider hide the devices from the factory withname.booleanThis function can be used to know if the this DeviceProvider was successfully started.protected List<MemorySegment> probe()Returns a list of devices that are currently available.static booleanCreate a new device providerfactory capable of instantiating objects of thetypeand add the factory toplugin.booleanstart()Starts providering the devices.voidstop()Decreases the use-count by one.voidunhideProvider(String name) Make this DeviceProvider unhide the devices from factoryname.Methods inherited from class GstObject
addControlBinding, checkUniqueness, deepNotify, defaultDeepNotify, defaultError, emitDeepNotify, getControlBinding, getControlRate, getGValueArray, getName, getParent, getPathString, getValue, getValueArray, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, onDeepNotify, ref, refSink, removeControlBinding, replace, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setName, setParent, suggestNextSync, syncValues, unparent, unrefMethods inherited from class InitiallyUnowned
builderMethods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
DeviceProvider
Create a DeviceProvider instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
DeviceProvider
public DeviceProvider()Create a new DeviceProvider.
-
-
Method Details
-
getType
Get the GType of the DeviceProvider class.- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
register
Create a new device providerfactory capable of instantiating objects of thetypeand add the factory toplugin.- Parameters:
plugin-GstPluginto register the device provider with, ornullfor a static device provider.name- name of device providers of this typerank- rank of device provider (higher rank means more importance when autoplugging)type- GType of device provider to register- Returns:
true, if the registering succeeded,falseon error- Since:
- 1.4
-
canMonitor
public boolean canMonitor() -
deviceAdd
Posts a message on the provider's
GstBusto inform applications that a new device has been added.This is for use by subclasses.
device'sreference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink()).- Parameters:
device- aGstDevicethat has been added- Since:
- 1.4
-
deviceChanged
This function is used whenchangedDevicewas modified into its new formdevice.This will post aDEVICE_CHANGEDmessage on the bus to let the application know that the device was modified.GstDeviceis immutable for MT. safety purposes so this is an "atomic" way of letting the application know when a device was modified.- Parameters:
device- the new version ofchangedDevicechangedDevice- the old version of the device that has been updated- Since:
- 1.16
-
deviceRemove
Posts a message on the provider's
GstBusto inform applications that a device has been removed.This is for use by subclasses.
- Parameters:
device- aGstDevicethat has been removed- Since:
- 1.4
-
getBus
-
getDevices
Gets a list of devices that this provider understands. This may actually probe the hardware if the provider is not currently started.
If the provider has been started, this will returned the same
GstDeviceobjedcts that have been returned by theGST_MESSAGE_DEVICE_ADDEDmessages.- Returns:
- a
GListofGstDevice - Since:
- 1.4
-
getFactory
Retrieves the factory that was used to create this device provider.- Returns:
- the
GstDeviceProviderFactoryused for creating this device provider. no refcounting is needed. - Since:
- 1.4
-
getHiddenProviders
Get the provider factory names of theGstDeviceProviderinstances that are hidden byprovider.- Returns:
- a list of hidden providers factory names or
nullwhen nothing is hidden byprovider.Free with g_strfreev. - Since:
- 1.6
-
getMetadata
-
hideProvider
Make this DeviceProvider hide the devices from the factory with
name.This function is used when this DeviceProvider will also provide the devices reported by provider factory
name.A monitor should stop monitoring the device provider withnameto avoid duplicate devices.- Parameters:
name- a provider factory name- Since:
- 1.6
-
isStarted
public boolean isStarted()This function can be used to know if the this DeviceProvider was successfully started.- Since:
- 1.20
-
start
public boolean start()Starts providering the devices. This will cause
GST_MESSAGE_DEVICE_ADDEDandGST_MESSAGE_DEVICE_REMOVEDmessages to be posted on the provider's bus when devices are added or removed from the system.Since the
GstDeviceProvideris a singleton, gst_device_provider_start() may already have been called by another user of the object, gst_device_provider_stop() needs to be called the same number of times.After this function has been called, gst_device_provider_get_devices() will return the same objects that have been received from the
GST_MESSAGE_DEVICE_ADDEDmessages and will no longer probe.- Returns:
trueif the device providering could be started- Since:
- 1.4
-
stop
public void stop()Decreases the use-count by one. If the use count reaches zero, thisGstDeviceProviderwill stop providering the devices. This needs to be called the same number of times that gst_device_provider_start() was called.- Since:
- 1.4
-
unhideProvider
Make this DeviceProvider unhide the devices from factory
name.This function is used when this DeviceProvider will no longer provide the devices reported by provider factory
name.A monitor should start monitoring the devices from provider factorynamein order to see all devices again.- Parameters:
name- a provider factory name- Since:
- 1.6
-
probe
Returns a list of devices that are currently available. This should never block. The devices should not have a parent and should be floating. -
onProviderHidden
public SignalConnection<DeviceProvider.ProviderHiddenCallback> onProviderHidden(DeviceProvider.ProviderHiddenCallback handler) - See Also:
-
emitProviderHidden
-