1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2001-2003 VideoLAN
5 * $Id: libasf.c,v 1.19 2004/01/25 20:05:28 hartman 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 #include <stdlib.h> /* malloc(), free() */
26 #include <vlc/input.h>
28 #include "codecs.h" /* BITMAPINFOHEADER, WAVEFORMATEX */
34 if( p ) {free( p ); p = NULL; }
36 #define GUID_FMT "0x%x-0x%x-0x%x-0x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x"
37 #define GUID_PRINT( guid ) \
41 (guid).v4[0],(guid).v4[1],(guid).v4[2],(guid).v4[3], \
42 (guid).v4[4],(guid).v4[5],(guid).v4[6],(guid).v4[7]
44 /****************************************************************************
46 ****************************************************************************/
47 static int ASF_ReadObject( stream_t *,
48 asf_object_t *p_obj, asf_object_t *p_father );
51 /****************************************************************************
53 ****************************************************************************/
54 void ASF_GetGUID( guid_t *p_guid, uint8_t *p_data )
56 p_guid->v1 = GetDWLE( p_data );
57 p_guid->v2 = GetWLE( p_data + 4);
58 p_guid->v3 = GetWLE( p_data + 6);
59 memcpy( p_guid->v4, p_data + 8, 8 );
62 int ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 )
64 if( (p_guid1->v1 != p_guid2->v1 )||
65 (p_guid1->v2 != p_guid2->v2 )||
66 (p_guid1->v3 != p_guid2->v3 )||
67 ( memcmp( p_guid1->v4, p_guid2->v4,8 )) )
71 return( 1 ); /* match */
74 /****************************************************************************
76 ****************************************************************************/
77 static int ASF_ReadObjectCommon( stream_t *s, asf_object_t *p_obj )
79 asf_object_common_t *p_common = (asf_object_common_t*)p_obj;
82 if( stream_Peek( s, &p_peek, 24 ) < 24 )
84 return( VLC_EGENERIC );
86 ASF_GetGUID( &p_common->i_object_id, p_peek );
87 p_common->i_object_size = GetQWLE( p_peek + 16 );
88 p_common->i_object_pos = stream_Tell( s );
89 p_common->p_next = NULL;
91 msg_Dbg( (vlc_object_t*)s,
92 "found object guid: " GUID_FMT " size:"I64Fd,
93 GUID_PRINT( p_common->i_object_id ),
94 p_common->i_object_size );
97 return( VLC_SUCCESS );
100 static int ASF_NextObject( stream_t *s, asf_object_t *p_obj )
105 if( ASF_ReadObjectCommon( s, &obj ) )
107 return( VLC_EGENERIC );
112 if( p_obj->common.i_object_size <= 0 )
114 return( VLC_EGENERIC );
116 if( p_obj->common.p_father && p_obj->common.p_father->common.i_object_size != 0 )
118 if( p_obj->common.p_father->common.i_object_pos + p_obj->common.p_father->common.i_object_size <
119 p_obj->common.i_object_pos + p_obj->common.i_object_size + 24 )
120 /* 24 is min size of an object */
122 return( VLC_EGENERIC );
127 return stream_Seek( s,
128 p_obj->common.i_object_pos +
129 p_obj->common.i_object_size );
132 static void ASF_FreeObject_Null( asf_object_t *pp_obj )
137 static int ASF_ReadObject_Header( stream_t *s, asf_object_t *p_obj )
139 asf_object_header_t *p_hdr = (asf_object_header_t*)p_obj;
140 asf_object_t *p_subobj;
144 if( ( i_peek = stream_Peek( s, &p_peek, 30 ) ) < 30 )
146 return( VLC_EGENERIC );
149 p_hdr->i_sub_object_count = GetDWLE( p_peek + 24 );
150 p_hdr->i_reserved1 = p_peek[28];
151 p_hdr->i_reserved2 = p_peek[29];
152 p_hdr->p_first = NULL;
153 p_hdr->p_last = NULL;
155 msg_Dbg( (vlc_object_t*)s,
156 "read \"header object\" subobj:%d, reserved1:%d, reserved2:%d",
157 p_hdr->i_sub_object_count,
159 p_hdr->i_reserved2 );
161 /* Cannot failed as peek succeed */
162 stream_Read( s, NULL, 30 );
164 /* Now load sub object */
167 p_subobj = malloc( sizeof( asf_object_t ) );
169 if( ASF_ReadObject( s, p_subobj, (asf_object_t*)p_hdr ) )
173 if( ASF_NextObject( s, p_subobj ) ) /* Go to the next object */
181 static int ASF_ReadObject_Data( stream_t *s, asf_object_t *p_obj )
183 asf_object_data_t *p_data = (asf_object_data_t*)p_obj;
187 if( ( i_peek = stream_Peek( s, &p_peek, 50 ) ) < 50 )
191 ASF_GetGUID( &p_data->i_file_id, p_peek + 24 );
192 p_data->i_total_data_packets = GetQWLE( p_peek + 40 );
193 p_data->i_reserved = GetWLE( p_peek + 48 );
195 msg_Dbg( (vlc_object_t*)s,
196 "read \"data object\" file_id:" GUID_FMT " total data packet:"
198 GUID_PRINT( p_data->i_file_id ),
199 p_data->i_total_data_packets,
200 p_data->i_reserved );
205 static int ASF_ReadObject_Index( stream_t *s, asf_object_t *p_obj )
207 asf_object_index_t *p_index = (asf_object_index_t*)p_obj;
211 if( ( i_peek = stream_Peek( s, &p_peek, 56 ) ) < 56 )
215 ASF_GetGUID( &p_index->i_file_id, p_peek + 24 );
216 p_index->i_index_entry_time_interval = GetQWLE( p_peek + 40 );
217 p_index->i_max_packet_count = GetDWLE( p_peek + 48 );
218 p_index->i_index_entry_count = GetDWLE( p_peek + 52 );
219 p_index->index_entry = NULL; /* FIXME */
222 msg_Dbg( (vlc_object_t*)s,
223 "read \"index object\" file_id:" GUID_FMT
224 " index_entry_time_interval:"I64Fd" max_packet_count:%d "
225 "index_entry_count:%ld",
226 GUID_PRINT( p_index->i_file_id ),
227 p_index->i_index_entry_time_interval,
228 p_index->i_max_packet_count,
229 (long int)p_index->i_index_entry_count );
233 static void ASF_FreeObject_Index( asf_object_t *p_obj )
235 asf_object_index_t *p_index = (asf_object_index_t*)p_obj;
237 FREE( p_index->index_entry );
240 static int ASF_ReadObject_file_properties( stream_t *s, asf_object_t *p_obj )
242 asf_object_file_properties_t *p_fp = (asf_object_file_properties_t*)p_obj;
246 if( ( i_peek = stream_Peek( s, &p_peek, 92) ) < 92 )
250 ASF_GetGUID( &p_fp->i_file_id, p_peek + 24 );
251 p_fp->i_file_size = GetQWLE( p_peek + 40 );
252 p_fp->i_creation_date = GetQWLE( p_peek + 48 );
253 p_fp->i_data_packets_count = GetQWLE( p_peek + 56 );
254 p_fp->i_play_duration = GetQWLE( p_peek + 64 );
255 p_fp->i_send_duration = GetQWLE( p_peek + 72 );
256 p_fp->i_preroll = GetQWLE( p_peek + 80 );
257 p_fp->i_flags = GetDWLE( p_peek + 88 );
258 p_fp->i_min_data_packet_size = GetDWLE( p_peek + 92 );
259 p_fp->i_max_data_packet_size = GetDWLE( p_peek + 96 );
260 p_fp->i_max_bitrate = GetDWLE( p_peek + 100 );
263 msg_Dbg( (vlc_object_t*)s,
264 "read \"file properties object\" file_id:" GUID_FMT
265 " file_size:"I64Fd" creation_date:"I64Fd" data_packets_count:"
266 I64Fd" play_duration:"I64Fd" send_duration:"I64Fd" preroll:"
267 I64Fd" flags:%d min_data_packet_size:%d max_data_packet_size:%d "
269 GUID_PRINT( p_fp->i_file_id ),
271 p_fp->i_creation_date,
272 p_fp->i_data_packets_count,
273 p_fp->i_play_duration,
274 p_fp->i_send_duration,
277 p_fp->i_min_data_packet_size,
278 p_fp->i_max_data_packet_size,
279 p_fp->i_max_bitrate );
284 static int ASF_ReadObject_header_extention( stream_t *s, asf_object_t *p_obj )
286 asf_object_header_extention_t *p_he = (asf_object_header_extention_t*)p_obj;
290 if( ( i_peek = stream_Peek( s, &p_peek, p_he->i_object_size ) ) < 46)
294 ASF_GetGUID( &p_he->i_reserved1, p_peek + 24 );
295 p_he->i_reserved2 = GetWLE( p_peek + 40 );
296 p_he->i_header_extention_size = GetDWLE( p_peek + 42 );
297 if( p_he->i_header_extention_size )
299 p_he->p_header_extention_data = malloc( p_he->i_header_extention_size );
300 memcpy( p_he->p_header_extention_data,
302 p_he->i_header_extention_size );
306 p_he->p_header_extention_data = NULL;
309 msg_Dbg( (vlc_object_t*)s,
310 "read \"header extention object\" reserved1:" GUID_FMT " reserved2:%d header_extention_size:%d",
311 GUID_PRINT( p_he->i_reserved1 ),
313 p_he->i_header_extention_size );
317 static void ASF_FreeObject_header_extention( asf_object_t *p_obj )
319 asf_object_header_extention_t *p_he = (asf_object_header_extention_t*)p_obj;
321 FREE( p_he->p_header_extention_data );
324 static int ASF_ReadObject_stream_properties( stream_t *s, asf_object_t *p_obj )
326 asf_object_stream_properties_t *p_sp =
327 (asf_object_stream_properties_t*)p_obj;
331 if( ( i_peek = stream_Peek( s, &p_peek, p_sp->i_object_size ) ) < 74 )
335 ASF_GetGUID( &p_sp->i_stream_type, p_peek + 24 );
336 ASF_GetGUID( &p_sp->i_error_correction_type, p_peek + 40 );
337 p_sp->i_time_offset = GetQWLE( p_peek + 56 );
338 p_sp->i_type_specific_data_length = GetDWLE( p_peek + 64 );
339 p_sp->i_error_correction_data_length = GetDWLE( p_peek + 68 );
340 p_sp->i_flags = GetWLE( p_peek + 72 );
341 p_sp->i_stream_number = p_sp->i_flags&0x07f;
342 p_sp->i_reserved = GetDWLE( p_peek + 74 );
343 if( p_sp->i_type_specific_data_length )
345 p_sp->p_type_specific_data = malloc( p_sp->i_type_specific_data_length );
346 memcpy( p_sp->p_type_specific_data,
348 p_sp->i_type_specific_data_length );
352 p_sp->p_type_specific_data = NULL;
354 if( p_sp->i_error_correction_data_length )
356 p_sp->p_error_correction_data = malloc( p_sp->i_error_correction_data_length );
357 memcpy( p_sp->p_error_correction_data,
358 p_peek + 78 + p_sp->i_type_specific_data_length,
359 p_sp->i_error_correction_data_length );
363 p_sp->p_error_correction_data = NULL;
367 msg_Dbg( (vlc_object_t*)s,
368 "read \"stream Properties object\" stream_type:" GUID_FMT
369 " error_correction_type:" GUID_FMT " time_offset:"I64Fd
370 " type_specific_data_length:%d error_correction_data_length:%d"
371 " flags:0x%x stream_number:%d",
372 GUID_PRINT( p_sp->i_stream_type ),
373 GUID_PRINT( p_sp->i_error_correction_type ),
375 p_sp->i_type_specific_data_length,
376 p_sp->i_error_correction_data_length,
378 p_sp->i_stream_number );
384 static void ASF_FreeObject_stream_properties( asf_object_t *p_obj )
386 asf_object_stream_properties_t *p_sp =
387 (asf_object_stream_properties_t*)p_obj;
389 FREE( p_sp->p_type_specific_data );
390 FREE( p_sp->p_error_correction_data );
394 static int ASF_ReadObject_codec_list( stream_t *s, asf_object_t *p_obj )
396 asf_object_codec_list_t *p_cl = (asf_object_codec_list_t*)p_obj;
398 uint8_t *p_peek, *p_data;
400 unsigned int i_codec;
402 if( ( i_peek = stream_Peek( s, &p_peek, p_cl->i_object_size ) ) < 44 )
407 ASF_GetGUID( &p_cl->i_reserved, p_peek + 24 );
408 p_cl->i_codec_entries_count = GetWLE( p_peek + 40 );
409 if( p_cl->i_codec_entries_count > 0 )
412 p_cl->codec = calloc( p_cl->i_codec_entries_count,
413 sizeof( asf_codec_entry_t ) );
414 memset( p_cl->codec, 0,
415 p_cl->i_codec_entries_count * sizeof( asf_codec_entry_t ) );
417 p_data = p_peek + 44;
418 for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ )
420 #define codec p_cl->codec[i_codec]
423 codec.i_type = GetWLE( p_data ); p_data += 2;
425 i_len = GetWLE( p_data ); p_data += 2;
426 codec.psz_name = calloc( sizeof( char ), i_len + 1);
427 for( i = 0; i < i_len; i++ )
429 codec.psz_name[i] = GetWLE( p_data + 2*i );
431 codec.psz_name[i_len] = '\0';
435 i_len = GetWLE( p_data ); p_data += 2;
436 codec.psz_description = calloc( sizeof( char ), i_len + 1);
437 for( i = 0; i < i_len; i++ )
439 codec.psz_description[i] = GetWLE( p_data + 2*i );
441 codec.psz_description[i_len] = '\0';
444 /* opaque information */
445 codec.i_information_length = GetWLE( p_data ); p_data += 2;
446 if( codec.i_information_length > 0 )
448 codec.p_information = malloc( codec.i_information_length );
449 memcpy( codec.p_information, p_data, codec.i_information_length );
450 p_data += codec.i_information_length;
454 codec.p_information = NULL;
465 msg_Dbg( (vlc_object_t*)s,
466 "read \"codec list object\" reserved_guid:" GUID_FMT " codec_entries_count:%d",
467 GUID_PRINT( p_cl->i_reserved ),
468 p_cl->i_codec_entries_count );
470 for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ )
472 #define codec p_cl->codec[i_codec]
473 msg_Dbg( (vlc_object_t*)s,
474 "read \"codec list object\" codec[%d] %s name:\"%s\" description:\"%s\" information_length:%d",
476 ( codec.i_type == ASF_CODEC_TYPE_VIDEO ) ? "video" : ( ( codec.i_type == ASF_CODEC_TYPE_AUDIO ) ? "audio" : "unknown" ),
478 codec.psz_description,
479 codec.i_information_length );
485 static void ASF_FreeObject_codec_list( asf_object_t *p_obj )
487 asf_object_codec_list_t *p_cl = (asf_object_codec_list_t*)p_obj;
488 unsigned int i_codec;
490 for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ )
492 #define codec p_cl->codec[i_codec]
493 FREE( codec.psz_name );
494 FREE( codec.psz_description );
495 FREE( codec.p_information );
502 /* Microsoft should go to hell. This time the length give number of bytes
503 * and for the some others object, length give char16 count ... */
504 static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj)
506 asf_object_content_description_t *p_cd =
507 (asf_object_content_description_t*)p_obj;
509 uint8_t *p_peek, *p_data;
518 #define GETSTRINGW( psz_str, i_size ) \
519 psz_str = calloc( i_size/2 + 1, sizeof( char ) ); \
520 for( i_len = 0; i_len < i_size/2; i_len++ ) \
522 psz_str[i_len] = GetWLE( p_data + 2*i_len ); \
524 psz_str[i_size/2] = '\0'; \
527 if( ( i_peek = stream_Peek( s, &p_peek, p_cd->i_object_size ) ) < 34 )
531 p_data = p_peek + 24;
533 i_title = GetWLE( p_data ); p_data += 2;
534 i_author= GetWLE( p_data ); p_data += 2;
535 i_copyright = GetWLE( p_data ); p_data += 2;
536 i_description = GetWLE( p_data ); p_data += 2;
537 i_rating = GetWLE( p_data ); p_data += 2;
539 GETSTRINGW( p_cd->psz_title, i_title );
540 GETSTRINGW( p_cd->psz_author, i_author );
541 GETSTRINGW( p_cd->psz_copyright, i_copyright );
542 GETSTRINGW( p_cd->psz_description, i_description );
543 GETSTRINGW( p_cd->psz_rating, i_rating );
548 msg_Dbg( (vlc_object_t*)s,
549 "Read \"content description object\" title:\"%s\" author:\"%s\" copyright:\"%s\" description:\"%s\" rating:\"%s\"",
553 p_cd->psz_description,
559 static void ASF_FreeObject_content_description( asf_object_t *p_obj)
561 asf_object_content_description_t *p_cd =
562 (asf_object_content_description_t*)p_obj;
564 FREE( p_cd->psz_title );
565 FREE( p_cd->psz_author );
566 FREE( p_cd->psz_copyright );
567 FREE( p_cd->psz_description );
568 FREE( p_cd->psz_rating );
575 int (*ASF_ReadObject_function)( stream_t *, asf_object_t *p_obj );
576 void (*ASF_FreeObject_function)( asf_object_t *p_obj );
577 } ASF_Object_Function [] =
579 { &asf_object_header_guid, ASF_OBJECT_TYPE_HEADER, ASF_ReadObject_Header, ASF_FreeObject_Null },
580 { &asf_object_data_guid, ASF_OBJECT_TYPE_DATA, ASF_ReadObject_Data, ASF_FreeObject_Null },
581 { &asf_object_index_guid, ASF_OBJECT_TYPE_INDEX, ASF_ReadObject_Index, ASF_FreeObject_Index },
582 { &asf_object_file_properties_guid, ASF_OBJECT_TYPE_FILE_PROPERTIES, ASF_ReadObject_file_properties, ASF_FreeObject_Null },
583 { &asf_object_stream_properties_guid, ASF_OBJECT_TYPE_STREAM_PROPERTIES, ASF_ReadObject_stream_properties,ASF_FreeObject_stream_properties },
584 { &asf_object_header_extention_guid, ASF_OBJECT_TYPE_EXTENTION_HEADER, ASF_ReadObject_header_extention, ASF_FreeObject_header_extention},
585 { &asf_object_codec_list_guid, ASF_OBJECT_TYPE_CODEC_LIST, ASF_ReadObject_codec_list, ASF_FreeObject_codec_list },
586 { &asf_object_marker_guid, ASF_OBJECT_TYPE_MARKER, NULL, NULL },
587 { &asf_object_content_description_guid, ASF_OBJECT_TYPE_CONTENT_DESCRIPTION, ASF_ReadObject_content_description, ASF_FreeObject_content_description },
589 { &asf_object_null_guid, 0, NULL, NULL }
592 static int ASF_ReadObject( stream_t *s,
593 asf_object_t *p_obj, asf_object_t *p_father )
602 if( ASF_ReadObjectCommon( s, p_obj ) )
604 msg_Warn( (vlc_object_t*)s, "cannot read one asf object" );
607 p_obj->common.p_father = p_father;
608 p_obj->common.p_first = NULL;
609 p_obj->common.p_next = NULL;
610 p_obj->common.p_last = NULL;
613 if( p_obj->common.i_object_size < 24 )
615 msg_Warn( (vlc_object_t*)s, "found a corrupted asf object (size<24)" );
618 /* find this object */
619 for( i_index = 0; ; i_index++ )
621 if( ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
622 &p_obj->common.i_object_id )||
623 ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
624 &asf_object_null_guid ) )
629 p_obj->common.i_type = ASF_Object_Function[i_index].i_type;
631 /* Now load this object */
632 if( ASF_Object_Function[i_index].ASF_ReadObject_function == NULL )
634 msg_Warn( (vlc_object_t*)s, "unknown asf object (not loaded)" );
635 i_result = VLC_SUCCESS;
639 /* XXX ASF_ReadObject_function realloc *pp_obj XXX */
641 (ASF_Object_Function[i_index].ASF_ReadObject_function)( s, p_obj );
644 /* link this object with father */
647 if( p_father->common.p_first )
649 p_father->common.p_last->common.p_next = p_obj;
653 p_father->common.p_first = p_obj;
655 p_father->common.p_last = p_obj;
661 static void ASF_FreeObject( stream_t *s, asf_object_t *p_obj )
664 asf_object_t *p_child;
671 /* Free all child object */
672 p_child = p_obj->common.p_first;
675 asf_object_t *p_next;
676 p_next = p_child->common.p_next;
677 ASF_FreeObject( s, p_child );
681 /* find this object */
682 for( i_index = 0; ; i_index++ )
684 if( ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
685 &p_obj->common.i_object_id )||
686 ASF_CmpGUID( ASF_Object_Function[i_index].p_id,
687 &asf_object_null_guid ) )
693 /* Now free this object */
694 if( ASF_Object_Function[i_index].ASF_FreeObject_function == NULL )
696 msg_Warn( (vlc_object_t*)s,
697 "unknown asf object " GUID_FMT,
698 GUID_PRINT( p_obj->common.i_object_id ) );
703 msg_Dbg( (vlc_object_t*)s,
704 "free asf object " GUID_FMT,
705 GUID_PRINT( p_obj->common.i_object_id ) );
707 (ASF_Object_Function[i_index].ASF_FreeObject_function)( p_obj );
713 /*****************************************************************************
714 * ASF_ReadObjetRoot : parse the entire stream/file
715 *****************************************************************************/
716 asf_object_root_t *ASF_ReadObjectRoot( stream_t *s, int b_seekable )
718 asf_object_root_t *p_root = malloc( sizeof( asf_object_root_t ) );
721 p_root->i_type = ASF_OBJECT_TYPE_ROOT;
722 memcpy( &p_root->i_object_id, &asf_object_null_guid, sizeof( guid_t ) );
723 p_root->i_object_pos = 0;
724 p_root->i_object_size = stream_Tell( s );
725 p_root->p_first = NULL;
726 p_root->p_last = NULL;
727 p_root->p_next = NULL;
728 p_root->p_hdr = NULL;
729 p_root->p_data = NULL;
731 p_root->p_index = NULL;
735 p_obj = malloc( sizeof( asf_object_t ) );
737 if( ASF_ReadObject( s, p_obj, (asf_object_t*)p_root ) )
741 switch( p_obj->common.i_type )
743 case( ASF_OBJECT_TYPE_HEADER ):
744 p_root->p_hdr = (asf_object_header_t*)p_obj;
746 case( ASF_OBJECT_TYPE_DATA ):
747 p_root->p_data = (asf_object_data_t*)p_obj;
749 case( ASF_OBJECT_TYPE_INDEX ):
750 p_root->p_index = (asf_object_index_t*)p_obj;
753 msg_Warn( (vlc_object_t*)s, "unknow object found" );
756 if( p_obj->common.i_type == ASF_OBJECT_TYPE_DATA &&
757 p_obj->common.i_object_size <= 50 )
759 /* probably a dump of broadcasted asf */
762 if( !b_seekable && p_root->p_hdr && p_root->p_data )
764 /* For unseekable stream it's enouth to play */
768 if( ASF_NextObject( s, p_obj ) ) /* Go to the next object */
774 if( p_root->p_hdr != NULL && p_root->p_data != NULL )
776 p_root->p_fp = ASF_FindObject( p_root->p_hdr,
777 &asf_object_file_properties_guid, 0 );
783 msg_Warn( (vlc_object_t*)s, "cannot find file properties object" );
787 ASF_FreeObjectRoot( s, p_root );
791 void ASF_FreeObjectRoot( stream_t *s, asf_object_root_t *p_root )
795 p_obj = p_root->p_first;
798 asf_object_t *p_next;
799 p_next = p_obj->common.p_next;
800 ASF_FreeObject( s, p_obj );
806 int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid )
809 asf_object_t *p_child;
817 p_child = p_obj->common.p_first;
820 if( ASF_CmpGUID( &p_child->common.i_object_id, p_guid ) )
824 p_child = p_child->common.p_next;
829 void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number )
831 asf_object_t *p_child;
833 p_child = p_obj->common.p_first;
837 if( ASF_CmpGUID( &p_child->common.i_object_id, p_guid ) )
847 p_child = p_child->common.p_next;