Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qffmpegencodinginitializer_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 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 QENCODINGINITIALIZER_P_H
5#define QENCODINGINITIALIZER_P_H
6
7#include "qobject.h"
8#include <QtMultimedia/private/qmediainputencoderinterface_p.h>
9#include <unordered_set>
10#include <vector>
11
12//
13// W A R N I N G
14// -------------
15//
16// This file is not part of the Qt API. It exists purely as an
17// implementation detail. This header file may change from version to
18// version without notice, or even be removed.
19//
20// We mean it.
21//
22
23QT_BEGIN_NAMESPACE
24
25class QFFmpegAudioInput;
26class QPlatformVideoSource;
27class QPlatformAudioBufferInput;
28class QAudioBufferSource;
30
31namespace QFFmpeg {
32
33class RecordingEngine;
34
35// Initializes RecordingEngine with audio and video sources, potentially lazily
36// upon first frame arrival if video frame format is not pre-determined.
38{
39public:
41
43
44 bool start(const std::vector<QAudioBufferSource *> &audioSources,
45 const std::vector<QPlatformVideoSource *> &videoSources);
46
47private:
48 void addAudioBufferInput(QPlatformAudioBufferInput *input);
49
50 void addPendingAudioBufferInput(QPlatformAudioBufferInput *input);
51
52 void addVideoSource(QPlatformVideoSource *source);
53
54 void addPendingVideoSource(QPlatformVideoSource *source);
55
56 void addPendingSource(QObject *source);
57
58 bool tryStartRecordingEngine();
59
60private:
61 void emitStreamInitializationError(QString error);
62
63 template <typename F>
64 void erasePendingSource(QObject *source, F &&functionOrError, bool destroyed = false);
65
66 bool canPushFrame() const override;
67
68private:
69 RecordingEngine &m_recordingEngine;
70 std::unordered_set<QObject *> m_pendingSources;
71};
72
73} // namespace QFFmpeg
74
75QT_END_NAMESPACE
76
77#endif // QENCODINGINITIALIZER_P_H
EncodingInitializer(RecordingEngine &engine)
bool start(const std::vector< QAudioBufferSource * > &audioSources, const std::vector< QPlatformVideoSource * > &videoSources)
std::conditional_t< QT_FFMPEG_AVIO_WRITE_CONST, const uint8_t *, uint8_t * > AvioWriteBufferType