forked from difcareer/010templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
OGGTemplate.bt
executable file
·56 lines (47 loc) · 1.24 KB
/
OGGTemplate.bt
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
//--------------------------------------
//--- 010 Editor v4.0.4 Binary Template
//
// File: OGGTemplate.bt
// Author: George Woods
// Revision:
// Purpose: Parses the ogg container format.
//--------------------------------------
// ogg files can be quite large. Don't read more the 1000 pages.
local uint MAXPAGES = 1000;
typedef struct { // bmfh
CHAR CapturePattern[4];
BYTE Version;
BYTE HeaderType;
QUAD GranulePosition;
DWORD BitstreamSerial;
DWORD PageSequenceNumber;
DWORD Checksum;
UBYTE PageSegments;
// the lengths of the segments that follow
UBYTE SegmentLen[PageSegments];
// the segments themselves
local uint i;
for (i = 0; i < PageSegments; i++) {
struct {
BYTE Data[SegmentLen[i]] <bgcolor=cLtGray>;
} Segment;
}
} PAGE;
LittleEndian();
local uint currpage = 0;
while( !FEof() )
{
currpage++;
if (MAXPAGES < currpage)
{
Printf("Max Pages of %d reached!\n", maxpages);
return 0;
}
PAGE page <bgcolor=cLtBlue>;
// Check for valid header
if( page.CapturePattern != "OggS" )
{
Warning( "File is not a valid ogg file. Template stopped." );
return -1;
}
}