Mercurial > mplayer.hg
annotate libmpdemux/asf.h @ 4337:f798a7371653
freebsd fix by bjoern fischer
author | atmos4 |
---|---|
date | Thu, 24 Jan 2002 16:52:36 +0000 |
parents | 1c88d75b446c |
children | 8cfce21c6013 |
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" |
904 | 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 ///////////////////// | |
4288
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
47 typedef struct __attribute__((packed)) { |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
48 uint8_t stream_id[16]; // stream GUID |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
49 uint64_t file_size; |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
50 uint64_t creation_time; //File creation time FILETIME 8 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
51 uint64_t num_packets; //Number of packets UINT64 8 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
52 uint64_t play_duration; //Timestamp of the end position UINT64 8 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
53 uint64_t send_duration; //Duration of the playback UINT64 8 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
54 uint64_t preroll; //Time to bufferize before playing UINT32 4 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
55 uint32_t flags; //Unknown, maybe flags ( usually contains 2 ) UINT32 4 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
56 uint32_t min_packet_size; //Min size of the packet, in bytes UINT32 4 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
57 uint32_t max_packet_size; //Max size of the packet UINT32 4 |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
58 uint32_t max_bitrate; //Maximum bitrate of the media (sum of all the stream) |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
59 } ASF_file_header_t; |
833 | 60 |
61 /////////////////////// | |
62 // ASF Stream Header | |
63 /////////////////////// | |
64 typedef struct __attribute__((packed)) { | |
65 uint8_t type[16]; // Stream type (audio/video) GUID 16 | |
66 uint8_t concealment[16]; // Audio error concealment type GUID 16 | |
67 uint64_t unk1; // Unknown, maybe reserved ( usually contains 0 ) UINT64 8 | |
68 uint32_t type_size; //Total size of type-specific data UINT32 4 | |
69 uint32_t stream_size; //Size of stream-specific data UINT32 4 | |
70 uint16_t stream_no; //Stream number UINT16 2 | |
71 uint32_t unk2; //Unknown UINT32 4 | |
72 } ASF_stream_header_t; | |
73 | |
74 /////////////////////////// | |
75 // ASF Content Description | |
76 /////////////////////////// | |
77 typedef struct __attribute__((packed)) { | |
78 uint16_t title_size; | |
79 uint16_t author_size; | |
80 uint16_t copyright_size; | |
81 uint16_t comment_size; | |
82 uint16_t rating_size; | |
83 } ASF_content_description_t; | |
84 | |
85 //////////////////////// | |
86 // ASF Segment Header | |
87 //////////////////////// | |
88 typedef struct __attribute__((packed)) { | |
89 uint8_t streamno; | |
90 uint8_t seq; | |
91 uint32_t x; | |
92 uint8_t flag; | |
93 } ASF_segmhdr_t; | |
94 | |
95 ////////////////////// | |
96 // ASF Stream Chunck | |
97 ////////////////////// | |
98 typedef struct __attribute__((packed)) { | |
99 uint16_t type; | |
871 | 100 uint16_t size; |
833 | 101 uint32_t sequence_number; |
102 uint16_t unknown; | |
871 | 103 uint16_t size_confirm; |
833 | 104 } ASF_stream_chunck_t; |
105 | |
106 | |
107 // Definition of the differents type of ASF streaming | |
108 typedef enum { | |
109 ASF_Unknown_e, | |
110 ASF_Live_e, | |
111 ASF_Prerecorded_e, | |
2489
0ecc1b4f7cf8
Added ASF http server streaming (Not mms streaming).
bertrand
parents:
2310
diff
changeset
|
112 ASF_Redirector_e, |
0ecc1b4f7cf8
Added ASF http server streaming (Not mms streaming).
bertrand
parents:
2310
diff
changeset
|
113 ASF_PlainText_e |
833 | 114 } ASF_StreamType_e; |
115 | |
904 | 116 |
1342 | 117 /* |
118 * Some macros to swap little endian structures read from an ASF file | |
119 * into machine endian format | |
120 */ | |
121 #ifdef WORDS_BIGENDIAN | |
122 #define le2me_ASF_obj_header_t(h) { \ | |
123 (h)->size = le2me_64((h)->size); \ | |
124 } | |
125 #define le2me_ASF_header_t(h) { \ | |
126 le2me_ASF_obj_header_t(&(h)->objh); \ | |
127 (h)->cno = le2me_32((h)->cno); \ | |
128 } | |
129 #define le2me_ASF_stream_header_t(h) { \ | |
130 (h)->unk1 = le2me_64((h)->unk1); \ | |
131 (h)->type_size = le2me_32((h)->type_size); \ | |
132 (h)->stream_size = le2me_32((h)->stream_size); \ | |
133 (h)->stream_no = le2me_16((h)->stream_no); \ | |
134 (h)->unk2 = le2me_32((h)->unk2); \ | |
135 } | |
4288
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
136 #define le2me_ASF_file_header_t(h) { \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
137 (h)->file_size = le2me_64((h)->file_size); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
138 (h)->creation_time = le2me_64((h)->creation_time); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
139 (h)->num_packets = le2me_64((h)->num_packets); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
140 (h)->play_duration = le2me_64((h)->play_duration); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
141 (h)->send_duration = le2me_64((h)->send_duration); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
142 (h)->preroll = le2me_64((h)->preroll); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
143 (h)->flags = le2me_32((h)->flags); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
144 (h)->min_packet_size = le2me_32((h)->min_packet_size); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
145 (h)->max_packet_size = le2me_32((h)->max_packet_size); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
146 (h)->max_bitrate = le2me_32((h)->max_bitrate); \ |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
147 } |
1342 | 148 #define le2me_ASF_content_description_t(h) { \ |
149 (h)->title_size = le2me_16((h)->title_size); \ | |
150 (h)->author_size = le2me_16((h)->author_size); \ | |
151 (h)->copyright_size = le2me_16((h)->copyright_size); \ | |
152 (h)->comment_size = le2me_16((h)->comment_size); \ | |
153 (h)->rating_size = le2me_16((h)->rating_size); \ | |
154 } | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
155 #define le2me_BITMAPINFOHEADER(h) { \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
156 (h)->biSize = le2me_32((h)->biSize); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
157 (h)->biWidth = le2me_32((h)->biWidth); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
158 (h)->biHeight = le2me_32((h)->biHeight); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
159 (h)->biPlanes = le2me_16((h)->biPlanes); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
160 (h)->biBitCount = le2me_16((h)->biBitCount); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
161 (h)->biCompression = le2me_32((h)->biCompression); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
162 (h)->biSizeImage = le2me_32((h)->biSizeImage); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
163 (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
164 (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
165 (h)->biClrUsed = le2me_32((h)->biClrUsed); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
166 (h)->biClrImportant = le2me_32((h)->biClrImportant); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
167 } |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
168 #define le2me_WAVEFORMATEX(h) { \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
169 (h)->wFormatTag = le2me_16((h)->wFormatTag); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
170 (h)->nChannels = le2me_16((h)->nChannels); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
171 (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
172 (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
173 (h)->nBlockAlign = le2me_16((h)->nBlockAlign); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
174 (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
175 (h)->cbSize = le2me_16((h)->cbSize); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
176 } |
1342 | 177 #else |
178 #define le2me_ASF_obj_header_t(h) /**/ | |
179 #define le2me_ASF_header_t(h) /**/ | |
180 #define le2me_ASF_stream_header_t(h) /**/ | |
181 #define le2me_ASF_file_header_t(h) /**/ | |
182 #define le2me_ASF_content_description_t(h) /**/ | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
183 #define le2me_BITMAPINFOHEADER(h) /**/ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
184 #define le2me_WAVEFORMATEX(h) /**/ |
1342 | 185 #endif |
186 | |
187 #endif |