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
avfcamerasession_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 AVFCAMERASESSION_H
5#define AVFCAMERASESSION_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 <QtCore/qmutex.h>
19#include <QtMultimedia/qcamera.h>
20#include <QVideoFrame>
21#include <qcameradevice.h>
23
24#import <AVFoundation/AVFoundation.h>
25
27
29
30class AVFCamera;
33class AVFVideoSink;
34class QVideoSink;
35
37{
39public:
40 AVFCameraSession(AVFCameraService *service, QObject *parent = nullptr);
42
43 QCameraDevice activecameraDevice() const { return m_activeCameraDevice; }
45
48
49 AVFCameraRenderer *videoOutput() const { return m_videoOutput; }
50 AVCaptureAudioDataOutput *audioOutput() const { return m_audioOutput; }
51 AVFAudioPreviewDelegate *audioPreviewDelegate() const { return m_audioPreviewDelegate; }
52
53 AVCaptureSession *captureSession() const { return m_captureSession; }
54 AVCaptureDevice *videoCaptureDevice() const;
55 AVCaptureDevice *audioCaptureDevice() const;
56
57 bool isActive() const;
58
59 FourCharCode defaultCodec();
60
61 AVCaptureDeviceInput *videoInput() const { return m_videoInput; }
62 AVCaptureDeviceInput *audioInput() const { return m_audioInput; }
63
65
66 void updateVideoInput();
67
68 void updateAudioInput();
69 void updateAudioOutput();
70
71public Q_SLOTS:
72 void setActive(bool active);
73
74 void setAudioInputVolume(float volume);
75 void setAudioInputMuted(bool muted);
76 void setAudioOutputMuted(bool muted);
77 void setAudioOutputVolume(float volume);
78
82
85 void activeChanged(bool);
86 void error(int error, const QString &errorString);
88
89private:
90 void updateCameraFormat(const QCameraFormat &format);
91
92 void setVideoOutput(AVFCameraRenderer *output);
93 void updateVideoOutput();
94
95 void addAudioCapture();
96
97 AVCaptureDevice *createVideoCaptureDevice();
98 AVCaptureDevice *createAudioCaptureDevice();
99 void attachVideoInputDevice();
100 void attachAudioInputDevice();
101 bool checkCameraPermission();
102 bool checkMicrophonePermission();
103
104 bool applyImageEncoderSettings();
105
106 QCameraDevice m_activeCameraDevice;
107 QCameraFormat m_cameraFormat;
108
109 AVFCameraService *m_service;
110 AVCaptureSession *m_captureSession;
111 AVFCameraSessionObserver *m_observer;
112
113 AVFCameraRenderer *m_videoOutput = nullptr;
114 AVFVideoSink *m_videoSink = nullptr;
115
116 AVCaptureDeviceInput *m_videoInput = nullptr;
117 AVCaptureDeviceInput *m_audioInput = nullptr;
118
119 AVCaptureAudioDataOutput *m_audioOutput = nullptr;
120 AVFAudioPreviewDelegate *m_audioPreviewDelegate = nullptr;
121
122 bool m_active = false;
123
124 float m_inputVolume = 1.0;
125 bool m_inputMuted = false;
126
127 FourCharCode m_defaultCodec;
128};
129
131
132#endif
void error(int error, const QString &errorString)
void setActive(bool active)
AVCaptureDeviceInput * videoInput() const
AVCaptureSession * captureSession() const
QCameraDevice activecameraDevice() const
void setCameraFormat(const QCameraFormat &format)
AVCaptureDevice * videoCaptureDevice() const
void setAudioOutputMuted(bool muted)
QCameraFormat cameraFormat() const
void readyToConfigureConnections()
void setActiveCamera(const QCameraDevice &info)
void setAudioInputVolume(float volume)
AVFCameraRenderer * videoOutput() const
AVFCameraSession(AVFCameraService *service, QObject *parent=nullptr)
AVCaptureDevice * audioCaptureDevice() const
void newViewfinderFrame(const QVideoFrame &frame)
void setVideoSink(QVideoSink *sink)
FourCharCode defaultCodec()
void activeChanged(bool)
void setAudioOutputVolume(float volume)
AVCaptureDeviceInput * audioInput() const
void setAudioInputMuted(bool muted)
AVFAudioPreviewDelegate * audioPreviewDelegate() const
AVCaptureAudioDataOutput * audioOutput() const
The QCameraDevice class provides general information about camera devices.
The QCameraFormat class describes a video format supported by a camera device. \inmodule QtMultimedia...
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
The QVideoSink class represents a generic sink for video data.
Definition qvideosink.h:22
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
GLint GLsizei GLsizei GLenum format
GLsizei GLenum GLboolean sink
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
QT_BEGIN_NAMESPACE typedef uchar * output
QFrame frame
[0]
QHostInfo info
[0]