annotate asf.h @ 1432:62b9f4b52b4f

*** empty log message ***
author gabucino
date Wed, 01 Aug 2001 20:12:18 +0000
parents baf646413408
children b895f95e7657
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1000
40b11384693b Modified functions prototype.
bertrand
parents: 904
diff changeset
1 #ifndef __ASF_H
40b11384693b Modified functions prototype.
bertrand
parents: 904
diff changeset
2 #define __ASF_H
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
3
1342
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
4 #include "config.h" /* for WORDS_BIGENDIAN */
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
5 #include <inttypes.h>
1342
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
6 #include "bswap.h"
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
7 #ifdef STREAMING
1000
40b11384693b Modified functions prototype.
bertrand
parents: 904
diff changeset
8 #include "network.h"
1342
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
9 #endif
904
11879db9d4cc Added some functions prototypes.
bertrand
parents: 871
diff changeset
10
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
11 #ifndef MIN
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
12 #define MIN(a,b) ((a<b)?a:b)
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
13 #endif
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
14
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
15 ///////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
16 // MS GUID definition
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
17 ///////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
18 #ifndef GUID_DEFINED
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
19 #define GUID_DEFINED
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
20 // Size of GUID is 16 bytes!
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
21 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
22 uint32_t Data1; // 4 bytes
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
23 uint16_t Data2; // 2 bytes
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
24 uint16_t Data3; // 2 bytes
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
25 uint8_t Data4[8]; // 8 bytes
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
26 } GUID_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
27 #endif
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
28
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
29 ///////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
30 // ASF Object Header
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
31 ///////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
32 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
33 uint8_t guid[16];
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
34 uint64_t size;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
35 } ASF_obj_header_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
36
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
37 ////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
38 // ASF Header
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
39 ////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
40 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
41 ASF_obj_header_t objh;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
42 uint32_t cno; // number of subchunks
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
43 uint8_t v1; // unknown (0x01)
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
44 uint8_t v2; // unknown (0x02)
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
45 } ASF_header_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
46
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
47 /////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
48 // ASF File Header
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
49 /////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
50 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
51 uint8_t client[16]; // Client GUID
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
52 uint64_t file_size;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
53 uint64_t creat_time; //File creation time FILETIME 8
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
54 uint64_t packets; //Number of packets UINT64 8
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
55 uint64_t end_timestamp; //Timestamp of the end position UINT64 8
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
56 uint64_t duration; //Duration of the playback UINT64 8
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
57 uint32_t start_timestamp; //Timestamp of the start position UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
58 uint32_t unk1; //Unknown, maybe reserved ( usually contains 0 ) UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
59 uint32_t flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
60 uint32_t packetsize; //Size of packet, in bytes UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
61 uint32_t packetsize2; //Size of packet ( confirm ) UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
62 uint32_t frame_size; //Size of uncompressed video frame UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
63 } ASF_file_header_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
64
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
65 ///////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
66 // ASF Stream Header
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
67 ///////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
68 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
69 uint8_t type[16]; // Stream type (audio/video) GUID 16
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
70 uint8_t concealment[16]; // Audio error concealment type GUID 16
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
71 uint64_t unk1; // Unknown, maybe reserved ( usually contains 0 ) UINT64 8
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
72 uint32_t type_size; //Total size of type-specific data UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
73 uint32_t stream_size; //Size of stream-specific data UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
74 uint16_t stream_no; //Stream number UINT16 2
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
75 uint32_t unk2; //Unknown UINT32 4
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
76 } ASF_stream_header_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
77
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
78 ///////////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
79 // ASF Content Description
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
80 ///////////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
81 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
82 uint16_t title_size;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
83 uint16_t author_size;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
84 uint16_t copyright_size;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
85 uint16_t comment_size;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
86 uint16_t rating_size;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
87 } ASF_content_description_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
88
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
89 ////////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
90 // ASF Segment Header
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
91 ////////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
92 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
93 uint8_t streamno;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
94 uint8_t seq;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
95 uint32_t x;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
96 uint8_t flag;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
97 } ASF_segmhdr_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
98
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
99 //////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
100 // ASF Stream Chunck
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
101 //////////////////////
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
102 typedef struct __attribute__((packed)) {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
103 uint16_t type;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
104 uint16_t size;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
105 uint32_t sequence_number;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
106 uint16_t unknown;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
107 uint16_t size_confirm;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
108 } ASF_stream_chunck_t;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
109
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
110
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
111 // Definition of the differents type of ASF streaming
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
112 typedef enum {
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
113 ASF_Unknown_e,
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
114 ASF_Live_e,
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
115 ASF_Prerecorded_e,
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
116 ASF_Redirector_e
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
117 } ASF_StreamType_e;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
118
904
11879db9d4cc Added some functions prototypes.
bertrand
parents: 871
diff changeset
119
1342
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
120 /*
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
121 * Some macros to swap little endian structures read from an ASF file
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
122 * into machine endian format
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
123 */
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
124 #ifdef WORDS_BIGENDIAN
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
125 #define le2me_ASF_obj_header_t(h) { \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
126 (h)->size = le2me_64((h)->size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
127 }
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
128 #define le2me_ASF_header_t(h) { \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
129 le2me_ASF_obj_header_t(&(h)->objh); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
130 (h)->cno = le2me_32((h)->cno); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
131 }
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
132 #define le2me_ASF_stream_header_t(h) { \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
133 (h)->unk1 = le2me_64((h)->unk1); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
134 (h)->type_size = le2me_32((h)->type_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
135 (h)->stream_size = le2me_32((h)->stream_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
136 (h)->stream_no = le2me_16((h)->stream_no); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
137 (h)->unk2 = le2me_32((h)->unk2); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
138 }
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
139 #define le2me_ASF_file_header_t(h) { \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
140 (h)->file_size = le2me_64((h)->file_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
141 (h)->creat_time = le2me_64((h)->creat_time); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
142 (h)->packets = le2me_64((h)->packets); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
143 (h)->end_timestamp = le2me_64((h)->end_timestamp); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
144 (h)->duration = le2me_64((h)->duration); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
145 (h)->start_timestamp = le2me_32((h)->start_timestamp); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
146 (h)->unk1 = le2me_32((h)->unk1); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
147 (h)->flags = le2me_32((h)->flags); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
148 (h)->packetsize = le2me_32((h)->packetsize); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
149 (h)->packetsize2 = le2me_32((h)->packetsize2); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
150 (h)->frame_size = le2me_32((h)->frame_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
151 }
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
152 #define le2me_ASF_content_description_t(h) { \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
153 (h)->title_size = le2me_16((h)->title_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
154 (h)->author_size = le2me_16((h)->author_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
155 (h)->copyright_size = le2me_16((h)->copyright_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
156 (h)->comment_size = le2me_16((h)->comment_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
157 (h)->rating_size = le2me_16((h)->rating_size); \
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
158 }
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
159 #else
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
160 #define le2me_ASF_obj_header_t(h) /**/
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
161 #define le2me_ASF_header_t(h) /**/
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
162 #define le2me_ASF_stream_header_t(h) /**/
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
163 #define le2me_ASF_file_header_t(h) /**/
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
164 #define le2me_ASF_content_description_t(h) /**/
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
165 #endif
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
166
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
167
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
168 #ifdef STREAMING
904
11879db9d4cc Added some functions prototypes.
bertrand
parents: 871
diff changeset
169 int asf_http_streaming_type(char *content_type, char *features);
1000
40b11384693b Modified functions prototype.
bertrand
parents: 904
diff changeset
170 int asf_http_streaming_start( streaming_ctrl_t *streaming_ctrl );
40b11384693b Modified functions prototype.
bertrand
parents: 904
diff changeset
171 int asf_http_streaming_read( streaming_ctrl_t *streaming_ctrl );
40b11384693b Modified functions prototype.
bertrand
parents: 904
diff changeset
172
40b11384693b Modified functions prototype.
bertrand
parents: 904
diff changeset
173 int asf_streaming(char *data, int length, int *drop_packet );
1342
baf646413408 ASF support for non-x86 cpus
jkeil
parents: 1000
diff changeset
174 #endif
904
11879db9d4cc Added some functions prototypes.
bertrand
parents: 871
diff changeset
175
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
176 #endif