BugFix Prevent warnings gstreamer

This commit is contained in:
Bruno Herbelin
2024-10-04 19:23:16 +02:00
parent 21bb2af7ea
commit 10e95f5388
3 changed files with 20 additions and 38 deletions

View File

@@ -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();

View File

@@ -18,14 +18,9 @@
**/
#include <algorithm>
#include <thread>
#include <chrono>
#include <sstream>
#include <glm/gtc/matrix_transform.hpp>
#include <gst/pbutils/gstdiscoverer.h>
#include <gst/pbutils/pbutils.h>
#include <gst/gst.h>
#include <thread>
#include "Log.h"
#include "Decorations.h"
@@ -47,7 +42,7 @@ std::string gst_plugin_vidcap = "ximagesrc show-pointer=false";
#include <xcb/xcb.h>
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <xcb/xproto.h>
int X11_error_handler(Display *d, XErrorEvent *e);
std::map<unsigned long, std::string> 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

View File

@@ -4,8 +4,6 @@
#include <string>
#include <vector>
#include <set>
#include <map>
#include "GstToolkit.h"
#include "StreamSource.h"