-
Notifications
You must be signed in to change notification settings - Fork 52
/
FLVTemplate.bt
executable file
·92 lines (82 loc) · 1.93 KB
/
FLVTemplate.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
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
//-----------------------------------
//--- 010 Editor v3.0 Binary Template
//
// File: FLVTemplate.bt
// Author: lafei([email protected])
// Revision: 2.1
// Purpose: Defines a template for
// parsing FLV files.
//-----------------------------------
// Define structures used in FLV files
typedef struct {
CHAR signature[3]; //"FLV"
UBYTE version;
UBYTE dummy : 5;
UBYTE audio : 1; //1 if audio present
UBYTE dummy2 : 1;
UBYTE video : 1; //1 if video present
DWORD dataoffset; //in abs. file offset
DWORD zero; //previous tag size
} HEADER;
local UINT taglen;
typedef struct {
UINT type : 8;
UINT datasize : 24;
UINT timestamp : 24;
UINT timestamphi : 8;
UINT streamid : 24;
taglen = datasize - 1;
Printf("tag length: %x\n",taglen);
if(type==8) //audio
{
UINT fmt : 4;
UINT sr : 2;
UINT bits : 1;
UINT channels : 1;
if(fmt==10)
{
--taglen;
UBYTE frmtype;
}
}
else if(type==9)//video
{
UINT frmtype : 4;
UINT codecid : 4;
if(codecid==7)
{
taglen -= 4;
UINT pkttype : 8;
UINT compotime : 24;
}
}
else if(type==18)//script
{
UINT fristbyte : 8;
}
UBYTE data[taglen];
UINT lastsize; //last tag size
//for debugging
//Printf("lastsize: %x\n",lastsize);
//Printf("Pos: %x\n",FTell());
} Tag;
BigEndian();
SetBackColor( cLtGray );
HEADER hdr;
// Check for header
if( hdr.signature != "FLV" )
{
Warning( "File is not a FLV. Template stopped." );
return -1;
}
if( hdr.version != 1 )
{
Warning( "Unsupported FLV version. Template stopped." );
return -1;
}
// Define the bytes of the data
SetBackColor( cNone );
while( !FEof() )
{
Tag tag;
}