833
|
1 #ifndef ASF_H
|
|
2 #define ASF_H
|
|
3
|
|
4 #include <inttypes.h>
|
|
5
|
871
|
6 #ifndef MIN
|
|
7 #define MIN(a,b) ((a<b)?a:b)
|
|
8 #endif
|
|
9
|
833
|
10 ///////////////////////
|
|
11 // MS GUID definition
|
|
12 ///////////////////////
|
|
13 #ifndef GUID_DEFINED
|
|
14 #define GUID_DEFINED
|
|
15 // Size of GUID is 16 bytes!
|
|
16 typedef struct __attribute__((packed)) {
|
|
17 uint32_t Data1; // 4 bytes
|
|
18 uint16_t Data2; // 2 bytes
|
|
19 uint16_t Data3; // 2 bytes
|
|
20 uint8_t Data4[8]; // 8 bytes
|
|
21 } GUID_t;
|
|
22 #endif
|
|
23
|
|
24 ///////////////////////
|
|
25 // ASF Object Header
|
|
26 ///////////////////////
|
|
27 typedef struct __attribute__((packed)) {
|
|
28 uint8_t guid[16];
|
|
29 uint64_t size;
|
|
30 } ASF_obj_header_t;
|
|
31
|
|
32 ////////////////
|
|
33 // ASF Header
|
|
34 ////////////////
|
|
35 typedef struct __attribute__((packed)) {
|
|
36 ASF_obj_header_t objh;
|
|
37 uint32_t cno; // number of subchunks
|
|
38 uint8_t v1; // unknown (0x01)
|
|
39 uint8_t v2; // unknown (0x02)
|
|
40 } ASF_header_t;
|
|
41
|
|
42 /////////////////////
|
|
43 // ASF File Header
|
|
44 /////////////////////
|
|
45 typedef struct __attribute__((packed)) {
|
|
46 uint8_t client[16]; // Client GUID
|
|
47 uint64_t file_size;
|
|
48 uint64_t creat_time; //File creation time FILETIME 8
|
|
49 uint64_t packets; //Number of packets UINT64 8
|
|
50 uint64_t end_timestamp; //Timestamp of the end position UINT64 8
|
|
51 uint64_t duration; //Duration of the playback UINT64 8
|
|
52 uint32_t start_timestamp; //Timestamp of the start position UINT32 4
|
|
53 uint32_t unk1; //Unknown, maybe reserved ( usually contains 0 ) UINT32 4
|
|
54 uint32_t flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4
|
|
55 uint32_t packetsize; //Size of packet, in bytes UINT32 4
|
|
56 uint32_t packetsize2; //Size of packet ( confirm ) UINT32 4
|
|
57 uint32_t frame_size; //Size of uncompressed video frame UINT32 4
|
|
58 } ASF_file_header_t;
|
|
59
|
|
60 ///////////////////////
|
|
61 // ASF Stream Header
|
|
62 ///////////////////////
|
|
63 typedef struct __attribute__((packed)) {
|
|
64 uint8_t type[16]; // Stream type (audio/video) GUID 16
|
|
65 uint8_t concealment[16]; // Audio error concealment type GUID 16
|
|
66 uint64_t unk1; // Unknown, maybe reserved ( usually contains 0 ) UINT64 8
|
|
67 uint32_t type_size; //Total size of type-specific data UINT32 4
|
|
68 uint32_t stream_size; //Size of stream-specific data UINT32 4
|
|
69 uint16_t stream_no; //Stream number UINT16 2
|
|
70 uint32_t unk2; //Unknown UINT32 4
|
|
71 } ASF_stream_header_t;
|
|
72
|
|
73 ///////////////////////////
|
|
74 // ASF Content Description
|
|
75 ///////////////////////////
|
|
76 typedef struct __attribute__((packed)) {
|
|
77 uint16_t title_size;
|
|
78 uint16_t author_size;
|
|
79 uint16_t copyright_size;
|
|
80 uint16_t comment_size;
|
|
81 uint16_t rating_size;
|
|
82 } ASF_content_description_t;
|
|
83
|
|
84 ////////////////////////
|
|
85 // ASF Segment Header
|
|
86 ////////////////////////
|
|
87 typedef struct __attribute__((packed)) {
|
|
88 uint8_t streamno;
|
|
89 uint8_t seq;
|
|
90 uint32_t x;
|
|
91 uint8_t flag;
|
|
92 } ASF_segmhdr_t;
|
|
93
|
|
94 //////////////////////
|
|
95 // ASF Stream Chunck
|
|
96 //////////////////////
|
|
97 typedef struct __attribute__((packed)) {
|
|
98 uint16_t type;
|
871
|
99 uint16_t size;
|
833
|
100 uint32_t sequence_number;
|
|
101 uint16_t unknown;
|
871
|
102 uint16_t size_confirm;
|
833
|
103 } ASF_stream_chunck_t;
|
|
104
|
|
105
|
|
106 // Definition of the differents type of ASF streaming
|
|
107 typedef enum {
|
|
108 ASF_Unknown_e,
|
|
109 ASF_Live_e,
|
|
110 ASF_Prerecorded_e,
|
|
111 ASF_Redirector_e
|
|
112 } ASF_StreamType_e;
|
|
113
|
|
114 #endif
|