mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 03:39:57 +01:00
Improved Device support for V4L2 streams
Allow to reload list of devices, avoid timestamp warning in Loopback, clear UI menu.
This commit is contained in:
@@ -203,7 +203,7 @@ void Device::remove(GstDevice *device)
|
||||
g_free (device_name);
|
||||
}
|
||||
|
||||
Device::Device(): monitor_initialized_(false), monitor_unplug_event_(false)
|
||||
Device::Device(): monitor_(nullptr), monitor_initialized_(false), monitor_unplug_event_(false)
|
||||
{
|
||||
std::thread(launchMonitoring, this).detach();
|
||||
}
|
||||
@@ -212,6 +212,7 @@ void Device::launchMonitoring(Device *d)
|
||||
{
|
||||
// gstreamer monitoring of devices
|
||||
d->monitor_ = gst_device_monitor_new ();
|
||||
gst_device_monitor_set_show_all_devices(d->monitor_, true);
|
||||
|
||||
// watching all video stream sources
|
||||
GstCaps *caps = gst_caps_new_empty_simple ("video/x-raw");
|
||||
@@ -280,6 +281,15 @@ bool Device::initialized()
|
||||
return Device::manager().monitor_initialized_;
|
||||
}
|
||||
|
||||
void Device::reload()
|
||||
{
|
||||
if (monitor_ != nullptr) {
|
||||
gst_device_monitor_stop(monitor_);
|
||||
if ( !gst_device_monitor_start (monitor_) )
|
||||
Log::Info("Device discovery start failed.");
|
||||
}
|
||||
}
|
||||
|
||||
int Device::numDevices()
|
||||
{
|
||||
access_.lock();
|
||||
|
||||
Reference in New Issue
Block a user