annotate asf.h @ 1095:c1daff266657

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