Mercurial > mplayer.hg
annotate asf.h @ 1972:78924572fddf
help updated
author | arpi |
---|---|
date | Wed, 26 Sep 2001 18:51:55 +0000 |
parents | b895f95e7657 |
children |
rev | line source |
---|---|
1000 | 1 #ifndef __ASF_H |
2 #define __ASF_H | |
833 | 3 |
1342 | 4 #include "config.h" /* for WORDS_BIGENDIAN */ |
833 | 5 #include <inttypes.h> |
1342 | 6 #include "bswap.h" |
7 #ifdef STREAMING | |
1000 | 8 #include "network.h" |
1342 | 9 #endif |
904 | 10 |
871 | 11 #ifndef MIN |
12 #define MIN(a,b) ((a<b)?a:b) | |
13 #endif | |
14 | |
833 | 15 /////////////////////// |
16 // MS GUID definition | |
17 /////////////////////// | |
18 #ifndef GUID_DEFINED | |
19 #define GUID_DEFINED | |
20 // Size of GUID is 16 bytes! | |
21 typedef struct __attribute__((packed)) { | |
22 uint32_t Data1; // 4 bytes | |
23 uint16_t Data2; // 2 bytes | |
24 uint16_t Data3; // 2 bytes | |
25 uint8_t Data4[8]; // 8 bytes | |
26 } GUID_t; | |
27 #endif | |
28 | |
29 /////////////////////// | |
30 // ASF Object Header | |
31 /////////////////////// | |
32 typedef struct __attribute__((packed)) { | |
33 uint8_t guid[16]; | |
34 uint64_t size; | |
35 } ASF_obj_header_t; | |
36 | |
37 //////////////// | |
38 // ASF Header | |
39 //////////////// | |
40 typedef struct __attribute__((packed)) { | |
41 ASF_obj_header_t objh; | |
42 uint32_t cno; // number of subchunks | |
43 uint8_t v1; // unknown (0x01) | |
44 uint8_t v2; // unknown (0x02) | |
45 } ASF_header_t; | |
46 | |
47 ///////////////////// | |
48 // ASF File Header | |
49 ///////////////////// | |
50 typedef struct __attribute__((packed)) { | |
51 uint8_t client[16]; // Client GUID | |
52 uint64_t file_size; | |
53 uint64_t creat_time; //File creation time FILETIME 8 | |
54 uint64_t packets; //Number of packets UINT64 8 | |
55 uint64_t end_timestamp; //Timestamp of the end position UINT64 8 | |
56 uint64_t duration; //Duration of the playback UINT64 8 | |
57 uint32_t start_timestamp; //Timestamp of the start position UINT32 4 | |
58 uint32_t unk1; //Unknown, maybe reserved ( usually contains 0 ) UINT32 4 | |
59 uint32_t flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4 | |
60 uint32_t packetsize; //Size of packet, in bytes UINT32 4 | |
61 uint32_t packetsize2; //Size of packet ( confirm ) UINT32 4 | |
62 uint32_t frame_size; //Size of uncompressed video frame UINT32 4 | |
63 } ASF_file_header_t; | |
64 | |
65 /////////////////////// | |
66 // ASF Stream Header | |
67 /////////////////////// | |
68 typedef struct __attribute__((packed)) { | |
69 uint8_t type[16]; // Stream type (audio/video) GUID 16 | |
70 uint8_t concealment[16]; // Audio error concealment type GUID 16 | |
71 uint64_t unk1; // Unknown, maybe reserved ( usually contains 0 ) UINT64 8 | |
72 uint32_t type_size; //Total size of type-specific data UINT32 4 | |
73 uint32_t stream_size; //Size of stream-specific data UINT32 4 | |
74 uint16_t stream_no; //Stream number UINT16 2 | |
75 uint32_t unk2; //Unknown UINT32 4 | |
76 } ASF_stream_header_t; | |
77 | |
78 /////////////////////////// | |
79 // ASF Content Description | |
80 /////////////////////////// | |
81 typedef struct __attribute__((packed)) { | |
82 uint16_t title_size; | |
83 uint16_t author_size; | |
84 uint16_t copyright_size; | |
85 uint16_t comment_size; | |
86 uint16_t rating_size; | |
87 } ASF_content_description_t; | |
88 | |
89 //////////////////////// | |
90 // ASF Segment Header | |
91 //////////////////////// | |
92 typedef struct __attribute__((packed)) { | |
93 uint8_t streamno; | |
94 uint8_t seq; | |
95 uint32_t x; | |
96 uint8_t flag; | |
97 } ASF_segmhdr_t; | |
98 | |
99 ////////////////////// | |
100 // ASF Stream Chunck | |
101 ////////////////////// | |
102 typedef struct __attribute__((packed)) { | |
103 uint16_t type; | |
871 | 104 uint16_t size; |
833 | 105 uint32_t sequence_number; |
106 uint16_t unknown; | |
871 | 107 uint16_t size_confirm; |
833 | 108 } ASF_stream_chunck_t; |
109 | |
110 | |
111 // Definition of the differents type of ASF streaming | |
112 typedef enum { | |
113 ASF_Unknown_e, | |
114 ASF_Live_e, | |
115 ASF_Prerecorded_e, | |
116 ASF_Redirector_e | |
117 } ASF_StreamType_e; | |
118 | |
904 | 119 |
1342 | 120 /* |
121 * Some macros to swap little endian structures read from an ASF file | |
122 * into machine endian format | |
123 */ | |
124 #ifdef WORDS_BIGENDIAN | |
125 #define le2me_ASF_obj_header_t(h) { \ | |
126 (h)->size = le2me_64((h)->size); \ | |
127 } | |
128 #define le2me_ASF_header_t(h) { \ | |
129 le2me_ASF_obj_header_t(&(h)->objh); \ | |
130 (h)->cno = le2me_32((h)->cno); \ | |
131 } | |
132 #define le2me_ASF_stream_header_t(h) { \ | |
133 (h)->unk1 = le2me_64((h)->unk1); \ | |
134 (h)->type_size = le2me_32((h)->type_size); \ | |
135 (h)->stream_size = le2me_32((h)->stream_size); \ | |
136 (h)->stream_no = le2me_16((h)->stream_no); \ | |
137 (h)->unk2 = le2me_32((h)->unk2); \ | |
138 } | |
139 #define le2me_ASF_file_header_t(h) { \ | |
140 (h)->file_size = le2me_64((h)->file_size); \ | |
141 (h)->creat_time = le2me_64((h)->creat_time); \ | |
142 (h)->packets = le2me_64((h)->packets); \ | |
143 (h)->end_timestamp = le2me_64((h)->end_timestamp); \ | |
144 (h)->duration = le2me_64((h)->duration); \ | |
145 (h)->start_timestamp = le2me_32((h)->start_timestamp); \ | |
146 (h)->unk1 = le2me_32((h)->unk1); \ | |
147 (h)->flags = le2me_32((h)->flags); \ | |
148 (h)->packetsize = le2me_32((h)->packetsize); \ | |
149 (h)->packetsize2 = le2me_32((h)->packetsize2); \ | |
150 (h)->frame_size = le2me_32((h)->frame_size); \ | |
151 } | |
152 #define le2me_ASF_content_description_t(h) { \ | |
153 (h)->title_size = le2me_16((h)->title_size); \ | |
154 (h)->author_size = le2me_16((h)->author_size); \ | |
155 (h)->copyright_size = le2me_16((h)->copyright_size); \ | |
156 (h)->comment_size = le2me_16((h)->comment_size); \ | |
157 (h)->rating_size = le2me_16((h)->rating_size); \ | |
158 } | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
159 #define le2me_BITMAPINFOHEADER(h) { \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
160 (h)->biSize = le2me_32((h)->biSize); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
161 (h)->biWidth = le2me_32((h)->biWidth); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
162 (h)->biHeight = le2me_32((h)->biHeight); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
163 (h)->biPlanes = le2me_16((h)->biPlanes); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
164 (h)->biBitCount = le2me_16((h)->biBitCount); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
165 (h)->biCompression = le2me_32((h)->biCompression); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
166 (h)->biSizeImage = le2me_32((h)->biSizeImage); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
167 (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
168 (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
169 (h)->biClrUsed = le2me_32((h)->biClrUsed); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
170 (h)->biClrImportant = le2me_32((h)->biClrImportant); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
171 } |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
172 #define le2me_WAVEFORMATEX(h) { \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
173 (h)->wFormatTag = le2me_16((h)->wFormatTag); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
174 (h)->nChannels = le2me_16((h)->nChannels); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
175 (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
176 (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
177 (h)->nBlockAlign = le2me_16((h)->nBlockAlign); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
178 (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
179 (h)->cbSize = le2me_16((h)->cbSize); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
180 } |
1342 | 181 #else |
182 #define le2me_ASF_obj_header_t(h) /**/ | |
183 #define le2me_ASF_header_t(h) /**/ | |
184 #define le2me_ASF_stream_header_t(h) /**/ | |
185 #define le2me_ASF_file_header_t(h) /**/ | |
186 #define le2me_ASF_content_description_t(h) /**/ | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
187 #define le2me_BITMAPINFOHEADER(h) /**/ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
188 #define le2me_WAVEFORMATEX(h) /**/ |
1342 | 189 #endif |
190 | |
191 | |
192 #ifdef STREAMING | |
904 | 193 int asf_http_streaming_type(char *content_type, char *features); |
1000 | 194 int asf_http_streaming_start( streaming_ctrl_t *streaming_ctrl ); |
195 int asf_http_streaming_read( streaming_ctrl_t *streaming_ctrl ); | |
196 | |
197 int asf_streaming(char *data, int length, int *drop_packet ); | |
1342 | 198 #endif |
904 | 199 |
833 | 200 #endif |