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