summaryrefslogtreecommitdiffstats
path: root/src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h
diff options
context:
space:
mode:
authorPiotr Srebrny <piotr.srebrny@qt.io>2022-09-07 15:08:58 +0200
committerPiotr Srebrny <piotr.srebrny@qt.io>2022-10-10 09:53:52 +0200
commitbf4e6b506583170f1f86eb408ab01b5846b7a96d (patch)
tree3fa98757619bcb2186664311d08486d62d06fa5e /src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h
parent6fae541a2015c329942f6c2a96fc3b1de3f14a7a (diff)
Validate that gstreamer elements necessary for operation are available
This patch validates that all elements that are necessary to run the requested functionality are available. Instead of running constructors directly, the patch uses a static create() function for each class. This function first tries to instantiate all necessary GStreamer plugins and then pass them to the class constructor. If some element is missing the function returns an error message describing the element. Pick-to: 6.4 Fixes: QTBUG-106257 Change-Id: I2b9db3f509e9ad5b760fcc251e634a01c687b790 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h')
-rw-r--r--src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h b/src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h
index bd2c815ad..bab24d8c6 100644
--- a/src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h
+++ b/src/plugins/multimedia/gstreamer/mediacapture/qgstreamercamera_p.h
@@ -1,7 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-
#ifndef QGSTREAMERCAMERACONTROL_H
#define QGSTREAMERCAMERACONTROL_H
@@ -18,6 +17,7 @@
#include <QHash>
#include <private/qplatformcamera_p.h>
+#include <private/qmultimediautils_p.h>
#include "qgstreamermediacapture_p.h"
#include <qgst_p.h>
@@ -27,7 +27,8 @@ class QGstreamerCamera : public QPlatformCamera
{
Q_OBJECT
public:
- QGstreamerCamera(QCamera *camera);
+ static QMaybe<QPlatformCamera *> create(QCamera *camera);
+
virtual ~QGstreamerCamera();
bool isActive() const override;
@@ -64,6 +65,9 @@ public:
bool isV4L2Camera() const { return !m_v4l2Device.isEmpty(); }
private:
+ QGstreamerCamera(QGstElement videotestsrc, QGstElement capsFilter, QGstElement videoconvert,
+ QGstElement videoscale, QCamera *camera);
+
void updateCameraProperties();
#if QT_CONFIG(linux_v4l)
void initV4L2Controls();