deviceprovider: Returns non-floating devices from gst_device_provider_probe

This should make the API usage more consistent. Also document that the subclasses
should just return the devices as floating.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/558>
This commit is contained in:
Olivier Crête 2020-07-06 14:55:38 -04:00 committed by GStreamer Merge Bot
parent 9f17094cf3
commit f26a9ebafb
2 changed files with 9 additions and 2 deletions

View file

@ -417,9 +417,15 @@ gst_device_provider_get_devices (GstDeviceProvider * provider)
for (item = provider->devices; item; item = item->next)
devices = g_list_prepend (devices, gst_object_ref (item->data));
GST_OBJECT_UNLOCK (provider);
} else if (klass->probe)
} else if (klass->probe) {
devices = klass->probe (provider);
for (item = devices; item; item = item->next)
if (g_object_is_floating (item->data))
g_object_ref_sink (item->data);
}
g_mutex_unlock (&provider->priv->start_lock);
return devices;

View file

@ -71,7 +71,8 @@ struct _GstDeviceProvider {
* @factory: a pointer to the #GstDeviceProviderFactory that creates this
* provider
* @probe: Returns a list of devices that are currently available.
* This should never block.
* This should never block. The devices should not have a parent and should
* be floating.
* @start: Starts monitoring for new devices. Only subclasses that can know
* that devices have been added or remove need to implement this method.
* @stop: Stops monitoring for new devices. Only subclasses that implement