summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-03-19 10:22:24 +0100
committerLars Knoll <lars.knoll@qt.io>2021-04-06 08:09:28 +0000
commitf836d904c4f564b82ae540c624fd016ad1e03cea (patch)
tree87fe1e6c5a41fe77cbb774763ecbf36d5b0d508d /src
parente6fde543c658b6993289f2e60ea3be7102515647 (diff)
Get rid of AVFCameraWindowControl
AVFVideoWindowControl can now handle both playback and capture windows. Change-Id: Ifdc52c2e8c6dc11cecbbce955544448fd3ef817d Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/multimedia/CMakeLists.txt1
-rw-r--r--src/multimedia/platform/darwin/camera/avfcameraservice.mm1
-rw-r--r--src/multimedia/platform/darwin/camera/avfcamerawindowcontrol.mm259
-rw-r--r--src/multimedia/platform/darwin/camera/avfcamerawindowcontrol_p.h129
4 files changed, 0 insertions, 390 deletions
diff --git a/src/multimedia/CMakeLists.txt b/src/multimedia/CMakeLists.txt
index 2b11c898a..72c9a0c99 100644
--- a/src/multimedia/CMakeLists.txt
+++ b/src/multimedia/CMakeLists.txt
@@ -396,7 +396,6 @@ qt_internal_extend_target(Multimedia CONDITION APPLE AND NOT TVOS AND NOT WATCHO
platform/darwin/camera/avfcameraservice.mm platform/darwin/camera/avfcameraservice_p.h
platform/darwin/camera/avfcamerasession.mm platform/darwin/camera/avfcamerasession_p.h
platform/darwin/camera/avfcamerautility.mm platform/darwin/camera/avfcamerautility_p.h
- platform/darwin/camera/avfcamerawindowcontrol.mm platform/darwin/camera/avfcamerawindowcontrol_p.h
platform/darwin/camera/avfimagecapturecontrol.mm platform/darwin/camera/avfimagecapturecontrol_p.h
platform/darwin/camera/avfstoragelocation.mm platform/darwin/camera/avfstoragelocation_p.h
)
diff --git a/src/multimedia/platform/darwin/camera/avfcameraservice.mm b/src/multimedia/platform/darwin/camera/avfcameraservice.mm
index 60454acf0..ba6457365 100644
--- a/src/multimedia/platform/darwin/camera/avfcameraservice.mm
+++ b/src/multimedia/platform/darwin/camera/avfcameraservice.mm
@@ -49,7 +49,6 @@
#include "avfcamerafocuscontrol_p.h"
#include "avfcameraexposurecontrol_p.h"
#include "avfcameraimageprocessingcontrol_p.h"
-#include "avfcamerawindowcontrol_p.h"
#include "avfmediaencoder_p.h"
#include <qmediadevicemanager.h>
diff --git a/src/multimedia/platform/darwin/camera/avfcamerawindowcontrol.mm b/src/multimedia/platform/darwin/camera/avfcamerawindowcontrol.mm
deleted file mode 100644
index b6c5981f5..000000000
--- a/src/multimedia/platform/darwin/camera/avfcamerawindowcontrol.mm
+++ /dev/null
@@ -1,259 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd and/or its subsidiary(-ies).
-** 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 "avfcamerawindowcontrol_p.h"
-
-#import <AVFoundation/AVFoundation.h>
-#import <QuartzCore/CATransaction.h>
-
-#if QT_HAS_INCLUDE(<AppKit/AppKit.h>)
-#import <AppKit/AppKit.h>
-#endif
-
-#if QT_HAS_INCLUDE(<UIKit/UIKit.h>)
-#import <UIKit/UIKit.h>
-#endif
-
-QT_USE_NAMESPACE
-
-AVFCameraWindowControl::AVFCameraWindowControl(QVideoSink *parent)
- : QPlatformVideoSink(parent)
-{
- setObjectName(QStringLiteral("AVFCameraWindowControl"));
-}
-
-AVFCameraWindowControl::~AVFCameraWindowControl()
-{
- releaseNativeLayer();
-}
-
-WId AVFCameraWindowControl::winId() const
-{
- return m_winId;
-}
-
-void AVFCameraWindowControl::setWinId(WId id)
-{
- if (m_winId == id)
- return;
-
- m_winId = id;
-
- detachNativeLayer();
- m_nativeView = (NativeView*)m_winId;
- attachNativeLayer();
-}
-
-QRect AVFCameraWindowControl::displayRect() const
-{
- return m_displayRect;
-}
-
-void AVFCameraWindowControl::setDisplayRect(const QRect &rect)
-{
- if (m_displayRect != rect) {
- m_displayRect = rect;
- updateCaptureLayerBounds();
- }
-}
-
-bool AVFCameraWindowControl::isFullScreen() const
-{
- return m_fullscreen;
-}
-
-void AVFCameraWindowControl::setFullScreen(bool fullscreen)
-{
- m_fullscreen = fullscreen;
-}
-
-void AVFCameraWindowControl::repaint()
-{
- if (m_captureLayer)
- [m_captureLayer setNeedsDisplay];
-}
-
-QSize AVFCameraWindowControl::nativeSize() const
-{
- return m_nativeSize;
-}
-
-void AVFCameraWindowControl::setNativeSize(QSize size)
-{
- if (m_nativeSize != size) {
- m_nativeSize = size;
- Q_EMIT nativeSizeChanged();
- }
-}
-
-Qt::AspectRatioMode AVFCameraWindowControl::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void AVFCameraWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- if (m_aspectRatioMode != mode) {
- m_aspectRatioMode = mode;
- updateAspectRatio();
- }
-}
-
-int AVFCameraWindowControl::brightness() const
-{
- return 0;
-}
-
-void AVFCameraWindowControl::setBrightness(int brightness)
-{
- if (0 != brightness)
- qWarning("AVFCameraWindowControl doesn't support changing Brightness");
-}
-
-int AVFCameraWindowControl::contrast() const
-{
- return 0;
-}
-
-void AVFCameraWindowControl::setContrast(int contrast)
-{
- if (0 != contrast)
- qWarning("AVFCameraWindowControl doesn't support changing Contrast");
-}
-
-int AVFCameraWindowControl::hue() const
-{
- return 0;
-}
-
-void AVFCameraWindowControl::setHue(int hue)
-{
- if (0 != hue)
- qWarning("AVFCameraWindowControl doesn't support changing Hue");
-}
-
-int AVFCameraWindowControl::saturation() const
-{
- return 0;
-}
-
-void AVFCameraWindowControl::setSaturation(int saturation)
-{
- if (0 != saturation)
- qWarning("AVFCameraWindowControl doesn't support changing Saturation");
-}
-
-void AVFCameraWindowControl::setLayer(AVCaptureVideoPreviewLayer *capturePreviewLayer)
-{
- if (m_captureLayer == capturePreviewLayer)
- return;
-
- releaseNativeLayer();
-
- m_captureLayer = capturePreviewLayer;
-
- if (m_captureLayer)
- retainNativeLayer();
-}
-
-void AVFCameraWindowControl::updateAspectRatio()
-{
- if (m_captureLayer) {
- switch (m_aspectRatioMode) {
- case Qt::IgnoreAspectRatio:
- [m_captureLayer setVideoGravity:AVLayerVideoGravityResize];
- break;
- case Qt::KeepAspectRatio:
- [m_captureLayer setVideoGravity:AVLayerVideoGravityResizeAspect];
- break;
- case Qt::KeepAspectRatioByExpanding:
- [m_captureLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
- break;
- default:
- break;
- }
- }
-}
-
-void AVFCameraWindowControl::updateCaptureLayerBounds()
-{
- if (m_captureLayer && m_nativeView) {
- [CATransaction begin];
- [CATransaction setDisableActions: YES]; // disable animation/flicks
- m_captureLayer.frame = m_displayRect.toCGRect();
- [CATransaction commit];
- }
-}
-
-void AVFCameraWindowControl::retainNativeLayer()
-{
- [m_captureLayer retain];
-
- updateAspectRatio();
- attachNativeLayer();
-}
-
-void AVFCameraWindowControl::releaseNativeLayer()
-{
- if (m_captureLayer) {
- detachNativeLayer();
- [m_captureLayer release];
- m_captureLayer = nullptr;
- }
-}
-
-void AVFCameraWindowControl::attachNativeLayer()
-{
- if (m_captureLayer && m_nativeView) {
-#if defined(Q_OS_MACOS)
- m_nativeView.wantsLayer = YES;
-#endif
- CALayer *nativeLayer = m_nativeView.layer;
- [nativeLayer addSublayer:m_captureLayer];
- updateCaptureLayerBounds();
- }
-}
-
-void AVFCameraWindowControl::detachNativeLayer()
-{
- if (m_captureLayer && m_nativeView)
- [m_captureLayer removeFromSuperlayer];
-}
-
-#include "moc_avfcamerawindowcontrol_p.cpp"
diff --git a/src/multimedia/platform/darwin/camera/avfcamerawindowcontrol_p.h b/src/multimedia/platform/darwin/camera/avfcamerawindowcontrol_p.h
deleted file mode 100644
index 24dcf4963..000000000
--- a/src/multimedia/platform/darwin/camera/avfcamerawindowcontrol_p.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 AVFCAMERAWINDOWCONTROL_H
-#define AVFCAMERAWINDOWCONTROL_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qplatformvideosink_p.h"
-
-@class AVCaptureVideoPreviewLayer;
-#if defined(Q_OS_MACOS)
-@class NSView;
-typedef NSView NativeView;
-#else
-@class UIView;
-typedef UIView NativeView;
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class AVFCameraWindowControl : public QPlatformVideoSink
-{
- Q_OBJECT
-public:
- AVFCameraWindowControl(QVideoSink *parent = nullptr);
- virtual ~AVFCameraWindowControl() override;
-
- // QPlatformVideoSink interface
-public:
- WId winId() const override;
- void setWinId(WId id) override;
-
- QRect displayRect() const override;
- void setDisplayRect(const QRect &rect) override;
-
- bool isFullScreen() const override;
- void setFullScreen(bool fullScreen) override;
-
- void repaint() override;
-
- QSize nativeSize() const override;
-
- Qt::AspectRatioMode aspectRatioMode() const override;
- void setAspectRatioMode(Qt::AspectRatioMode mode) override;
-
- int brightness() const override;
- void setBrightness(int brightness) override;
-
- int contrast() const override;
- void setContrast(int contrast) override;
-
- int hue() const override;
- void setHue(int hue) override;
-
- int saturation() const override;
- void setSaturation(int saturation) override;
-
- // AVF Camera implementation details
- void setNativeSize(QSize size);
- void setLayer(AVCaptureVideoPreviewLayer *capturePreviewLayer);
-
-private:
- void updateAspectRatio();
- void updateCaptureLayerBounds();
-
- void retainNativeLayer();
- void releaseNativeLayer();
-
- void attachNativeLayer();
- void detachNativeLayer();
-
- WId m_winId{0};
- QRect m_displayRect;
- bool m_fullscreen{false};
- Qt::AspectRatioMode m_aspectRatioMode{Qt::IgnoreAspectRatio};
- QSize m_nativeSize;
- AVCaptureVideoPreviewLayer *m_captureLayer{nullptr};
- NativeView *m_nativeView{nullptr};
-};
-
-QT_END_NAMESPACE
-
-#endif // AVFCAMERAWINDOWCONTROL_H