1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright © 2001-2004, 2011 the VideoLAN team
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 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 General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
24 /*****************************************************************************
25 * Structure needed for decoder
26 *****************************************************************************/
28 #include "libasf_guid.h"
30 #define ASF_OBJECT_COMMON \
33 uint64_t i_object_size; \
34 uint64_t i_object_pos; \
35 union asf_object_u *p_father; \
36 union asf_object_u *p_first; \
37 union asf_object_u *p_last; \
38 union asf_object_u *p_next;
44 } asf_object_common_t;
48 uint32_t i_packet_number;
49 uint16_t i_packet_count;
53 /****************************************************************************
54 * High level asf object
55 ****************************************************************************/
56 /* This is the first header found in an asf file
57 * It's the only object that has subobjects */
61 uint32_t i_sub_object_count;
62 uint8_t i_reserved1; /* 0x01, but could be safely ignored */
63 uint8_t i_reserved2; /* 0x02, if not must failed to source the contain */
65 } asf_object_header_t;
71 uint64_t i_total_data_packets;
81 uint64_t i_index_entry_time_interval;
82 uint32_t i_max_packet_count;
83 uint32_t i_index_entry_count;
85 asf_index_entry_t *index_entry;
89 /****************************************************************************
90 * Sub level asf object
91 ****************************************************************************/
92 #define ASF_FILE_PROPERTIES_BROADCAST 0x01
93 #define ASF_FILE_PROPERTIES_SEEKABLE 0x02
100 uint64_t i_file_size;
101 uint64_t i_creation_date;
102 uint64_t i_data_packets_count;
103 uint64_t i_play_duration;
104 uint64_t i_send_duration;
107 uint32_t i_min_data_packet_size;
108 uint32_t i_max_data_packet_size;
109 uint32_t i_max_bitrate;
111 } asf_object_file_properties_t;
113 #define ASF_STREAM_PROPERTIES_ENCRYPTED 0x8000
118 guid_t i_stream_type;
119 guid_t i_error_correction_type;
120 uint64_t i_time_offset;
121 uint32_t i_type_specific_data_length;
122 uint32_t i_error_correction_data_length;
124 /* extrated from flags */
125 uint8_t i_stream_number;
127 uint8_t *p_type_specific_data;
128 uint8_t *p_error_correction_data;
129 } asf_object_stream_properties_t;
136 uint16_t i_reserved2;
137 uint32_t i_header_extension_size;
138 uint8_t *p_header_extension_data;
140 } asf_object_header_extension_t;
143 ASF_METADATA_TYPE_STRING,
144 ASF_METADATA_TYPE_BYTE,
145 ASF_METADATA_TYPE_BOOL,
146 ASF_METADATA_TYPE_DWORD,
147 ASF_METADATA_TYPE_QWORD,
148 ASF_METADATA_TYPE_WORD,
161 } asf_metadata_record_t;
167 uint32_t i_record_entries_count;
168 asf_metadata_record_t *record;
170 } asf_object_metadata_t;
179 char *psz_description;
182 } asf_object_content_description_t;
191 #define ASF_CODEC_TYPE_VIDEO 0x0001
192 #define ASF_CODEC_TYPE_AUDIO 0x0002
193 #define ASF_CODEC_TYPE_UNKNOW 0xffff
199 char *psz_description;
201 uint16_t i_information_length;
202 uint8_t *p_information;
209 uint32_t i_codec_entries_count;
210 asf_codec_entry_t *codec;
212 } asf_object_codec_list_t;
217 uint64_t i_presentation_time;
218 uint16_t i_entry_length;
219 uint32_t i_send_time;
221 uint32_t i_marker_description_length;
222 uint8_t *i_marker_description;
231 uint16_t i_reserved2;
233 asf_marker_t *marker;
235 } asf_object_marker_t;
241 char **ppsz_language;
243 } asf_object_language_list_t;
253 uint32_t i_avg_bitrate;
255 } asf_object_stream_bitrate_properties_t;
261 int64_t i_start_time;
263 int32_t i_data_bitrate;
264 int32_t i_buffer_size;
265 int32_t i_initial_buffer_fullness;
266 int32_t i_alternate_data_bitrate;
267 int32_t i_alternate_buffer_size;
268 int32_t i_alternate_initial_buffer_fullness;
269 int32_t i_maximum_object_size;
272 int16_t i_stream_number;
273 int16_t i_language_index;
274 int64_t i_average_time_per_frame;
276 int i_stream_name_count;
277 int i_payload_extension_system_count;
279 int *pi_stream_name_language;
280 char **ppsz_stream_name;
282 asf_object_stream_properties_t *p_sp;
283 } asf_object_extended_stream_properties_t;
290 int16_t i_stream_number_count;
291 int16_t *pi_stream_number;
293 } asf_object_advanced_mutual_exclusion_t;
299 int i_priority_count;
300 int *pi_priority_flag;
301 int *pi_priority_stream_number;
302 } asf_object_stream_prioritization_t;
311 } asf_object_extended_content_description_t;
313 /****************************************************************************
314 * Special Root Object
315 ****************************************************************************/
320 asf_object_header_t *p_hdr;
321 asf_object_data_t *p_data;
322 /* could be NULL if !b_seekable or not-present */
323 asf_object_index_t *p_index;
325 /* from asf_object_header_t */
326 asf_object_file_properties_t *p_fp;
328 /* from asf_object_header_extension_t */
329 asf_object_metadata_t *p_metadata;
333 /****************************************************************************
334 * asf_object_t: union of all objects.
335 ****************************************************************************/
336 typedef union asf_object_u
338 asf_object_common_t common;
339 asf_object_header_t header;
340 asf_object_data_t data;
341 asf_object_index_t index;
342 asf_object_root_t root;
343 asf_object_file_properties_t file_properties;
344 asf_object_stream_properties_t stream_properties;
345 asf_object_header_extension_t header_extension;
346 asf_object_metadata_t metadata;
347 asf_object_codec_list_t codec_list;
348 asf_object_marker_t marker;
349 asf_object_language_list_t language_list;
350 asf_object_stream_bitrate_properties_t stream_bitrate;
351 asf_object_extended_stream_properties_t ext_stream;
352 asf_object_content_description_t content_description;
353 asf_object_advanced_mutual_exclusion_t advanced_mutual_exclusion;
354 asf_object_stream_prioritization_t stream_prioritization;
355 asf_object_extended_content_description_t extended_content_description;
359 asf_object_root_t *ASF_ReadObjectRoot( stream_t *, int b_seekable );
360 void ASF_FreeObjectRoot( stream_t *, asf_object_root_t *p_root );
362 int ASF_CountObject ( void *p_obj, const guid_t *p_guid );
364 #define ASF_FindObject( a, b, c ) __ASF_FindObject( (asf_object_t*)(a), b, c )
365 void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number );