summaryrefslogtreecommitdiffstats
path: root/src/plugins/gstreamer
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-01-04 10:51:34 +0100
committerLars Knoll <lars.knoll@qt.io>2021-01-21 19:56:45 +0000
commit4808ad4d6d65fb9d71625583472e5952154cdf09 (patch)
tree8e4f5c1ac51eba5b7bab50eae7540d49ae175b20 /src/plugins/gstreamer
parentf8f33da7964977e30f8d2a3439a9058ba21bc798 (diff)
Remove buffer format API in QCameraImageCapture
The only thing really supported here was JPEG, with the exception of gstreamer, where things were partially implemented. But this low level control doesn't really make sense anyway at this point. Get rid of it for now. Change-Id: Icdbc214a2e42ab92a1b34c539b039118402692bf Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/plugins/gstreamer')
-rw-r--r--src/plugins/gstreamer/camerabin/camerabin.pro2
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp76
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h74
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp42
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.cpp6
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp2
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.h2
7 files changed, 5 insertions, 199 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro
index 8f354d799..728608074 100644
--- a/src/plugins/gstreamer/camerabin/camerabin.pro
+++ b/src/plugins/gstreamer/camerabin/camerabin.pro
@@ -23,7 +23,6 @@ HEADERS += \
$$PWD/camerabinimageprocessing.h \
$$PWD/camerabinmetadata.h \
$$PWD/camerabinvideoencoder.h \
- $$PWD/camerabincapturebufferformat.h \
SOURCES += \
$$PWD/camerabinserviceplugin.cpp \
@@ -38,7 +37,6 @@ SOURCES += \
$$PWD/camerabinmetadata.cpp \
$$PWD/camerabinrecorder.cpp \
$$PWD/camerabinvideoencoder.cpp \
- $$PWD/camerabincapturebufferformat.cpp \
qtConfig(gstreamer_photography) {
HEADERS += \
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
deleted file mode 100644
index 8b3e10546..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabincapturebufferformat.h"
-#include "camerabinsession.h"
-
-QT_BEGIN_NAMESPACE
-
-CameraBinCaptureBufferFormat::CameraBinCaptureBufferFormat(CameraBinSession *session)
- :QCameraCaptureBufferFormatControl(session)
- , m_session(session)
- , m_format(QVideoFrame::Format_Jpeg)
-{
-}
-
-CameraBinCaptureBufferFormat::~CameraBinCaptureBufferFormat()
-{
-}
-
-QList<QVideoFrame::PixelFormat> CameraBinCaptureBufferFormat::supportedBufferFormats() const
-{
- //the exact YUV format is unknown with camerabin until the first capture is requested
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_Jpeg;
-}
-
-QVideoFrame::PixelFormat CameraBinCaptureBufferFormat::bufferFormat() const
-{
- return m_format;
-}
-
-void CameraBinCaptureBufferFormat::setBufferFormat(QVideoFrame::PixelFormat format)
-{
- if (m_format != format) {
- m_format = format;
- emit bufferFormatChanged(format);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
deleted file mode 100644
index 7051913a7..000000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINCAPTUREBUFFERFORMAT_H
-#define CAMERABINCAPTUREBUFFERFORMAT_H
-
-#include <qcamera.h>
-#include <qcameracapturebufferformatcontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-QT_BEGIN_NAMESPACE
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class CameraBinCaptureBufferFormat : public QCameraCaptureBufferFormatControl
-{
- Q_OBJECT
-public:
- CameraBinCaptureBufferFormat(CameraBinSession *session);
- virtual ~CameraBinCaptureBufferFormat();
-
- QList<QVideoFrame::PixelFormat> supportedBufferFormats() const override;
-
- QVideoFrame::PixelFormat bufferFormat() const override;
- void setBufferFormat(QVideoFrame::PixelFormat format) override;
-
-private:
- CameraBinSession *m_session;
- QVideoFrame::PixelFormat m_format;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
index ee9bfd3f5..36fb4c205 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
@@ -39,7 +39,6 @@
#include "camerabinimagecapture.h"
#include "camerabincontrol.h"
-#include "camerabincapturebufferformat.h"
#include "camerabinsession.h"
#include <private/qgstvideobuffer_p.h>
#include <private/qgstutils_p.h>
@@ -166,42 +165,13 @@ void CameraBinImageCapture::EncoderProbe::probeCaps(GstCaps *caps)
capture->m_bufferFormat = QGstUtils::formatForCaps(caps, &capture->m_videoInfo);
}
-bool CameraBinImageCapture::EncoderProbe::probeBuffer(GstBuffer *buffer)
+bool CameraBinImageCapture::EncoderProbe::probeBuffer(GstBuffer *)
{
- CameraBinSession * const session = capture->m_session;
-
#ifdef DEBUG_CAPTURE
qDebug() << "Uncompressed buffer probe";
#endif
-
- QCameraImageCapture::CaptureDestinations destination = capture->m_destination;
- QVideoFrame::PixelFormat format = session->captureBufferFormatControl()->bufferFormat();
-
- if (destination & QCameraImageCapture::CaptureToBuffer) {
- if (format != QVideoFrame::Format_Jpeg) {
-#ifdef DEBUG_CAPTURE
- qDebug() << "imageAvailable(uncompressed):" << format;
-#endif
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, capture->m_videoInfo);
-
- QVideoFrame frame(
- videoBuffer,
- capture->m_bufferFormat.frameSize(),
- capture->m_bufferFormat.pixelFormat());
-
- QMetaObject::invokeMethod(capture, "imageAvailable",
- Qt::QueuedConnection,
- Q_ARG(int, capture->m_requestId),
- Q_ARG(QVideoFrame, frame));
- }
- }
-
- //keep the buffer if capture to file or jpeg buffer capture was reuqsted
- bool keepBuffer = (destination & QCameraImageCapture::CaptureToFile) ||
- ((destination & QCameraImageCapture::CaptureToBuffer) &&
- format == QVideoFrame::Format_Jpeg);
-
- return keepBuffer;
+ // keep the buffer so we can capture to file or encode the image
+ return true;
}
void CameraBinImageCapture::MuxerProbe::probeCaps(GstCaps *caps)
@@ -211,13 +181,9 @@ void CameraBinImageCapture::MuxerProbe::probeCaps(GstCaps *caps)
bool CameraBinImageCapture::MuxerProbe::probeBuffer(GstBuffer *buffer)
{
- CameraBinSession * const session = capture->m_session;
-
QCameraImageCapture::CaptureDestinations destination = capture->m_destination;
- if ((destination & QCameraImageCapture::CaptureToBuffer) &&
- session->captureBufferFormatControl()->bufferFormat() == QVideoFrame::Format_Jpeg) {
-
+ if (destination & QCameraImageCapture::CaptureToBuffer) {
QSize resolution = capture->m_jpegResolution;
//if resolution is not presented in caps, try to find it from encoded jpeg data:
GstMapInfo mapInfo;
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
index 1006c4ce7..515b010c1 100644
--- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
@@ -55,7 +55,6 @@
#include "camerabinimagecapture.h"
#include "camerabinimageprocessing.h"
-#include "camerabincapturebufferformat.h"
#include <private/qgstreamerbushelper_p.h>
#include <private/qgstutils_p.h>
@@ -203,10 +202,7 @@ QObject *CameraBinService::requestControl(const char *name)
if (qstrcmp(name, QCameraImageProcessingControl_iid) == 0)
return m_captureSession->imageProcessingControl();
- if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0)
- return m_captureSession->captureBufferFormatControl();
-
- return 0;
+ return nullptr;
}
void CameraBinService::releaseControl(QObject *control)
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index 88fde5d9e..0170d16d8 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -53,7 +53,6 @@
#include "camerabinimageprocessing.h"
-#include "camerabincapturebufferformat.h"
#include <private/qgstreamerbushelper_p.h>
#include <private/qgstreamervideorendererinterface_p.h>
#include <private/qgstutils_p.h>
@@ -167,7 +166,6 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa
m_recorderControl = new CameraBinRecorder(this);
m_mediaContainerControl = new CameraBinContainer(this);
m_imageProcessingControl = new CameraBinImageProcessing(this);
- m_captureBufferFormatControl = new CameraBinCaptureBufferFormat(this);
QByteArray envFlags = qgetenv("QT_GSTREAMER_CAMERABIN_FLAGS");
if (!envFlags.isEmpty())
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h
index 50f97f3db..ccf0cdd4e 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.h
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.h
@@ -123,7 +123,6 @@ public:
#endif
CameraBinImageProcessing *imageProcessingControl() const { return m_imageProcessingControl; }
- CameraBinCaptureBufferFormat *captureBufferFormatControl() const { return m_captureBufferFormatControl; }
CameraBinRecorder *recorderControl() const { return m_recorderControl; }
CameraBinContainer *mediaContainerControl() const { return m_mediaContainerControl; }
@@ -238,7 +237,6 @@ private:
CameraBinFocus *m_cameraFocusControl;
#endif
CameraBinImageProcessing *m_imageProcessingControl;
- CameraBinCaptureBufferFormat *m_captureBufferFormatControl;
QGstreamerBusHelper *m_busHelper;
GstBus* m_bus;