5#include <QtMultimedia/qmediadevices.h>
6#include <QtMultimedia/private/qcameradevice_p.h>
19 switch (GST_MESSAGE_TYPE(
message)) {
20 case GST_MESSAGE_DEVICE_ADDED:
24 case GST_MESSAGE_DEVICE_REMOVED:
32 return G_SOURCE_CONTINUE;
38 gst_device_monitor_new(),
41 gst_device_monitor_add_filter(m_deviceMonitor.
get(),
"Video/Source",
nullptr);
44 gst_device_monitor_get_bus(m_deviceMonitor.
get()),
47 gst_device_monitor_start(m_deviceMonitor.
get());
49 GList *
devices = gst_device_monitor_get_devices(m_deviceMonitor.
get());
63 gst_device_monitor_stop(m_deviceMonitor.
get());
70 for (
const auto &
device : m_videoSources) {
74 gst_device_get_display_name(
device.gstDevice.get()),
76 info->description = desc.toQString();
82 info->isDefault = def && *def;
94 QSet<QSize> photoResolutions;
96 int size = caps.size();
97 for (
int i = 0;
i <
size; ++
i) {
98 auto cap = caps.at(
i);
100 QSize resolution =
cap.resolution();
104 auto pixelFormat =
cap.pixelFormat();
110 photoResolutions.insert(resolution);
114 info->photoResolutions = photoResolutions.values();
124 auto it = std::find_if(m_videoSources.begin(), m_videoSources.end(),
125 [&](
const QGstRecordDevice &
a) { return a.gstDevice == device; });
127 if (
it != m_videoSources.end())
130 m_videoSources.push_back(QGstRecordDevice{
140 auto it = std::find_if(m_videoSources.begin(), m_videoSources.end(),
141 [&](
const QGstRecordDevice &
a) { return a.gstDevice == device; });
143 if (
it != m_videoSources.end()) {
144 m_videoSources.erase(
it);
151 auto it = std::find_if(m_videoSources.begin(), m_videoSources.end(),
152 [&](
const QGstRecordDevice &
a) { return a.id == id; });
153 return it != m_videoSources.end() ?
it->gstDevice.get() :
nullptr;
IOBluetoothDevice * device
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
GstDevice * videoDevice(const QByteArray &id) const
QList< QCameraDevice > videoDevices() const override
QGstreamerVideoDevices(QPlatformMediaIntegration *integration)
void removeDevice(QGstDeviceHandle)
~QGstreamerVideoDevices()
void addDevice(QGstDeviceHandle)
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
Type get() const noexcept
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static const QCssKnownValue properties[NumProperties - 1]
static QT_BEGIN_NAMESPACE gboolean deviceMonitorCallback(GstBus *, GstMessage *message, gpointer m)
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLsizei const GLchar * message
QNetworkAccessManager manager