Struct gstreamer::DeviceMonitor[]

pub struct DeviceMonitor(_, _);

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: %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;
  }

Implements

DeviceMonitorExt, GstObjectExt, glib::object::ObjectExt

Methods

impl DeviceMonitor
[src]

Create a new DeviceMonitor

Returns

a new device monitor.

Trait Implementations

impl Clone for DeviceMonitor

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Hash for DeviceMonitor

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Ord for DeviceMonitor

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl StaticType for DeviceMonitor

Returns the type identifier of Self.

impl<T: IsA<Object>> PartialEq<T> for DeviceMonitor

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for DeviceMonitor

impl<T: IsA<Object>> PartialOrd<T> for DeviceMonitor

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Debug for DeviceMonitor

Formats the value using the given formatter. Read more

impl IsA<Object> for DeviceMonitor

impl IsA<Object> for DeviceMonitor

impl Send for DeviceMonitor
[src]

impl Sync for DeviceMonitor
[src]

impl Default for DeviceMonitor
[src]

Returns the "default value" for a type. Read more