blob: b6628b917cbc2608e4f4d81aaa0c9973bd9ba5e5 (
plain) (
blame)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
#pragma once
#include <bfc/platform/types.h>
namespace nsavi
{
#pragma pack(push, 1)
static const uint32_t avi_header_flags_has_index = 0x10;
static const uint32_t avi_header_flags_must_use_index = 0x20;
static const uint32_t avi_header_flags_is_interleaved = 0x100;
static const uint32_t avi_header_trust_ck_type = 0x800; // benski> i have no fucking clue
static const uint32_t avi_header_flags_was_capture_file = 0x10000;
static const uint32_t avi_header_flags_copyrighted = 0x20000;
static const uint32_t stream_type_audio = 0x73647561;
static const uint32_t stream_type_video = 0x73646976;
const uint16_t audio_format_pcm = 1;
const uint16_t audio_format_ms_adpcm = 2;
const uint16_t audio_format_alaw = 6;
const uint16_t audio_format_ulaw = 7;
const uint16_t audio_format_ima_adpcm = 17;
const uint16_t audio_format_truespeech = 34;
const uint16_t audio_format_mp2 = 80;
const uint16_t audio_format_mp3 = 85;
const uint16_t audio_format_a52 = 8192;
const uint16_t audio_format_aac = 255;
const uint16_t audio_format_vorbis = 26447;
const uint16_t audio_format_speex = 41225;
const uint16_t audio_format_extensible = 65534; // aka WAVE_FORMAT_EXTENSIBLE
const uint16_t audio_format_dts = 8193;
static uint32_t video_format_rgb = 0;
static uint32_t video_format_rle8 = 1;
static uint32_t video_format_rle4 = 2;
static const uint32_t idx1_flags_keyframe = 0x10;
static const uint32_t idx1_flags_no_duration= 0x100;
struct AVIH
{
uint32_t size_bytes;
uint32_t microseconds_per_frame;
uint32_t max_bytes_per_second;
uint32_t padding_granularity;
uint32_t flags;
uint32_t total_frames;
uint32_t initial_frames;
uint32_t streams;
uint32_t suggested_buffer_size;
uint32_t width;
uint32_t height;
uint8_t reserved[16];
};
struct STRH
{
uint32_t size_bytes;
uint32_t stream_type;
uint32_t fourcc;
uint32_t flags;
uint16_t priority;
uint16_t language;
uint32_t initial_frames;
uint32_t scale;
uint32_t rate;
uint32_t start;
uint32_t length;
uint32_t suggested_buffer_size;
uint32_t quality;
uint32_t sample_size;
int16_t left;
int16_t top;
int16_t right;
int16_t bottom;
};
struct VIDEO_FIELD_DESC
{
uint32_t compressed_height;
uint32_t compressed_width;
uint32_t valid_height;
uint32_t valid_width;
uint32_t valid_x_offset;
uint32_t valid_y_offset;
uint32_t x_offset;
uint32_t valid_y_start_line;
};
struct VPRP
{
uint32_t size_bytes;
uint32_t video_format_token;
uint32_t video_standard;
uint32_t vertical_refresh_rate;
uint32_t horizontal_total;
uint32_t vertical_total;
uint32_t aspect_ratio;
uint32_t frame_width;
uint32_t frame_height;
uint32_t field_info_size;
VIDEO_FIELD_DESC field_info[1];
};
struct STRF
{
uint32_t size_bytes;
};
struct STRD
{
uint32_t size_bytes;
};
struct STRN
{
uint32_t size_bytes;
};
struct DMLH
{
uint32_t size_bytes;
uint32_t total_frames;
};
struct IDX1_INDEX
{
uint32_t chunk_id;
uint32_t flags;
uint32_t offset;
uint32_t chunk_size;
};
struct IDX1
{
uint32_t index_count;
IDX1_INDEX indices[1];
};
static const uint8_t indx_type_master = 0x0;
static const uint8_t indx_type_chunk = 0x1;
static const uint8_t indx_type_data = 0x80;
static const uint8_t indx_subtype_field = 0x1;
struct INDX
{
uint32_t size_bytes;
uint16_t entry_size;
uint8_t index_sub_type;
uint8_t index_type;
uint32_t number_of_entries;
uint32_t chunk_id;
};
struct INDX_MASTER_ENTRY
{
uint64_t offset;
uint32_t index_size;
uint32_t duration;
};
struct AVISUPERINDEX
{
INDX indx;
uint32_t reserved[3];
INDX_MASTER_ENTRY entries[1]; // actual size determined by indx.number_of_entries
};
struct INDX_CHUNK_ENTRY
{
uint32_t offset;
uint32_t size ;// bit 31 is set if this is NOT a keyframe
};
struct AVISTDINDEX
{
INDX indx;
uint64_t base_offset;
uint32_t reserved;
INDX_CHUNK_ENTRY entries[1]; // actual size determined by indx.number_of_entries
};
struct INDX_FIELD_ENTRY
{
uint32_t offset;
uint32_t size; // size of all fields. bit 31 set for NON-keyframes
uint32_t offset_field2; // offset to second field
};
struct AVIFIELDINDEX
{
INDX indx;
uint64_t base_offset;
uint32_t reserved;
INDX_FIELD_ENTRY entries[1]; // actual size determined by indx.number_of_entries
};
struct video_format
{
uint32_t size_bytes;
uint32_t video_format_size_bytes; // redundant, I know
int32_t width;
int32_t height;
uint16_t planes;
uint16_t bits_per_pixel;
uint32_t compression;
uint32_t image_size;
int32_t x_pixels_per_meter;
int32_t y_pixels_per_meter;
uint32_t color_used;
uint32_t color_important;
};
struct audio_format
{
uint32_t size_bytes;
uint16_t format;
uint16_t channels;
uint32_t sample_rate;
uint32_t average_bytes_per_second;
uint16_t block_align;
uint16_t bits_per_sample;
uint16_t extra_size_bytes;
};
struct mp3_format
{
audio_format format;
uint16_t id;
uint32_t flags;
uint16_t block_size;
uint16_t frames_per_block;
uint16_t codec_delay;
};
struct STRL
{
STRH *stream_header;
STRF *stream_format;
STRD *stream_data;
STRN *stream_name;
INDX *stream_index;
VPRP *video_properties;
};
#pragma pack(pop)
}
|