forked from shi-yan/H264Naked
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathH264NALListModel.hpp
54 lines (40 loc) · 1.17 KB
/
H264NALListModel.hpp
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
#ifndef H264NALLISTMODEL_H
#define H264NALLISTMODEL_H
#include <QAbstractTableModel>
#include <QByteArray>
#include <h264_stream.h>
#include <QVector>
#include <QFile>
class H264NALListModel : public QAbstractTableModel
{
Q_OBJECT
using NalReadBuffer = std::vector<uint8_t>;
struct H264Deleter
{
static void cleanup(h264_stream_t *p) { h264_free(p); }
};
struct H264NALIndexEntry
{
int type;
int ref_idc;
ptrdiff_t offset;
size_t size;
size_t parsed_size;
};
QVector<H264NALIndexEntry> _nalListIndex;
mutable QFile _bitstream;
mutable NalReadBuffer _readBuffer;
mutable QScopedPointer<h264_stream_t, H264Deleter> _parser;
public:
H264NALListModel(QObject *parent = nullptr);
bool setFile(const QString &filename);
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QVariant data(const QModelIndex &index, int role) const;
signals:
void parsingProgress(qreal percent);
private:
void parseBitstream();
};
#endif // H264NALLISTMODEL_H