-
Notifications
You must be signed in to change notification settings - Fork 60
/
qsvreader.h
80 lines (55 loc) · 1.26 KB
/
qsvreader.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
79
80
#pragma once
#include <cstdio>
#include <cstdint>
#include <cstring>
#include <QFile>
typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef uint64_t QWORD;
#define QSV_SIZE_ENCRYPTED 0x400
const char QSV_SIGNATURE[] = "QIYI VIDEO";
#pragma pack(1)
typedef struct {
BYTE signature[0xA];
DWORD version;
BYTE vid[0x10];
DWORD _unknown1;
BYTE _unknown2[0x20];
DWORD _unknown3;
DWORD _unknown4;
QWORD xml_offset;
DWORD xml_size;
DWORD nb_indices;
} QsvHeader;
typedef struct {
BYTE _codetable[0x10];
QWORD segment_offset;
DWORD segment_size;
} QsvIndex;
#pragma pack()
void decrypt_1(BYTE* buffer, DWORD size);
void decrypt_2(BYTE* buffer, DWORD size);
class QsvUnpacker {
private:
QFile* infile;
int errcode;
QString msg;
int version;
int nb_indices;
QsvIndex* qindices;
int read_index;
int read_offset;
int total_size;
int processed_size;
public:
QsvUnpacker(const QString& file_path);
~QsvUnpacker();
int get_errcode() const;
const QString& get_msg() const;
int get_nb_indices() const;
void seek_to_segment(int idx);
int read_bytes(BYTE* buffer, int query_size);
void init_progress();
float get_progress() const;
};