Screenrecorder
Credit goes to Neokii! https: //github.com/neokii Co-Authored-By: neokii <3665951+neokii@users.noreply.github.com>
This commit is contained in:
55
selfdrive/frogpilot/screenrecorder/screenrecorder.h
Normal file
55
selfdrive/frogpilot/screenrecorder/screenrecorder.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "omx_encoder.h"
|
||||
#include "blocking_queue.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
class ScreenRecorder : public QPushButton {
|
||||
#ifdef WSL2
|
||||
public:
|
||||
explicit ScreenRecorder(QWidget *parent = nullptr){}
|
||||
~ScreenRecorder() override{}
|
||||
|
||||
void update_screen(){}
|
||||
void toggle(){}
|
||||
#else
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScreenRecorder(QWidget *parent = nullptr);
|
||||
~ScreenRecorder() override;
|
||||
|
||||
void update_screen();
|
||||
void toggle();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
void applyColor();
|
||||
void closeEncoder();
|
||||
void encoding_thread_func();
|
||||
void initializeEncoder();
|
||||
void openEncoder(const char *filename);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
bool recording;
|
||||
int frame;
|
||||
int recording_height;
|
||||
int recording_width;
|
||||
int screen_height;
|
||||
int screen_width;
|
||||
long long started = 0;
|
||||
|
||||
std::unique_ptr<OmxEncoder> encoder;
|
||||
std::unique_ptr<uint8_t[]> rgb_scale_buffer;
|
||||
std::thread encoding_thread;
|
||||
|
||||
BlockingQueue<QImage> image_queue;
|
||||
QColor recording_color;
|
||||
QWidget *rootWidget;
|
||||
#endif //WSL2
|
||||
};
|
||||
Reference in New Issue
Block a user