-
Notifications
You must be signed in to change notification settings - Fork 1
/
media.hxx
169 lines (149 loc) · 2.85 KB
/
media.hxx
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#pragma once
#include "err.hpp"
#include <QMap>
namespace cornus {
/** It must be a QMap (not QHash) because
"When iterating over a QMap, the items are always sorted by key. With QHash,
the items are arbitrarily ordered."
Thus when inserting a new item with its ID as the current QMap size it works.
Hence only a QMap can have the (implied) ID not change.
Note: QMap items may never be removed, only their names changed.
*/
using HashI2S = QMap<i16, QString>;
using HashI2V = QMap<i16, QVector<QString>>;
using HashI4V = QMap<i32, QVector<QString>>;
namespace media {
static const QString XAttrName = QStringLiteral("user.CornusMas.m");
static const QString XAttrThumbnail = QStringLiteral("user.CornusMas.thmb");
static const QString XAttrWatched = QStringLiteral("user.CornusMas.watched");
namespace WatchProps {
static const QString Name = QStringLiteral("user.CornusMas.wp");
const u64 LastWatched = 1u << 0;
const u64 Watched = 1u << 1;
}
struct Data {
HashI4V actors;
HashI4V directors;
HashI4V writers;
HashI2V genres;
HashI2V subgenres;
HashI2V countries;
HashI2S rips;
HashI2S video_codecs;
i32 magic_number = -1;
};
struct MediaPreview {
inline MediaPreview* Clone() {
auto *p = new MediaPreview();
p->actors = actors;
p->directors = directors;
p->writers = writers;
p->genres = genres;
p->subgenres = subgenres;
p->countries = countries;
p->rips = rips;
p->video_codecs = video_codecs;
p->video_w = video_w;
p->video_h = video_h;
p->magic_number = magic_number;
p->fps = fps;
p->year_started = year_started;
p->year_end = year_end;
p->bit_depth = bit_depth;
p->month_started = month_started;
p->day_started = day_started;
return p;
}
QVector<i32> actors;
QVector<i32> directors;
QVector<i32> writers;
QVector<i16> genres;
QVector<i16> subgenres;
QVector<i16> countries;
QVector<i16> rips;
QVector<i16> video_codecs;
i32 video_w = -1;
i32 video_h = -1;
i32 magic_number = -1;
f32 fps = -1;
i16 year_started = -1;
i16 year_end = -1;
i16 bit_depth = -1;
i8 month_started = -1;
i8 day_started = -1;
};
enum class Check: i8 {
Exists,
None,
};
enum class Action: i8 {
Insert,
Append
};
enum class Rip: i16 {
None = 0,
CAMRip,
TS,
TC,
SuperTS,
WP,
SCR,
DVDScr,
VHSRip,
TVRip,
SATRip,
IPTVRip,
DVB,
HDTV,
HDTVRip,
WEBRip,
WEB_DL,
WEB_DLRip,
DVD5,
DVD9,
DVDRip,
HDRip,
BDRip,
Hybrid,
HDDVDRip,
UHD_BDRip,
BDRemux,
HDDVDRemux,
Blu_Ray,
HDDVD,
UHD_Blu_Ray,
UHD_BDRemux,
};
enum class VideoCodec: i16 {
AV1,
VP8,
VP9,
H263,
H264,
H265,
H266,
DivX,
Xvid,
Other,
};
enum class Field: u8 {
None = 0,
Actors,
Writers,
Directors,
Genres,
Subgenres,
Countries,
YearStarted, // e.g. 2011
YearEnded, // e.g. 2011-2015
VideoCodecBitDepth,
Rip,
VideoCodec,
VideoResolution,
FPS,
Comments,
// Added 2022.03.30:
MonthStarted,
DayStarted,
};
}} // cornus::media::