-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSWFStream.h
89 lines (68 loc) · 1.94 KB
/
SWFStream.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
81
82
83
84
85
86
87
88
89
/*
* SWFStream.h
*
*
* Created by Rintarou on 2010/5/15.
* Copyright 2010 http://rintarou.dyndns.org. All rights reserved.
*
*/
#include "common.h"
#ifndef _SWFSTREAM_H
#define _SWFSTREAM_H
class SWFStream {
public:
SWFStream();
~SWFStream();
//// File Operation
int open(const char *filename);
//// TODO:
//Attach();
//Detach();
//// Debug Functions
void dump(unsigned int numBytes);
void skip(unsigned int numBytes) { _stream_pos += numBytes; }
void seek(unsigned int streamPos) { _stream_pos = streamPos; }
//// Bit Operations
unsigned int getUBits(unsigned int numBits);
signed int getSBits(unsigned int numBits);
void setByteAlignment() { _bitOpFlag = 0; }
//// Integer Operations
unsigned int getUI32();
unsigned int getUI16();
unsigned int getUI8();
signed int getSI16();
signed int getSI32();
//// Fixed Number Operation
float getFIXED8(); // 16-bit 8.8 fixed-point number
float getFIXED(); // 32-bit 16.16 fixed-point number
//// Floating-point Number Operation
float getFLOAT16();
float getFLOAT();
double getDOUBLE();
unsigned int getEncodedU32();
//// String Operation
char* getSTRING();
unsigned int getLANGUAGECODE();
//// Info
int isOpened() { return _streamBuffer ? 1 : 0 ; }
unsigned int getStreamPos() { return _stream_pos; }
unsigned int getFileLength() { return FileLength; }
//// Ugly usage to get the memory pointer FIXME later
//// used by internal zipped data handlers (DefinebitsLosses Tag Handler)
unsigned char *getStreamPosPtr() { return _streamBuffer + _stream_pos; }
//protected:
//// File Info
char Signature[4];
unsigned int SWFVersion;
unsigned int FileLength;
private:
//// Bit Buffer Handlers
unsigned int _bitBufferLen;
unsigned char _bitBuffer;
int _bitOpFlag;
//// Stream Handlers
unsigned char *_streamBuffer;
unsigned int _stream_pos;
unsigned int _stream_size;
};
#endif