Commit 67440ce0 authored by Olivier Crête's avatar Olivier Crête 👻

devicemonitor: Improve documentation

parent 6d12b339
...@@ -34,6 +34,57 @@ ...@@ -34,6 +34,57 @@
* The device monitor will monitor all devices matching the filters that * The device monitor will monitor all devices matching the filters that
* the application has set. * the application has set.
* *
*
* The basic use pattern of an iterator 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);
* 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);
* 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_simple_empty ("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 * Since: 1.4
*/ */
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
/** /**
* SECTION:gstdeviceprovider * SECTION:gstdeviceprovider
* @short_description: A device provider * @short_description: A device provider
* @see_also: #GstDevice, #GstGlobalDeviceMonitor * @see_also: #GstDevice, #GstDeviceMonitor
* *
* A #GstDeviceProvider subclass is provided by a plugin that handles devices * A #GstDeviceProvider subclass is provided by a plugin that handles devices
* if there is a way to programatically list connected devices. It can also * if there is a way to programatically list connected devices. It can also
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* Each #GstDeviceProvider subclass is a singleton, a plugin should * Each #GstDeviceProvider subclass is a singleton, a plugin should
* normally provide a single subclass for all devices. * normally provide a single subclass for all devices.
* *
* Applications would normally use a #GstGlobalDeviceMonitor to monitor devices * Applications would normally use a #GstDeviceMonitor to monitor devices
* from all relevant providers. * from all relevant providers.
* *
* Since: 1.4 * Since: 1.4
......
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
* GstDeviceProviderfactory can be added to a #GstPlugin as it is also a * GstDeviceProviderfactory can be added to a #GstPlugin as it is also a
* #GstPluginFeature. * #GstPluginFeature.
* *
* Use the gst_device_provider_factory_find() and gst_device_provider_factory_create() * Use the gst_device_provider_factory_find() and
* functions to create device provider instances or use gst_device_provider_factory_make() as a * gst_device_provider_factory_create() functions to create device
* provider instances or use gst_device_provider_factory_make() as a
* convenient shortcut. * convenient shortcut.
* *
* Since: 1.4 * Since: 1.4
......
...@@ -2340,7 +2340,7 @@ gst_message_parse_have_context (GstMessage * message, GstContext ** context) ...@@ -2340,7 +2340,7 @@ gst_message_parse_have_context (GstMessage * message, GstContext ** context)
* @device: (transfer none): The new #GstDevice * @device: (transfer none): The new #GstDevice
* *
* Creates a new device-added message. The device-added message is produced by * Creates a new device-added message. The device-added message is produced by
* #GstDeviceProvider or a #GstGlobalDeviceMonitor. They announce the appearance * #GstDeviceProvider or a #GstlDeviceMonitor. They announce the appearance
* of monitored devices. * of monitored devices.
* *
* Returns: a newly allocated #GstMessage * Returns: a newly allocated #GstMessage
...@@ -2370,7 +2370,7 @@ gst_message_new_device_added (GstObject * src, GstDevice * device) ...@@ -2370,7 +2370,7 @@ gst_message_new_device_added (GstObject * src, GstDevice * device)
* pointer to the new #GstDevice, or %NULL * pointer to the new #GstDevice, or %NULL
* *
* Parses a device-added message. The device-added message is produced by * Parses a device-added message. The device-added message is produced by
* #GstDeviceProvider or a #GstGlobalDeviceMonitor. It announces the appearance * #GstDeviceProvider or a #GstDeviceMonitor. It announces the appearance
* of monitored devices. * of monitored devices.
* *
* Since: 1.4 * Since: 1.4
...@@ -2392,7 +2392,7 @@ gst_message_parse_device_added (GstMessage * message, GstDevice ** device) ...@@ -2392,7 +2392,7 @@ gst_message_parse_device_added (GstMessage * message, GstDevice ** device)
* @device: (transfer none): The removed #GstDevice * @device: (transfer none): The removed #GstDevice
* *
* Creates a new device-removed message. The device-removed message is produced * Creates a new device-removed message. The device-removed message is produced
* by #GstDeviceProvider or a #GstGlobalDeviceMonitor. They announce the * by #GstDeviceProvider or a #GstDeviceMonitor. They announce the
* disappearance of monitored devices. * disappearance of monitored devices.
* *
* Returns: a newly allocated #GstMessage * Returns: a newly allocated #GstMessage
...@@ -2422,7 +2422,7 @@ gst_message_new_device_removed (GstObject * src, GstDevice * device) ...@@ -2422,7 +2422,7 @@ gst_message_new_device_removed (GstObject * src, GstDevice * device)
* pointer to the removed #GstDevice, or %NULL * pointer to the removed #GstDevice, or %NULL
* *
* Parses a device-removed message. The device-removed message is produced by * Parses a device-removed message. The device-removed message is produced by
* #GstDeviceProvider or a #GstGlobalDeviceMonitor. It announces the * #GstDeviceProvider or a #GstDeviceMonitor. It announces the
* disappearance of monitored devices. * disappearance of monitored devices.
* *
* Since: 1.4 * Since: 1.4
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment