Mercurial > mplayer.hg
annotate libmpdemux/asf.h @ 22865:441582f3ed87
simplified function prototypes to avoid casts but keep external API compatibility
author | ben |
---|---|
date | Sun, 01 Apr 2007 12:39:06 +0000 |
parents | dc9d2940fc05 |
children | cc01eab9f3a9 |
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> |
21372 | 6 #include "libavutil/common.h" |
21507
fa99b3d31d13
Hack around libavutil/bswap.h compilation problems due to always_inline undefined.
reimar
parents:
21372
diff
changeset
|
7 #include "mpbswap.h" |
904 | 8 |
833 | 9 /////////////////////// |
10 // MS GUID definition | |
11 /////////////////////// | |
12 #ifndef GUID_DEFINED | |
13 #define GUID_DEFINED | |
14 // Size of GUID is 16 bytes! | |
15 typedef struct __attribute__((packed)) { | |
16 uint32_t Data1; // 4 bytes | |
17 uint16_t Data2; // 2 bytes | |
18 uint16_t Data3; // 2 bytes | |
19 uint8_t Data4[8]; // 8 bytes | |
20 } GUID_t; | |
21 #endif | |
22 | |
23 /////////////////////// | |
24 // ASF Object Header | |
25 /////////////////////// | |
26 typedef struct __attribute__((packed)) { | |
27 uint8_t guid[16]; | |
28 uint64_t size; | |
29 } ASF_obj_header_t; | |
30 | |
31 //////////////// | |
32 // ASF Header | |
33 //////////////// | |
34 typedef struct __attribute__((packed)) { | |
35 ASF_obj_header_t objh; | |
36 uint32_t cno; // number of subchunks | |
37 uint8_t v1; // unknown (0x01) | |
38 uint8_t v2; // unknown (0x02) | |
39 } ASF_header_t; | |
40 | |
41 ///////////////////// | |
42 // ASF File Header | |
43 ///////////////////// | |
4288
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
44 typedef struct __attribute__((packed)) { |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
45 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
|
46 uint64_t file_size; |
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 } ASF_file_header_t; |
833 | 57 |
58 /////////////////////// | |
59 // ASF Stream Header | |
60 /////////////////////// | |
61 typedef struct __attribute__((packed)) { | |
62 uint8_t type[16]; // Stream type (audio/video) GUID 16 | |
63 uint8_t concealment[16]; // Audio error concealment type GUID 16 | |
64 uint64_t unk1; // Unknown, maybe reserved ( usually contains 0 ) UINT64 8 | |
65 uint32_t type_size; //Total size of type-specific data UINT32 4 | |
66 uint32_t stream_size; //Size of stream-specific data UINT32 4 | |
67 uint16_t stream_no; //Stream number UINT16 2 | |
68 uint32_t unk2; //Unknown UINT32 4 | |
69 } ASF_stream_header_t; | |
70 | |
71 /////////////////////////// | |
72 // ASF Content Description | |
73 /////////////////////////// | |
74 typedef struct __attribute__((packed)) { | |
75 uint16_t title_size; | |
76 uint16_t author_size; | |
77 uint16_t copyright_size; | |
78 uint16_t comment_size; | |
79 uint16_t rating_size; | |
80 } ASF_content_description_t; | |
81 | |
82 //////////////////////// | |
83 // ASF Segment Header | |
84 //////////////////////// | |
85 typedef struct __attribute__((packed)) { | |
86 uint8_t streamno; | |
87 uint8_t seq; | |
88 uint32_t x; | |
89 uint8_t flag; | |
90 } ASF_segmhdr_t; | |
91 | |
92 ////////////////////// | |
93 // ASF Stream Chunck | |
94 ////////////////////// | |
95 typedef struct __attribute__((packed)) { | |
96 uint16_t type; | |
871 | 97 uint16_t size; |
833 | 98 uint32_t sequence_number; |
99 uint16_t unknown; | |
871 | 100 uint16_t size_confirm; |
833 | 101 } ASF_stream_chunck_t; |
102 | |
5616
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
103 // Definition of the stream type |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
104 #ifdef WORDS_BIGENDIAN |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
105 #define ASF_STREAMING_CLEAR 0x2443 // $C |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
106 #define ASF_STREAMING_DATA 0x2444 // $D |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
107 #define ASF_STREAMING_END_TRANS 0x2445 // $E |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
108 #define ASF_STREAMING_HEADER 0x2448 // $H |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
109 #else |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
110 #define ASF_STREAMING_CLEAR 0x4324 // $C |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
111 #define ASF_STREAMING_DATA 0x4424 // $D |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
112 #define ASF_STREAMING_END_TRANS 0x4524 // $E |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
113 #define ASF_STREAMING_HEADER 0x4824 // $H |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
114 #endif |
833 | 115 |
116 // Definition of the differents type of ASF streaming | |
117 typedef enum { | |
118 ASF_Unknown_e, | |
119 ASF_Live_e, | |
120 ASF_Prerecorded_e, | |
2489
0ecc1b4f7cf8
Added ASF http server streaming (Not mms streaming).
bertrand
parents:
2310
diff
changeset
|
121 ASF_Redirector_e, |
6676 | 122 ASF_PlainText_e, |
123 ASF_Authenticate_e | |
833 | 124 } ASF_StreamType_e; |
125 | |
6644
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
126 typedef struct { |
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
127 ASF_StreamType_e streaming_type; |
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
128 int request; |
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
129 int packet_size; |
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
130 int *audio_streams,n_audio,*video_streams,n_video; |
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
131 int audio_id, video_id; |
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
132 } asf_http_streaming_ctrl_t; |
f3153f8d4fbe
Moved the asf_http_streaming_ctrl_t struct from asf_streaming.c
bertrand
parents:
5616
diff
changeset
|
133 |
904 | 134 |
1342 | 135 /* |
136 * Some macros to swap little endian structures read from an ASF file | |
137 * into machine endian format | |
138 */ | |
139 #ifdef WORDS_BIGENDIAN | |
140 #define le2me_ASF_obj_header_t(h) { \ | |
141 (h)->size = le2me_64((h)->size); \ | |
142 } | |
143 #define le2me_ASF_header_t(h) { \ | |
144 le2me_ASF_obj_header_t(&(h)->objh); \ | |
145 (h)->cno = le2me_32((h)->cno); \ | |
146 } | |
147 #define le2me_ASF_stream_header_t(h) { \ | |
148 (h)->unk1 = le2me_64((h)->unk1); \ | |
149 (h)->type_size = le2me_32((h)->type_size); \ | |
150 (h)->stream_size = le2me_32((h)->stream_size); \ | |
151 (h)->stream_no = le2me_16((h)->stream_no); \ | |
152 (h)->unk2 = le2me_32((h)->unk2); \ | |
153 } | |
4288
b84e9861461c
Changed the asf_file_header_t struct to read all the fields properly.
bertrand
parents:
3719
diff
changeset
|
154 #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
|
155 (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
|
156 (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
|
157 (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
|
158 (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
|
159 (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
|
160 (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
|
161 (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
|
162 (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
|
163 (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
|
164 (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
|
165 } |
1342 | 166 #define le2me_ASF_content_description_t(h) { \ |
167 (h)->title_size = le2me_16((h)->title_size); \ | |
168 (h)->author_size = le2me_16((h)->author_size); \ | |
169 (h)->copyright_size = le2me_16((h)->copyright_size); \ | |
170 (h)->comment_size = le2me_16((h)->comment_size); \ | |
171 (h)->rating_size = le2me_16((h)->rating_size); \ | |
172 } | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
173 #define le2me_BITMAPINFOHEADER(h) { \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
174 (h)->biSize = le2me_32((h)->biSize); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
175 (h)->biWidth = le2me_32((h)->biWidth); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
176 (h)->biHeight = le2me_32((h)->biHeight); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
177 (h)->biPlanes = le2me_16((h)->biPlanes); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
178 (h)->biBitCount = le2me_16((h)->biBitCount); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
179 (h)->biCompression = le2me_32((h)->biCompression); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
180 (h)->biSizeImage = le2me_32((h)->biSizeImage); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
181 (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
182 (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
183 (h)->biClrUsed = le2me_32((h)->biClrUsed); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
184 (h)->biClrImportant = le2me_32((h)->biClrImportant); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
185 } |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
186 #define le2me_WAVEFORMATEX(h) { \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
187 (h)->wFormatTag = le2me_16((h)->wFormatTag); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
188 (h)->nChannels = le2me_16((h)->nChannels); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
189 (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
190 (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
191 (h)->nBlockAlign = le2me_16((h)->nBlockAlign); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
192 (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
193 (h)->cbSize = le2me_16((h)->cbSize); \ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
194 } |
5616
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
195 #define le2me_ASF_stream_chunck_t(h) { \ |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
196 (h)->size = le2me_16((h)->size); \ |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
197 (h)->sequence_number = le2me_32((h)->sequence_number); \ |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
198 (h)->unknown = le2me_16((h)->unknown); \ |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
199 (h)->size_confirm = le2me_16((h)->size_confirm); \ |
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
200 } |
1342 | 201 #else |
202 #define le2me_ASF_obj_header_t(h) /**/ | |
203 #define le2me_ASF_header_t(h) /**/ | |
204 #define le2me_ASF_stream_header_t(h) /**/ | |
205 #define le2me_ASF_file_header_t(h) /**/ | |
206 #define le2me_ASF_content_description_t(h) /**/ | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
207 #define le2me_BITMAPINFOHEADER(h) /**/ |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1342
diff
changeset
|
208 #define le2me_WAVEFORMATEX(h) /**/ |
5616
8cfce21c6013
Added big endian macro for asf_chunk_t and added defines for the ASF chunk type.
bertrand
parents:
4310
diff
changeset
|
209 #define le2me_ASF_stream_chunck_t(h) /**/ |
1342 | 210 #endif |
211 | |
17992
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
212 // priv struct for the demuxer |
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
213 struct asf_priv { |
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
214 ASF_header_t header; |
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
215 unsigned char* packet; |
18001 | 216 int scrambling_h; |
217 int scrambling_w; | |
218 int scrambling_b; | |
17992
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
219 unsigned packetsize; |
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
220 double packetrate; |
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
221 unsigned movielength; |
19961
9f011e6892e8
interpolate real fps of dvr-ms files using the extended stream properties.
nicodvb
parents:
18609
diff
changeset
|
222 double avg_vid_frame_time; |
18609
bb7042d74855
Patch from John Donaghy: "fix for audio and video in dvr-ms asf files"
pacman
parents:
18001
diff
changeset
|
223 int asf_is_dvr_ms; |
bb7042d74855
Patch from John Donaghy: "fix for audio and video in dvr-ms asf files"
pacman
parents:
18001
diff
changeset
|
224 uint32_t asf_frame_state; |
bb7042d74855
Patch from John Donaghy: "fix for audio and video in dvr-ms asf files"
pacman
parents:
18001
diff
changeset
|
225 int asf_frame_start_found; |
19961
9f011e6892e8
interpolate real fps of dvr-ms files using the extended stream properties.
nicodvb
parents:
18609
diff
changeset
|
226 double dvr_last_vid_pts; |
17992
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
227 }; |
2545bbd91450
Move global vars used for header parsing, etc to dewux->priv as it should
albeu
parents:
8957
diff
changeset
|
228 |
1342 | 229 #endif |