-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathscreenrecorder.h
78 lines (56 loc) · 1.62 KB
/
screenrecorder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef CAPTURER_SCREEN_RECORDER_H
#define CAPTURER_SCREEN_RECORDER_H
#include "libcap/consumer.h"
#include "libcap/dispatcher.h"
#include "libcap/screen-capturer.h"
#include "menu/recording-menu.h"
#include "selector.h"
class QTimer;
class ScreenRecorder final : public QWidget
{
Q_OBJECT
public:
enum
{
VIDEO,
GIF
};
public:
explicit ScreenRecorder(int type = VIDEO, QWidget * = nullptr);
signals:
void saved(const QString& path);
public slots:
void start();
void record();
void stop();
void mute(int type, bool v);
void setStyle(const SelectorStyle& style);
private:
void keyPressEvent(QKeyEvent *) override;
void setup();
int rec_type_{ VIDEO };
Selector *selector_{};
bool recording_{ false };
// parameters
AVPixelFormat pix_fmt_{ AV_PIX_FMT_YUV420P };
std::string codec_name_{ "libx264" };
std::string filters_{};
std::map<std::string, std::string> encoder_options_{};
// filename
std::string filename_{};
// recording menu
RecordingMenu *menu_{};
bool m_mute_{};
bool s_mute_{};
// sources
std::unique_ptr<ScreenCapturer> desktop_src_{};
std::unique_ptr<Producer<av::frame>> mic_src_{};
std::unique_ptr<Producer<av::frame>> speaker_src_{};
// dispatcher
std::unique_ptr<Dispatcher> dispatcher_{};
// sink
std::unique_ptr<Consumer<av::frame>> encoder_{};
// timer for displaying time on recording menu
QTimer *timer_{ nullptr };
};
#endif //! CAPTURER_SCREEN_RECORDER_H