diff --git a/src/DeviceSource.cpp b/src/DeviceSource.cpp index e9a757e..b5ce7cc 100644 --- a/src/DeviceSource.cpp +++ b/src/DeviceSource.cpp @@ -163,24 +163,25 @@ void Device::add(GstDevice *device) auto handle = std::find_if(handles_.cbegin(), handles_.cend(), hasDeviceName(device_name) ); if ( handle == handles_.cend() ) { - std::string p = pipelineForDevice(device, handles_.size()); - GstToolkit::PipelineConfigSet confs = GstToolkit::getPipelineConfigs(p); - // add if not in the list and valid - if (!p.empty() && !confs.empty()) { - DeviceHandle dev; - dev.name = device_name; - dev.pipeline = p; - dev.configs = confs; - dev.properties = get_device_properties (device); -#ifdef DEVICE_DEBUG - GstStructure *stru = gst_device_get_properties(device); - g_print("\n%s: %s\n", device_name, gst_structure_to_string(stru) ); -#endif - handles_.push_back(dev); - Log::Info("Device '%s' is plugged-in.", device_name); - } + std::string p = pipelineForDevice(device, handles_.size()); + if (!p.empty()) { + GstToolkit::PipelineConfigSet confs = GstToolkit::getPipelineConfigs(p); + if (!confs.empty()) { + DeviceHandle dev; + dev.name = device_name; + dev.pipeline = p; + dev.configs = confs; + dev.properties = get_device_properties (device); +#ifdef DEVICE_DEBUG + GstStructure *stru = gst_device_get_properties(device); + g_print("\n%s: %s\n", device_name, gst_structure_to_string(stru) ); +#endif + handles_.push_back(dev); + Log::Info("Device '%s' is plugged-in.", device_name); + } + } } // unlock access access_.unlock(); diff --git a/src/ScreenCaptureSource.cpp b/src/ScreenCaptureSource.cpp index 9e50934..9b02608 100644 --- a/src/ScreenCaptureSource.cpp +++ b/src/ScreenCaptureSource.cpp @@ -18,14 +18,9 @@ **/ #include -#include #include #include -#include - -#include -#include -#include +#include #include "Log.h" #include "Decorations.h" @@ -47,7 +42,7 @@ std::string gst_plugin_vidcap = "ximagesrc show-pointer=false"; #include #include -#include +#include int X11_error_handler(Display *d, XErrorEvent *e); std::map getListX11Windows(); @@ -87,18 +82,6 @@ private: void ScreenCaptureHandle::update(const std::string &newname) { - GstToolkit::PipelineConfigSet confs = GstToolkit::getPipelineConfigs(pipeline); - - if (!confs.empty()) { - GstToolkit::PipelineConfig best = *confs.rbegin(); - GstToolkit::PipelineConfigSet confscreen; - // limit framerate to 30fps - best.fps_numerator = MIN( best.fps_numerator, 30); - best.fps_denominator = 1; - confscreen.insert(best); - - configs = confscreen; - } name = newname; } @@ -159,7 +142,7 @@ void ScreenCapture::remove(const std::string &windowname, unsigned long id) // just inform if there is no source connected if (handle->associated_sources.empty()) { - Log::Info("Window %s closed.", windowname.c_str()); + Log::Info("Window %s available.", windowname.c_str()); } else { // otherwise unplug all sources and close their streams diff --git a/src/ScreenCaptureSource.h b/src/ScreenCaptureSource.h index 19b065a..58425ec 100644 --- a/src/ScreenCaptureSource.h +++ b/src/ScreenCaptureSource.h @@ -4,8 +4,6 @@ #include #include -#include -#include #include "GstToolkit.h" #include "StreamSource.h"