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