-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimages_panel.h
55 lines (39 loc) · 1.14 KB
/
images_panel.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
#pragma once
#include <vector>
#include <map>
#include <QWidget>
#include <QGridLayout>
#include "decoder_thread.h"
#include "glwidget.h"
using std::vector;
using std::map;
struct AVFrame;
class ImagesPanel : public QWidget
{
Q_OBJECT
public:
explicit ImagesPanel(QWidget *parent = nullptr);
void InitGLWidgets();
void PutLayout();
signals:
void signal_require_frames(uint32_t n);
void signal_frame_consumed(AVFrame* frame);
private slots:
void on_frame_decoded(uint32_t frame_id, AVFrame* avframe);
void on_timer();
public:
map<uint32_t, AVFrame*> frames_map; // frame_id -> AVFrame*
vector<GLWidget*> glwidgets_; // size = 2^x
// AVFrame record at [ frame_id % glwidgets_.size() ]
// layout 第一个 widget 的 id
// 滚动的时候此 id 会跟随变大 or 变小
// layout 中的 widget 也会滚动
// i.e. 当前显示 glwidgets_[1],[2],glwidgets_[3],4, 向后滚动 2 个, 就展示 3,4,5,6
vector<uint32_t> displayed_frame_ids;
QGridLayout *layout_ = nullptr;
uint32_t layout_row_ = 7;
uint32_t layout_col_ = 7;
DecoderThread *dec_obj_ = nullptr;
QThread dec_thread_;
QTimer *timer_ = nullptr;
};