chromecast: refactor, make place for SPUs
[vlc.git] / modules / demux / asf / libasf.h
blobc483b5f28b1decfe77be8eb4f2cc066e640e823d
1 /*****************************************************************************
2 * libasf.h :
3 *****************************************************************************
4 * Copyright © 2001-2004, 2011 VLC authors and VideoLAN
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22 #ifndef VLC_ASF_LIBASF_H_
23 #define VLC_ASF_LIBASF_H_
25 #define ASF_MAX_STREAMNUMBER 127
26 #define ASF_OBJECT_COMMON_SIZE 24
28 /*****************************************************************************
29 * Structure needed for decoder
30 *****************************************************************************/
32 #include "libasf_guid.h"
34 #define ASF_OBJECT_COMMON \
35 int i_type; \
36 guid_t i_object_id; \
37 uint64_t i_object_size; \
38 uint64_t i_object_pos; \
39 union asf_object_u *p_father; \
40 union asf_object_u *p_first; \
41 union asf_object_u *p_last; \
42 union asf_object_u *p_next;
44 typedef struct
46 ASF_OBJECT_COMMON
48 } asf_object_common_t;
50 typedef struct
52 uint32_t i_packet_number;
53 uint16_t i_packet_count;
55 } asf_index_entry_t;
57 /****************************************************************************
58 * High level asf object
59 ****************************************************************************/
60 /* This is the first header found in an asf file
61 * It's the only object that has subobjects */
62 typedef struct
64 ASF_OBJECT_COMMON
65 uint32_t i_sub_object_count;
66 uint8_t i_reserved1; /* 0x01, but could be safely ignored */
67 uint8_t i_reserved2; /* 0x02, if not must failed to source the contain */
69 } asf_object_header_t;
71 typedef struct
73 ASF_OBJECT_COMMON
74 guid_t i_file_id;
75 uint64_t i_total_data_packets;
76 uint16_t i_reserved;
78 } asf_object_data_t;
81 typedef struct
83 ASF_OBJECT_COMMON
84 guid_t i_file_id;
85 uint64_t i_index_entry_time_interval;
86 uint32_t i_max_packet_count;
87 uint32_t i_index_entry_count;
89 asf_index_entry_t *index_entry;
91 } asf_object_index_t;
93 /****************************************************************************
94 * Sub level asf object
95 ****************************************************************************/
96 #define ASF_FILE_PROPERTIES_BROADCAST 0x01
97 #define ASF_FILE_PROPERTIES_SEEKABLE 0x02
99 typedef struct
101 ASF_OBJECT_COMMON
103 guid_t i_file_id;
104 uint64_t i_file_size;
105 uint64_t i_creation_date;
106 uint64_t i_data_packets_count;
107 uint64_t i_play_duration;
108 uint64_t i_send_duration;
109 uint64_t i_preroll;
110 uint32_t i_flags;
111 uint32_t i_min_data_packet_size;
112 uint32_t i_max_data_packet_size;
113 uint32_t i_max_bitrate;
115 } asf_object_file_properties_t;
117 #define ASF_STREAM_PROPERTIES_ENCRYPTED 0x8000
118 typedef struct
120 ASF_OBJECT_COMMON
122 guid_t i_stream_type;
123 guid_t i_error_correction_type;
124 uint64_t i_time_offset;
125 uint32_t i_type_specific_data_length;
126 uint32_t i_error_correction_data_length;
127 uint16_t i_flags;
128 /* extrated from flags */
129 uint8_t i_stream_number;
130 uint32_t i_reserved;
131 uint8_t *p_type_specific_data;
132 uint8_t *p_error_correction_data;
133 } asf_object_stream_properties_t;
135 typedef struct
137 ASF_OBJECT_COMMON
139 guid_t i_reserved1;
140 uint16_t i_reserved2;
141 uint32_t i_header_extension_size;
142 uint8_t *p_header_extension_data;
144 } asf_object_header_extension_t;
146 enum {
147 ASF_METADATA_TYPE_STRING,
148 ASF_METADATA_TYPE_BYTE,
149 ASF_METADATA_TYPE_BOOL,
150 ASF_METADATA_TYPE_DWORD,
151 ASF_METADATA_TYPE_QWORD,
152 ASF_METADATA_TYPE_WORD,
155 typedef struct
157 uint16_t i_stream;
158 uint16_t i_type;
159 char *psz_name;
161 uint64_t i_val;
162 uint16_t i_data;
163 uint8_t *p_data;
165 } asf_metadata_record_t;
167 typedef struct
169 ASF_OBJECT_COMMON
171 uint32_t i_record_entries_count;
172 asf_metadata_record_t *record;
174 } asf_object_metadata_t;
176 typedef struct
178 ASF_OBJECT_COMMON
180 char *psz_title;
181 char *psz_artist;
182 char *psz_copyright;
183 char *psz_description;
184 char *psz_rating;
186 } asf_object_content_description_t;
188 #define ASF_CODEC_TYPE_VIDEO 0x0001
189 #define ASF_CODEC_TYPE_AUDIO 0x0002
190 #define ASF_CODEC_TYPE_UNKNOWN 0xffff
192 typedef struct asf_codec_entry
194 uint16_t i_type;
195 char *psz_name;
196 char *psz_description;
198 uint16_t i_information_length;
199 uint8_t *p_information;
201 struct asf_codec_entry *p_next;
202 } asf_codec_entry_t;
204 typedef struct
206 ASF_OBJECT_COMMON
207 guid_t i_reserved;
208 asf_codec_entry_t *codecs;
210 } asf_object_codec_list_t;
212 typedef struct
214 uint64_t i_offset;
215 uint64_t i_presentation_time;
216 uint16_t i_entry_length;
217 uint32_t i_send_time;
218 uint32_t i_flags;
219 uint32_t i_marker_description_length;
220 char *p_marker_description;
222 } asf_marker_t;
224 typedef struct
226 ASF_OBJECT_COMMON
227 guid_t i_reserved1;
228 uint32_t i_count;
229 uint16_t i_reserved2;
230 char *name;
231 asf_marker_t *marker;
233 } asf_object_marker_t;
235 typedef struct
237 ASF_OBJECT_COMMON
238 uint16_t i_language;
239 char **ppsz_language;
241 } asf_object_language_list_t;
243 typedef struct
245 ASF_OBJECT_COMMON
247 uint16_t i_bitrate;
248 struct
250 uint8_t i_stream_number;
251 uint32_t i_avg_bitrate;
252 } bitrate[ASF_MAX_STREAMNUMBER + 1];
253 } asf_object_stream_bitrate_properties_t;
256 typedef struct
258 guid_t i_extension_id;
259 uint16_t i_data_size;
260 uint32_t i_info_length;
261 char *pi_info;
262 } asf_payload_extension_system_t;
263 #define ASF_EXTENSION_VIDEOFRAME_NEWFRAME 0x08
264 #define ASF_EXTENSION_VIDEOFRAME_IFRAME 0x01
265 #define ASF_EXTENSION_VIDEOFRAME_TYPE_MASK 0x07
267 typedef struct
269 ASF_OBJECT_COMMON
271 uint64_t i_start_time;
272 uint64_t i_end_time;
273 uint32_t i_data_bitrate;
274 uint32_t i_buffer_size;
275 uint32_t i_initial_buffer_fullness;
276 uint32_t i_alternate_data_bitrate;
277 uint32_t i_alternate_buffer_size;
278 uint32_t i_alternate_initial_buffer_fullness;
279 uint32_t i_maximum_object_size;
281 uint32_t i_flags;
282 uint16_t i_stream_number;
283 uint16_t i_language_index;
284 uint64_t i_average_time_per_frame;
286 uint16_t i_stream_name_count;
288 uint16_t i_payload_extension_system_count;
289 asf_payload_extension_system_t *p_ext;
291 uint16_t *pi_stream_name_language;
292 char **ppsz_stream_name;
294 asf_object_stream_properties_t *p_sp;
295 } asf_object_extended_stream_properties_t;
297 #define ASF_MAX_EXCLUSION_TYPE 2
298 typedef enum
300 LANGUAGE = ASF_MAX_EXCLUSION_TYPE,
301 BITRATE = 1,
302 UNKNOWN = 0
303 } asf_exclusion_type_t;
305 typedef struct
307 ASF_OBJECT_COMMON
309 asf_exclusion_type_t exclusion_type;
310 uint16_t i_stream_number_count;
311 uint16_t *pi_stream_number;
313 } asf_object_advanced_mutual_exclusion_t;
315 typedef struct
317 ASF_OBJECT_COMMON
319 uint16_t i_priority_count;
320 uint16_t *pi_priority_flag;
321 uint16_t *pi_priority_stream_number;
322 } asf_object_stream_prioritization_t;
324 typedef struct
326 ASF_OBJECT_COMMON
328 asf_exclusion_type_t exclusion_type;
329 uint16_t i_stream_number_count;
330 uint16_t *pi_stream_numbers;
331 } asf_object_bitrate_mutual_exclusion_t;
333 typedef struct
335 ASF_OBJECT_COMMON
337 uint16_t i_count;
338 char **ppsz_name;
339 char **ppsz_value;
340 } asf_object_extended_content_description_t;
342 /****************************************************************************
343 * Special Root Object
344 ****************************************************************************/
345 typedef struct
347 ASF_OBJECT_COMMON
349 asf_object_header_t *p_hdr;
350 asf_object_data_t *p_data;
351 /* could be NULL if !b_seekable or not-present */
352 asf_object_index_t *p_index;
354 /* from asf_object_header_t */
355 asf_object_file_properties_t *p_fp;
357 /* from asf_object_header_extension_t */
358 asf_object_metadata_t *p_metadata;
360 } asf_object_root_t;
362 /****************************************************************************
363 * asf_object_t: union of all objects.
364 ****************************************************************************/
365 typedef union asf_object_u
367 asf_object_common_t common;
368 asf_object_header_t header;
369 asf_object_data_t data;
370 asf_object_index_t index;
371 asf_object_root_t root;
372 asf_object_file_properties_t file_properties;
373 asf_object_stream_properties_t stream_properties;
374 asf_object_header_extension_t header_extension;
375 asf_object_metadata_t metadata;
376 asf_object_codec_list_t codec_list;
377 asf_object_marker_t marker;
378 asf_object_language_list_t language_list;
379 asf_object_stream_bitrate_properties_t stream_bitrate;
380 asf_object_extended_stream_properties_t ext_stream;
381 asf_object_content_description_t content_description;
382 asf_object_advanced_mutual_exclusion_t advanced_mutual_exclusion;
383 asf_object_stream_prioritization_t stream_prioritization;
384 asf_object_bitrate_mutual_exclusion_t bitrate_mutual_exclusion;
385 asf_object_extended_content_description_t extended_content_description;
387 } asf_object_t;
389 asf_object_root_t *ASF_ReadObjectRoot( stream_t *, int b_seekable );
390 void ASF_FreeObjectRoot( stream_t *, asf_object_root_t *p_root );
392 int ASF_CountObject ( void *p_obj, const guid_t *p_guid );
394 void *ASF_FindObject( void *p_obj, const guid_t *p_guid, int i_number );
395 #endif