Commit 6ceec6cd authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Let GStreamer create the device source

This makes it a bit more future-proof and less explicitly tied to v4l2.
parent 677be503
......@@ -272,7 +272,7 @@ bool WebcamControl::playDevice(Device *device)
gst_element_set_state(GST_ELEMENT(m_pipeline.data()), GST_STATE_NULL);
if (!m_cameraSource) {
m_cameraSource.reset(gst_element_factory_make("wrappercamerabinsrc", "video_balance"));
m_cameraSource.reset(gst_element_factory_make("wrappercamerabinsrc", ""));
// Another option here is to return true, therefore continuing with launching, but
// in that case the application is mostly useless.
if (m_cameraSource.isNull()) {
......@@ -285,10 +285,11 @@ bool WebcamControl::playDevice(Device *device)
g_object_set(m_cameraSource.data(), "video-source", source, nullptr);
}
if (m_currentDevice != device->udi()) {
GstElement* source;
g_object_get(m_cameraSource.data(), "video-source", &source, nullptr);
g_object_set(source, "device", device->path().toUtf8().constData(), nullptr);
GstElement* source;
g_object_get(m_cameraSource.data(), "video-source", &source, nullptr);
if (m_currentDevice != device->udi() || !source) {
source = device->createElement();
g_object_set(m_cameraSource.data(), "video-source", source, nullptr);
}
if (!m_pipeline) {
......
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