devicemonitor: keep order of providers and devices

The deviceproviders are added to the array sorted by their rank. Make
sure we keep this ordering when removing a provider.

We use _prepend to collect the devices, use g_list_reverse to get the
devices in the right order; sorted by rank and in the same order as
returned by the provider.
This commit is contained in:
Wim Taymans 2015-07-16 17:25:24 +02:00
parent 997115e462
commit 8caf9b7a87

View file

@ -209,7 +209,7 @@ gst_device_monitor_remove (GstDeviceMonitor * self, guint i)
GstDeviceProvider *provider = g_ptr_array_index (self->priv->providers, i); GstDeviceProvider *provider = g_ptr_array_index (self->priv->providers, i);
GstBus *bus; GstBus *bus;
g_ptr_array_remove_index_fast (self->priv->providers, i); g_ptr_array_remove_index (self->priv->providers, i);
bus = gst_device_provider_get_bus (provider); bus = gst_device_provider_get_bus (provider);
g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self); g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self);
@ -324,7 +324,7 @@ again:
GST_OBJECT_UNLOCK (monitor); GST_OBJECT_UNLOCK (monitor);
return devices; return g_list_reverse (devices);
} }
/** /**