Qt 6.x
The Qt SDK
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
65private:
66 bool checkCameraPermission();
67 void updateCameraFormat();
68 void updateVideoInput();
69 void attachVideoInputDevice();
70 uint32_t setPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat, uint32_t inputCvPixFormat);
71
72 AVCaptureDevice *device() const;
73
74 QMediaCaptureSession *m_session = nullptr;
75 AVCaptureSession *m_captureSession = nullptr;
76 AVCaptureDeviceInput *m_videoInput = nullptr;
77 AVCaptureVideoDataOutput *m_videoDataOutput = nullptr;
78 QAVFSampleBufferDelegate *m_sampleBufferDelegate = nullptr;
79 dispatch_queue_t m_delegateQueue;
80 QVideoOutputOrientationHandler m_orientationHandler;
81 AVPixelFormat m_hwPixelFormat = AV_PIX_FMT_NONE;
82};
83
85
86
87#endif // QFFMPEGCAMERA_H
88
int cameraPixelFormatScore(QVideoFrameFormat::PixelFormat pixFmt) const override
void setCaptureSession(QPlatformMediaCaptureSession *) override
void setCamera(const QCameraDevice &camera) override
void deviceOrientationChanged(int angle=-1)
Definition qavfcamera.mm:78
void setActive(bool active) override
void syncHandleFrame(const QVideoFrame &frame)
bool setCameraFormat(const QCameraFormat &format) override
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.
PixelFormat
Enumerates video data types.
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:26
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]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent