Class DeviceProvider

All Implemented Interfaces:
Proxy
Direct Known Subclasses:
DeviceProvider.DeviceProvider$Impl

@Generated("org.javagi.JavaGI") public abstract class DeviceProvider extends GstObject

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
  • Constructor Details

    • DeviceProvider

      public DeviceProvider(MemorySegment address)
      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

      public static @Nullable Type getType()
      Get the GType of the DeviceProvider class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected DeviceProvider asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GstObject
      Returns:
      the instance as if it were its parent type
    • register

      public static boolean register(@Nullable Plugin plugin, String name, int rank, Type type)
      Create a new device providerfactory capable of instantiating objects of the type and add the factory to plugin.
      Parameters:
      plugin - GstPlugin to register the device provider with, or null for a static device provider.
      name - name of device providers of this type
      rank - rank of device provider (higher rank means more importance when autoplugging)
      type - GType of device provider to register
      Returns:
      true, if the registering succeeded, false on error
      Since:
      1.4
    • canMonitor

      public boolean canMonitor()
    • deviceAdd

      public void deviceAdd(Device device)

      Posts a message on the provider's GstBus to inform applications that a new device has been added.

      This is for use by subclasses.

      device's reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink()).

      Parameters:
      device - a GstDevice that has been added
      Since:
      1.4
    • deviceChanged

      public void deviceChanged(Device device, Device changedDevice)
      This function is used when changedDevice was modified into its new form device. This will post a DEVICE_CHANGED message on the bus to let the application know that the device was modified. GstDevice is 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 of changedDevice
      changedDevice - the old version of the device that has been updated
      Since:
      1.16
    • deviceRemove

      public void deviceRemove(Device device)

      Posts a message on the provider's GstBus to inform applications that a device has been removed.

      This is for use by subclasses.

      Parameters:
      device - a GstDevice that has been removed
      Since:
      1.4
    • getBus

      public Bus getBus()
      Gets the GstBus of this GstDeviceProvider
      Returns:
      a GstBus
      Since:
      1.4
    • getDevices

      public List<Device> 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 GstDevice objedcts that have been returned by the GST_MESSAGE_DEVICE_ADDED messages.

      Returns:
      a GList of GstDevice
      Since:
      1.4
    • getFactory

      public @Nullable DeviceProviderFactory getFactory()
      Retrieves the factory that was used to create this device provider.
      Returns:
      the GstDeviceProviderFactory used for creating this device provider. no refcounting is needed.
      Since:
      1.4
    • getHiddenProviders

      public String[] getHiddenProviders()
      Get the provider factory names of the GstDeviceProvider instances that are hidden by provider.
      Returns:
      a list of hidden providers factory names or null when nothing is hidden by provider. Free with g_strfreev.
      Since:
      1.6
    • getMetadata

      public String getMetadata(String key)
      Get metadata with key in provider.
      Parameters:
      key - the key to get
      Returns:
      the metadata for key.
      Since:
      1.14
    • hideProvider

      public void hideProvider(String name)

      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 with name to 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_ADDED and GST_MESSAGE_DEVICE_REMOVED messages to be posted on the provider's bus when devices are added or removed from the system.

      Since the GstDeviceProvider is 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_ADDED messages and will no longer probe.

      Returns:
      true if 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, this GstDeviceProvider will 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

      public void unhideProvider(String name)

      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 factory name in order to see all devices again.

      Parameters:
      name - a provider factory name
      Since:
      1.6
    • probe

      protected List<MemorySegment> 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

    • emitProviderHidden

      public void emitProviderHidden(String object)
    • onProviderUnhidden

    • emitProviderUnhidden

      public void emitProviderUnhidden(String object)