1 /*****************************************************************************
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 \
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;
48 } asf_object_common_t
;
52 uint32_t i_packet_number
;
53 uint16_t i_packet_count
;
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 */
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
;
75 uint64_t i_total_data_packets
;
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
;
93 /****************************************************************************
94 * Sub level asf object
95 ****************************************************************************/
96 #define ASF_FILE_PROPERTIES_BROADCAST 0x01
97 #define ASF_FILE_PROPERTIES_SEEKABLE 0x02
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
;
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
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
;
128 /* extrated from flags */
129 uint8_t i_stream_number
;
131 uint8_t *p_type_specific_data
;
132 uint8_t *p_error_correction_data
;
133 } asf_object_stream_properties_t
;
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
;
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
,
165 } asf_metadata_record_t
;
171 uint32_t i_record_entries_count
;
172 asf_metadata_record_t
*record
;
174 } asf_object_metadata_t
;
183 char *psz_description
;
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
196 char *psz_description
;
198 uint16_t i_information_length
;
199 uint8_t *p_information
;
201 struct asf_codec_entry
*p_next
;
208 asf_codec_entry_t
*codecs
;
210 } asf_object_codec_list_t
;
215 uint64_t i_presentation_time
;
216 uint16_t i_entry_length
;
217 uint32_t i_send_time
;
219 uint32_t i_marker_description_length
;
220 char *p_marker_description
;
229 uint16_t i_reserved2
;
231 asf_marker_t
*marker
;
233 } asf_object_marker_t
;
239 char **ppsz_language
;
241 } asf_object_language_list_t
;
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
;
258 guid_t i_extension_id
;
259 uint16_t i_data_size
;
260 uint32_t i_info_length
;
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
271 uint64_t i_start_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
;
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
300 LANGUAGE
= ASF_MAX_EXCLUSION_TYPE
,
303 } asf_exclusion_type_t
;
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
;
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
;
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
;
340 } asf_object_extended_content_description_t
;
342 /****************************************************************************
343 * Special Root Object
344 ****************************************************************************/
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
;
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
;
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
);