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 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class QAudioSource; |
23 | class QAudioSourceIO; |
24 | class QAudioBuffer; |
25 | class QMediaMetaData; |
26 | class QFFmpegMediaCaptureSession; |
27 | |
28 | namespace QFFmpeg { |
29 | class RecordingEngine; |
30 | } |
31 | |
32 | class QFFmpegMediaRecorder : public QObject, public QPlatformMediaRecorder |
33 | { |
34 | Q_OBJECT |
35 | public: |
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 | |
53 | private Q_SLOTS: |
54 | void newDuration(qint64 d) { durationChanged(position: d); } |
55 | void finalizationDone(); |
56 | void handleSessionError(QMediaRecorder::Error code, const QString &description); |
57 | |
58 | private: |
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 | |
71 | QT_END_NAMESPACE |
72 | |
73 | #endif // QFFMPEGMEDIARECODER_H |
74 |