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 QFFMPEGMEDIARECODER_H
5#define QFFMPEGMEDIARECODER_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 <private/qplatformmediarecorder_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class QAudioSource;
23class QAudioSourceIO;
24class QAudioBuffer;
25class QMediaMetaData;
26class QFFmpegMediaCaptureSession;
27
28namespace QFFmpeg {
29class RecordingEngine;
30}
31
32class QFFmpegMediaRecorder : public QObject, public QPlatformMediaRecorder
33{
34 Q_OBJECT
35public:
36 QFFmpegMediaRecorder(QMediaRecorder *parent);
37 virtual ~QFFmpegMediaRecorder();
38
39 bool isLocationWritable(const QUrl &sink) const override;
40
41 void record(QMediaEncoderSettings &settings) override;
42 void pause() override;
43 void resume() override;
44 void stop() override;
45
46 void setMetaData(const QMediaMetaData &) override;
47 QMediaMetaData metaData() const override;
48
49 void setCaptureSession(QFFmpegMediaCaptureSession *session);
50
51 void updateAutoStop() override;
52
53private Q_SLOTS:
54 void newDuration(qint64 d) { durationChanged(position: d); }
55 void finalizationDone();
56 void handleSessionError(QMediaRecorder::Error code, const QString &description);
57
58private:
59 using RecordingEngine = QFFmpeg::RecordingEngine;
60 struct RecordingEngineDeleter
61 {
62 void operator()(RecordingEngine *) const;
63 };
64
65 QFFmpegMediaCaptureSession *m_session = nullptr;
66 QMediaMetaData m_metaData;
67
68 std::unique_ptr<RecordingEngine, RecordingEngineDeleter> m_recordingEngine;
69};
70
71QT_END_NAMESPACE
72
73#endif // QFFMPEGMEDIARECODER_H
74

source code of qtmultimedia/src/plugins/multimedia/ffmpeg/qffmpegmediarecorder_p.h