Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qavfcamera_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QAVFCAMERA_H
5#define QAVFCAMERA_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qavfcamerabase_p.h"
19#include <private/qplatformmediaintegration_p.h>
20#include <private/qvideooutputorientationhandler_p.h>
21#define AVMediaType XAVMediaType
22#include "qffmpeghwaccel_p.h"
23#undef AVMediaType
24
25#include <qfilesystemwatcher.h>
26#include <qsocketnotifier.h>
27#include <qmutex.h>
28
29#include <dispatch/dispatch.h>
30
32Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDeviceInput);
33Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureVideoDataOutput);
36
38
40
42{
44
45public:
46 explicit QAVFCamera(QCamera *parent);
48
49 bool isActive() const override;
50 void setActive(bool active) override;
51
53
54 void setCamera(const QCameraDevice &camera) override;
55 bool setCameraFormat(const QCameraFormat &format) override;
56
58
59 void deviceOrientationChanged(int angle = -1);
60
61 std::optional<int> ffmpegHWPixelFormat() const override;
62
64 QVideoFrameFormat::ColorRange colorRange) const override;
65
66private:
67 bool checkCameraPermission();
68 void updateCameraFormat();
69 void updateVideoInput();
70 void attachVideoInputDevice();
71 uint32_t setPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat, uint32_t inputCvPixFormat);
72 QSize adjustedResolution() const;
73
74 AVCaptureDevice *device() const;
75
76 QMediaCaptureSession *m_session = nullptr;
77 AVCaptureSession *m_captureSession = nullptr;
78 AVCaptureDeviceInput *m_videoInput = nullptr;
79 AVCaptureVideoDataOutput *m_videoDataOutput = nullptr;
80 QAVFSampleBufferDelegate *m_sampleBufferDelegate = nullptr;
81 dispatch_queue_t m_delegateQueue;
82 QVideoOutputOrientationHandler m_orientationHandler;
83 AVPixelFormat m_hwPixelFormat = AV_PIX_FMT_NONE;
84};
85
87
88
89#endif // QFFMPEGCAMERA_H
90
void setCaptureSession(QPlatformMediaCaptureSession *) override
void setCamera(const QCameraDevice &camera) override
void deviceOrientationChanged(int angle=-1)
Definition qavfcamera.mm:78
int cameraPixelFormatScore(QVideoFrameFormat::PixelFormat pixelFmt, QVideoFrameFormat::ColorRange colorRange) const override
void setActive(bool active) override
void syncHandleFrame(const QVideoFrame &frame)
bool setCameraFormat(const QCameraFormat &format) override
QAVFCamera(QCamera *parent)
Definition qavfcamera.mm:28
bool isActive() const override
std::optional< int > ffmpegHWPixelFormat() const override
The QCameraDevice class provides general information about camera devices.
The QCameraFormat class describes a video format supported by a camera device. \inmodule QtMultimedia...
The QCamera class provides interface for system camera devices.
Definition qcamera.h:28
The QMediaCaptureSession class allows capturing of audio and video content.
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
Definition qsize.h:25
PixelFormat
Enumerates video data types.
ColorRange
Describes the color range used by the video data.
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
QCamera * camera
Definition camera.cpp:19
Combined button and popup list for selecting options.
#define Q_FORWARD_DECLARE_OBJC_CLASS(classname)
GLfloat angle
GLint GLsizei GLsizei GLenum format
#define Q_OBJECT
QFrame frame
[0]