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