1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
5 * $Id: libasf.h,v 1.1 2002/10/20 17:22:33 fenrir Exp $
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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 /*****************************************************************************
24 * Structure needed for decoder
25 *****************************************************************************/
26 typedef struct bitmapinfoheader_s
28 u32 i_size; /* size of header 40 + size of data follwoing this header */
41 typedef struct waveformatex_s
49 u16 i_size; /* This give size of data
50 imediatly following this header. */
61 #define ASF_OBJECT_TYPE_NULL 0x0000
62 #define ASF_OBJECT_TYPE_ROOT 0x0001
63 #define ASF_OBJECT_TYPE_HEADER 0x0002
64 #define ASF_OBJECT_TYPE_DATA 0x0003
65 #define ASF_OBJECT_TYPE_INDEX 0x0004
66 #define ASF_OBJECT_TYPE_FILE_PROPERTIES 0x0005
67 #define ASF_OBJECT_TYPE_STREAM_PROPERTIES 0x0006
68 #define ASF_OBJECT_TYPE_EXTENTION_HEADER 0x0007
69 #define ASF_OBJECT_TYPE_CODEC_LIST 0x0008
70 #define ASF_OBJECT_TYPE_MARKER 0x0009
71 #define ASF_OBJECT_TYPE_CONTENT_DESCRIPTION 0x000a
73 static const guid_t asf_object_null_guid =
78 { 0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00 }
81 static const guid_t asf_object_header_guid =
86 { 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C }
89 static const guid_t asf_object_data_guid =
94 { 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C }
99 static const guid_t asf_object_index_guid =
104 { 0x89,0xF4, 0x00,0xA0,0xC9,0x03,0x49,0xCB }
107 static const guid_t asf_object_file_properties_guid =
112 { 0x8e,0xe4, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
115 static const guid_t asf_object_stream_properties_guid =
120 { 0x8E,0xE6, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
124 static const guid_t asf_object_content_description_guid =
129 { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }
132 static const guid_t asf_object_header_extention_guid =
137 { 0x8E,0xE3, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
140 static const guid_t asf_object_codec_list_guid =
145 { 0xA3,0xA4, 0x00,0xA0,0xC9,0x03,0x48,0xF6 }
148 static const guid_t asf_object_marker_guid =
153 { 0x8E,0xE6, 0x00,0xC0,0x0C,0x20,0x53,0x65 }
157 static const guid_t asf_object_stream_type_audio =
162 { 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B }
165 static const guid_t asf_object_stream_type_video =
170 { 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B }
173 static const guid_t asf_object_stream_type_command =
178 { 0xA3,0xAC, 0x00,0xA0,0xC9,0x03,0x48,0xF6 }
182 static const guid_t asf_object_
189 typedef struct asf_packet_s
199 #define ASF_OBJECT_COMMON \
201 guid_t i_object_id; \
204 union asf_object_u *p_father; \
205 union asf_object_u *p_first; \
206 union asf_object_u *p_last; \
207 union asf_object_u *p_next;
209 typedef struct asf_object_common_s
213 } asf_object_common_t;
215 typedef struct asf_index_entry_s
222 /****************************************************************************
223 * High level asf object
224 ****************************************************************************/
225 /* This is the first header find in a asf file
226 * It's the only object that have subobject */
227 typedef struct asf_object_header_s
230 u32 i_sub_object_count;
231 u8 i_reserved1; /* 0x01, but could be safely ignored */
232 u8 i_reserved2; /* 0x02, if not must failed to source the contain */
234 } asf_object_header_t;
236 typedef struct asf_object_data_s
240 u64 i_total_data_packets;
246 typedef struct asf_object_index_s
250 u64 i_index_entry_time_interval;
251 u32 i_max_packet_count;
252 u32 i_index_entry_count;
254 asf_index_entry_t *index_entry;
256 } asf_object_index_t;
258 typedef struct asf_object_root_s
262 asf_object_header_t *p_hdr;
263 asf_object_data_t *p_data;
264 asf_object_index_t *p_index;
268 /****************************************************************************
269 * Sub level asf object
270 ****************************************************************************/
271 #define ASF_FILE_PROPERTIES_BROADCAST 0x01
272 #define ASF_FILE_PROPERTIES_SEEKABLE 0x02
274 typedef struct asf_object_file_properties_s
281 u64 i_data_packets_count;
286 u32 i_min_data_packet_size;
287 u32 i_max_data_packet_size;
290 } asf_object_file_properties_t;
292 #define ASF_STREAM_PROPERTIES_ENCRYPTED 0x8000
293 typedef struct asf_object_stream_properties_s
297 guid_t i_stream_type;
298 guid_t i_error_correction_type;
300 u32 i_type_specific_data_length;
301 u32 i_error_correction_data_length;
303 /* extrated from flags */
306 u8 *p_type_specific_data;
307 u8 *p_error_correction_data;
308 } asf_object_stream_properties_t;
310 typedef struct asf_object_header_extention_s
316 u32 i_header_extention_size;
317 u8 *p_header_extention_data;
319 } asf_object_header_extention_t;
321 typedef struct asf_objec_content_description_s
328 char *psz_description;
331 } asf_object_content_description_t;
333 typedef struct string16_s
339 #define ASF_CODEC_TYPE_VIDEO 0x0001
340 #define ASF_CODEC_TYPE_AUDIO 0x0002
341 #define ASF_CODEC_TYPE_UNKNOW 0xffff
343 typedef struct asf_codec_entry_s
347 char *psz_description;
349 u16 i_information_length;
353 typedef struct asf_object_codec_list_s
357 u32 i_codec_entries_count;
358 asf_codec_entry_t *codec;
360 } asf_object_codec_list_t;
363 typedef struct asf_object_script_command_s
368 } asf_object_script_command_t;
370 typedef struct asf_marker_s
373 u64 i_presentation_time;
377 u32 i_marker_description_length;
378 u8 *i_marker_description;
383 typedef struct asf_object_marker_s
390 asf_marker_t *marker;
392 } asf_object_marker_t;
395 typedef struct asf_object__s
402 typedef union asf_object_u
404 asf_object_common_t common;
405 asf_object_header_t header;
406 asf_object_data_t data;
407 asf_object_index_t index;
408 asf_object_root_t root;
409 asf_object_file_properties_t file_properties;
410 asf_object_stream_properties_t stream_properties;
411 asf_object_header_extention_t header_extention;
412 asf_object_codec_list_t codec_list;
413 asf_object_marker_t marker;
418 off_t ASF_TellAbsolute( input_thread_t *p_input );
419 int ASF_SeekAbsolute( input_thread_t *p_input, off_t i_pos);
420 int ASF_ReadData( input_thread_t *p_input, u8 *p_buff, int i_size );
421 int ASF_SkipBytes( input_thread_t *p_input, int i_count );
423 void GetGUID( guid_t *p_guid, u8 *p_data );
424 int CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 );
426 int ASF_ReadObjectCommon( input_thread_t *p_input,
427 asf_object_t *p_obj );
428 int ASF_NextObject( input_thread_t *p_input,
429 asf_object_t *p_obj );
430 int ASF_GotoObject( input_thread_t *p_input,
431 asf_object_t *p_obj );
433 int ASF_ReadObject( input_thread_t *p_input,
435 asf_object_t *p_father );
436 void ASF_FreeObject( input_thread_t *p_input,
437 asf_object_t *p_obj );
438 int ASF_ReadObjectRoot( input_thread_t *p_input,
439 asf_object_root_t *p_root,
441 void ASF_FreeObjectRoot( input_thread_t *p_input,
442 asf_object_root_t *p_root );
444 int ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid );
445 asf_object_t *ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number );