Rabbit Remote Control 0.1.0-alpha.2
Loading...
Searching...
No Matches
ParameterRecord.h
1// Author: Kang Lin <kl222@126.com>
2
3#pragma once
4
5#if HAVE_QT6_MULTIMEDIA
6 #include <QMediaFormat>
7#endif
8#include <QMediaRecorder>
9
10#include "Parameter.h"
11
12class PLUGIN_EXPORT CParameterRecord : public CParameter
13{
14 Q_OBJECT
15
16public:
17 explicit CParameterRecord(QObject *parent = nullptr,
18 const QString& szPrefix = QString());
19
20 const QString GetVideoPath() const;
21 int SetVideoPath(const QString& szPath);
22
28 const QString GetVideoFile(bool bAuto = false);
29 int SetVideoFile(const QString& szFile);
30
31 QString GetImageFile(bool bAuto = false);
32 void SetImageFile(const QString &newImageFile);
33
34 QString GetImagePath() const;
35 void SetImagePath(const QString &newImagePath);
36
37#if HAVE_QT6_MULTIMEDIA
38 const QMediaFormat::FileFormat GetFileFormat() const;
39 int SetFileFormat(const QMediaFormat::FileFormat &f);
40
41 const QMediaFormat::VideoCodec GetVideoCodec() const;
42 int SetVideoCodec(QMediaFormat::VideoCodec);
43
44 const QMediaFormat::AudioCodec GetAudioCodec() const;
45 int SetAudioCodec(QMediaFormat::AudioCodec);
46
47 QMediaRecorder::Quality GetQuality() const;
48 void SetQuality(const QMediaRecorder::Quality &newQuality);
49 QMediaRecorder::EncodingMode GetEncodingMode() const;
50 void SetEncodingMode(const QMediaRecorder::EncodingMode &newEncodingMode);
51#endif
52
53 qreal GetVideoFrameRate() const;
54 void SetVideoFrameRate(qreal newVideoFrameRate);
55 int GetAudioSampleRate() const;
56 void SetAudioSampleRate(int newAudioSampleRate);
57
58 virtual CParameterRecord& operator=(const CParameterRecord &in);
59
60 bool GetEnableVideo() const;
61 void SetEnableVideo(bool newEnableVideo);
62 bool GetEnableAudio() const;
63 void SetEnableAudio(bool newEnableAudio);
64
65 enum ENDACTION {
66 No,
67 OpenFile,
68 OpenFolder
69 };
70 Q_ENUM(ENDACTION)
71
72 CParameterRecord::ENDACTION GetEndAction() const;
73 void SetEndAction(ENDACTION newEndAction);
74
75Q_SIGNALS:
76 void sigQualityChanged();
77 void sigEncodingModeChanged();
78 void sigImageFileChanged();
79 void sigEnableVideoChanged();
80 void sigEnableAudioChanged();
81 void sigEndActionChanged();
82
83 void ImagePathChanged();
84
85private:
86 bool m_bEnableVideo;
87 bool m_bEnableAudio;
88 QString m_szVideoFile;
89 QString m_szVideoPath;
90 QString m_szImageFile;
91 QString m_szImagePath;
92
93#if HAVE_QT6_MULTIMEDIA
94 QMediaFormat::FileFormat m_FileFormat;
95 QMediaFormat::VideoCodec m_VideoCodec;
96 QMediaFormat::AudioCodec m_AudioCodec;
97
98 QMediaRecorder::Quality m_Quality;
99 QMediaRecorder::EncodingMode m_EncodingMode;
100#endif
101
102 qreal m_VideoFrameRate;
103 int m_AudioSampleRate;
104
105 ENDACTION m_EndAction;
106
107protected:
108 virtual int OnLoad(QSettings &set) override;
109 virtual int OnSave(QSettings &set) override;
110};
111
112PLUGIN_EXPORT CParameterRecord& operator << (CParameterRecord& para, QMediaRecorder& recorder);
113PLUGIN_EXPORT CParameterRecord& operator << (CParameterRecord& para, QMediaRecorder& recorder);
114PLUGIN_EXPORT CParameterRecord& operator >> (CParameterRecord& para, QMediaRecorder& recorder);
115
Parameter interface.
Definition Parameter.h:209