Klasse DeviceMonitor

Alle implementierten Schnittstellen:
PointerInterface

public class DeviceMonitor extends PropertyHolder
Applications should create a #GstDeviceMonitor when they want
to probe, list and monitor devices of a specific type. The
#GstDeviceMonitor will create the appropriate
#GstDeviceProvider objects and manage them. It will then post
messages on its #GstBus 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;
   }
 

https://gstreamer.freedesktop.org/documentation/gstreamer/gi-index.html

  • Konstruktordetails

    • DeviceMonitor

      public DeviceMonitor(PointerContainer pointer)
    • DeviceMonitor

      public DeviceMonitor()
      Create a new #GstDeviceMonitor
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addFilter

      public int addFilter(@Nullable Str classes, @Nullable Caps caps)
      Adds a filter for which #GstDevice will be monitored, any device that matches
      all these classes and the #GstCaps 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 #GstCaps supported by the device as returned by gst_device_get_caps() are
      not intersected with caps filters added using this function.

      Filters must be added before the #GstDeviceMonitor is started.
      Parameter:
      classes - device classes to use as filter or %NULL for any class
      caps - the #GstCaps to filter or %NULL for ANY
      Gibt zurück:
      The id of the new filter or 0 if no provider matched the filter's classes.
    • addFilter

      public int addFilter(String classes, @Nullable Caps caps)
      Adds a filter for which #GstDevice will be monitored, any device that matches
      all these classes and the #GstCaps 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 #GstCaps supported by the device as returned by gst_device_get_caps() are
      not intersected with caps filters added using this function.

      Filters must be added before the #GstDeviceMonitor is started.
      Parameter:
      classes - device classes to use as filter or %NULL for any class
      caps - the #GstCaps to filter or %NULL for ANY
      Gibt zurück:
      The id of the new filter or 0 if no provider matched the filter's classes.
    • getBus

      public Bus getBus()
      Gets the #GstBus of this #GstDeviceMonitor
      Gibt zurück:
      a #GstBus
    • getDevices

      public List getDevices()
      Gets a list of devices from all of the relevant monitors. This may actually
      probe the hardware if the monitor is not currently started.
      Gibt zurück:
      a #GList of #GstDevice
    • getShowAllDevices

      public boolean getShowAllDevices()
      Get if @monitor is currently showing all devices, even those from hidden
      providers.
      Gibt zurück:
      %TRUE when all devices will be shown.
    • removeFilter

      public boolean removeFilter(int filter_id)
      Removes a filter from the #GstDeviceMonitor using the id that was returned
      by gst_device_monitor_add_filter().
      Parameter:
      filter_id - the id of the filter
      Gibt zurück:
      %TRUE of the filter id was valid, %FALSE otherwise
    • setShowAllDevices

      public void setShowAllDevices(boolean show_all)
      Set if all devices should be visible, even those devices from hidden
      providers. Setting @show_all to true might show some devices multiple times.
      Parameter:
      show_all - show all devices
    • start

      public boolean start()
      Starts monitoring the devices, one this has succeeded, the
      %GST_MESSAGE_DEVICE_ADDED and %GST_MESSAGE_DEVICE_REMOVED messages
      will be emitted on the bus when the list of devices changes.
      Gibt zurück:
      %TRUE if the device monitoring could be started, i.e. at least a single device provider was started successfully.
    • stop

      public void stop()
      Stops monitoring the devices.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()