Changeset 6c84da28c658041cf1d9090d4414f0b5acfc947b
- Timestamp:
- 10/09/04 13:35:42 (4 years ago)
- git-parent:
- Files:
-
- modules/demux/asf/libasf.c (modified) (30 diffs)
- modules/demux/asf/libasf.h (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/demux/asf/libasf.c
radcebba r6c84da2 1 1 /***************************************************************************** 2 * libasf.c : 2 * libasf.c : asf stream demux module for vlc 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001-2003 VideoLAN 5 5 * $Id$ 6 * 6 7 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 8 * Gildas Bazin <gbazin@videolan.org> 7 9 * 8 10 * This program is free software; you can redistribute it and/or modify … … 45 47 * 46 48 ****************************************************************************/ 47 static int ASF_ReadObject( stream_t *, 48 asf_object_t *p_obj, asf_object_t *p_father ); 49 49 static int ASF_ReadObject( stream_t *, asf_object_t *, asf_object_t * ); 50 50 51 51 /**************************************************************************** … … 88 88 p_common->i_object_pos = stream_Tell( s ); 89 89 p_common->p_next = NULL; 90 90 91 #ifdef ASF_DEBUG 91 92 msg_Dbg( (vlc_object_t*)s, … … 114 115 return VLC_EGENERIC; 115 116 } 116 if( p_obj->common.p_father && p_obj->common.p_father->common.i_object_size != 0 ) 117 { 118 if( p_obj->common.p_father->common.i_object_pos + p_obj->common.p_father->common.i_object_size < 117 if( p_obj->common.p_father && 118 p_obj->common.p_father->common.i_object_size != 0 ) 119 { 120 if( p_obj->common.p_father->common.i_object_pos + 121 p_obj->common.p_father->common.i_object_size < 119 122 p_obj->common.i_object_pos + p_obj->common.i_object_size + 24 ) 120 123 /* 24 is min size of an object */ … … 125 128 } 126 129 127 return stream_Seek( s, 128 p_obj->common.i_object_pos + 129 p_obj->common.i_object_size ); 130 return stream_Seek( s, p_obj->common.i_object_pos + 131 p_obj->common.i_object_size ); 130 132 } 131 133 … … 152 154 p_hdr->p_first = NULL; 153 155 p_hdr->p_last = NULL; 156 154 157 #ifdef ASF_DEBUG 155 158 msg_Dbg( (vlc_object_t*)s, … … 159 162 p_hdr->i_reserved2 ); 160 163 #endif 161 /* Cannot failed as peek succeed */ 164 165 /* Cannot fail as peek succeed */ 162 166 stream_Read( s, NULL, 30 ); 163 167 … … 165 169 for( ; ; ) 166 170 { 167 p_subobj = malloc( sizeof( asf_object_t ) );171 p_subobj = malloc( sizeof( asf_object_t ) ); 168 172 169 173 if( ASF_ReadObject( s, p_subobj, (asf_object_t*)p_hdr ) ) 170 174 { 175 free( p_subobj ); 171 176 break; 172 177 } … … 192 197 p_data->i_total_data_packets = GetQWLE( p_peek + 40 ); 193 198 p_data->i_reserved = GetWLE( p_peek + 48 ); 199 194 200 #ifdef ASF_DEBUG 195 201 msg_Dbg( (vlc_object_t*)s, … … 200 206 p_data->i_reserved ); 201 207 #endif 208 202 209 return VLC_SUCCESS; 203 210 } … … 229 236 (long int)p_index->i_index_entry_count ); 230 237 #endif 238 231 239 return VLC_SUCCESS; 232 240 } 241 233 242 static void ASF_FreeObject_Index( asf_object_t *p_obj ) 234 243 { … … 267 276 I64Fd" flags:%d min_data_packet_size:%d max_data_packet_size:%d " 268 277 "max_bitrate:%d", 269 GUID_PRINT( p_fp->i_file_id ), 270 p_fp->i_file_size, 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, 275 p_fp->i_preroll, 276 p_fp->i_flags, 277 p_fp->i_min_data_packet_size, 278 p_fp->i_max_data_packet_size, 278 GUID_PRINT( p_fp->i_file_id ), p_fp->i_file_size, 279 p_fp->i_creation_date, p_fp->i_data_packets_count, 280 p_fp->i_play_duration, p_fp->i_send_duration, 281 p_fp->i_preroll, p_fp->i_flags, 282 p_fp->i_min_data_packet_size, p_fp->i_max_data_packet_size, 279 283 p_fp->i_max_bitrate ); 280 284 #endif 285 281 286 return VLC_SUCCESS; 282 287 } 283 288 284 static int ASF_ReadObject_header_extention( stream_t *s, asf_object_t *p_obj ) 285 { 286 asf_object_header_extention_t *p_he = (asf_object_header_extention_t*)p_obj; 289 static void ASF_FreeObject_metadata( asf_object_t *p_obj ) 290 { 291 asf_object_metadata_t *p_meta = 292 (asf_object_metadata_t *)p_obj; 293 unsigned int i; 294 295 for( i = 0; i < p_meta->i_record_entries_count; i++ ) 296 { 297 if( p_meta->record[i].psz_name ) free( p_meta->record[i].psz_name ); 298 if( p_meta->record[i].p_data ) free( p_meta->record[i].p_data ); 299 } 300 if( p_meta->record ) free( p_meta->record ); 301 } 302 303 static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj ) 304 { 305 asf_object_metadata_t *p_meta = 306 (asf_object_metadata_t *)p_obj; 307 308 int i_peek, i_entries, i; 309 uint8_t *p_peek; 310 311 p_meta->i_record_entries_count = 0; 312 p_meta->record = 0; 313 314 if( stream_Peek( s, &p_peek, p_meta->i_object_size ) < 315 (int)p_meta->i_object_size ) 316 { 317 return VLC_EGENERIC; 318 } 319 320 i_peek = 24; 321 i_entries = GetWLE( p_peek + i_peek ); i_peek += 2; 322 for( i = 0; i < i_entries && i_peek < (int)p_meta->i_object_size -12; i++ ) 323 { 324 asf_metadata_record_t record; 325 int i_name, i_data, j; 326 327 if( GetWLE( p_peek + i_peek ) != 0 ) 328 { 329 ASF_FreeObject_metadata( p_obj ); 330 return VLC_EGENERIC; 331 } 332 333 i_peek += 2; 334 record.i_stream = GetWLE( p_peek + i_peek ); i_peek += 2; 335 i_name = GetWLE( p_peek + i_peek ); i_peek += 2; 336 record.i_type = GetWLE( p_peek + i_peek ); i_peek += 2; 337 i_data = GetDWLE( p_peek + i_peek ); i_peek += 4; 338 339 if( record.i_type > ASF_METADATA_TYPE_WORD || 340 i_peek + i_data + i_name > (int)p_meta->i_object_size ) 341 { 342 ASF_FreeObject_metadata( p_obj ); 343 return VLC_EGENERIC; 344 } 345 346 record.i_val = 0; 347 record.i_data = 0; 348 record.p_data = 0; 349 350 /* get name */ 351 record.psz_name = malloc( i_name/2 ); 352 for( j = 0; j < i_name/2; j++ ) 353 { 354 record.psz_name[j] = GetWLE( p_peek + i_peek ); i_peek += 2; 355 } 356 357 /* get data */ 358 if( record.i_type == ASF_METADATA_TYPE_STRING ) 359 { 360 record.p_data = malloc( i_data/2 ); 361 record.i_data = i_data/2; 362 for( j = 0; j < i_data/2; j++ ) 363 { 364 record.p_data[j] = GetWLE( p_peek + i_peek ); i_peek += 2; 365 } 366 367 msg_Dbg( s, "metadata: %s=%s", record.psz_name, record.p_data ); 368 } 369 else if( record.i_type == ASF_METADATA_TYPE_BYTE ) 370 { 371 record.p_data = malloc( i_data ); 372 record.i_data = i_data; 373 memcpy( record.p_data, p_peek + i_peek, i_data ); 374 p_peek += i_data; 375 376 msg_Dbg( s, "metadata: %s (%i bytes)", record.psz_name, 377 record.i_data ); 378 } 379 else 380 { 381 if( record.i_type == ASF_METADATA_TYPE_QWORD ) 382 { 383 record.i_val = GetQWLE( p_peek + i_peek ); i_peek += 8; 384 } 385 else if( record.i_type == ASF_METADATA_TYPE_DWORD ) 386 { 387 record.i_val = GetDWLE( p_peek + i_peek ); i_peek += 4; 388 } 389 else 390 { 391 record.i_val = GetWLE( p_peek + i_peek ); i_peek += 2; 392 } 393 394 msg_Dbg( s, "metadata: %s=%i", record.psz_name, record.i_val ); 395 } 396 397 p_meta->i_record_entries_count++; 398 p_meta->record = 399 realloc( p_meta->record, p_meta->i_record_entries_count * 400 sizeof(asf_metadata_record_t) ); 401 memcpy( &p_meta->record[p_meta->i_record_entries_count-1], 402 &record, sizeof(asf_metadata_record_t) ); 403 } 404 405 return VLC_SUCCESS; 406 } 407 408 static int ASF_ReadObject_header_extension( stream_t *s, asf_object_t *p_obj ) 409 { 410 asf_object_header_extension_t *p_he = 411 (asf_object_header_extension_t *)p_obj; 287 412 int i_peek; 288 413 uint8_t *p_peek; … … 294 419 ASF_GetGUID( &p_he->i_reserved1, p_peek + 24 ); 295 420 p_he->i_reserved2 = GetWLE( p_peek + 40 ); 296 p_he->i_header_exten tion_size = GetDWLE( p_peek + 42 );297 if( p_he->i_header_exten tion_size )298 { 299 p_he->p_header_exten tion_data = malloc( p_he->i_header_extention_size );300 memcpy( p_he->p_header_extention_data,301 p_peek + 46,302 p_he->i_header_exten tion_size );421 p_he->i_header_extension_size = GetDWLE( p_peek + 42 ); 422 if( p_he->i_header_extension_size ) 423 { 424 p_he->p_header_extension_data = 425 malloc( p_he->i_header_extension_size ); 426 memcpy( p_he->p_header_extension_data, p_peek + 46, 427 p_he->i_header_extension_size ); 303 428 } 304 429 else 305 430 { 306 p_he->p_header_extention_data = NULL; 307 } 431 p_he->p_header_extension_data = NULL; 432 } 433 308 434 #ifdef ASF_DEBUG 309 435 msg_Dbg( (vlc_object_t*)s, 310 "read \"header exten tion object\" reserved1:" GUID_FMT " reserved2:%d header_extention_size:%d",311 GUID_PRINT( p_he->i_reserved1 ),312 p_he->i_reserved2,313 p_he->i_header_exten tion_size );436 "read \"header extension object\" reserved1:" GUID_FMT 437 " reserved2:%d header_extension_size:%d", 438 GUID_PRINT( p_he->i_reserved1 ), p_he->i_reserved2, 439 p_he->i_header_extension_size ); 314 440 #endif 441 442 if( !p_he->i_header_extension_size ) return VLC_SUCCESS; 443 444 /* Read the extension objects */ 445 stream_Read( s, NULL, 46 ); 446 for( ; ; ) 447 { 448 asf_object_t *p_obj = malloc( sizeof( asf_object_t ) ); 449 450 if( ASF_ReadObject( s, p_obj, (asf_object_t*)p_he ) ) 451 { 452 free( p_obj ); 453 break; 454 } 455 456 if( ASF_NextObject( s, p_obj ) ) /* Go to the next object */ 457 { 458 break; 459 } 460 } 461 315 462 return VLC_SUCCESS; 316 463 } 317 static void ASF_FreeObject_header_extention( asf_object_t *p_obj ) 318 { 319 asf_object_header_extention_t *p_he = (asf_object_header_extention_t*)p_obj; 320 321 FREE( p_he->p_header_extention_data ); 464 465 static void ASF_FreeObject_header_extension( asf_object_t *p_obj ) 466 { 467 asf_object_header_extension_t *p_he = 468 (asf_object_header_extension_t *)p_obj; 469 470 FREE( p_he->p_header_extension_data ); 322 471 } 323 472 … … 343 492 if( p_sp->i_type_specific_data_length ) 344 493 { 345 p_sp->p_type_specific_data = malloc( p_sp->i_type_specific_data_length );346 memcpy( p_sp->p_type_specific_data,347 p_peek + 78,494 p_sp->p_type_specific_data = 495 malloc( p_sp->i_type_specific_data_length ); 496 memcpy( p_sp->p_type_specific_data, p_peek + 78, 348 497 p_sp->i_type_specific_data_length ); 349 498 } … … 354 503 if( p_sp->i_error_correction_data_length ) 355 504 { 356 p_sp->p_error_correction_data = malloc( p_sp->i_error_correction_data_length ); 505 p_sp->p_error_correction_data = 506 malloc( p_sp->i_error_correction_data_length ); 357 507 memcpy( p_sp->p_error_correction_data, 358 508 p_peek + 78 + p_sp->i_type_specific_data_length, … … 463 613 464 614 #ifdef ASF_DEBUG 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 ); 615 msg_Dbg( s, "read \"codec list object\" reserved_guid:" GUID_FMT 616 " codec_entries_count:%d", 617 GUID_PRINT( p_cl->i_reserved ), p_cl->i_codec_entries_count ); 469 618 470 619 for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ ) 471 620 { 472 621 #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",475 i_codec, 476 ( codec.i_type == ASF_CODEC_TYPE_VIDEO ) ? "video" : ( ( codec.i_type == ASF_CODEC_TYPE_AUDIO ) ? "audio" : "unknown" ),477 codec.psz_name,478 codec.psz_ description,622 msg_Dbg( s, "read \"codec list object\" codec[%d] %s name:\"%s\" " 623 "description:\"%s\" information_length:%d", 624 i_codec, ( codec.i_type == ASF_CODEC_TYPE_VIDEO ) ? 625 "video" : ( ( codec.i_type == ASF_CODEC_TYPE_AUDIO ) ? 626 "audio" : "unknown" ), 627 codec.psz_name, codec.psz_description, 479 628 codec.i_information_length ); 629 #undef codec 480 630 } 481 631 #endif 632 482 633 return VLC_SUCCESS; 483 634 } … … 494 645 FREE( codec.psz_description ); 495 646 FREE( codec.p_information ); 496 497 647 #undef codec 498 648 } … … 505 655 { 506 656 asf_object_content_description_t *p_cd = 507 (asf_object_content_description_t*)p_obj; 508 int i_peek; 657 (asf_object_content_description_t *)p_obj; 509 658 uint8_t *p_peek, *p_data; 510 511 int i_len; 512 int i_title; 513 int i_author; 514 int i_copyright; 515 int i_description; 516 int i_rating; 659 int i_peek; 660 int i_len, i_title, i_author, i_copyright, i_description, i_rating; 517 661 518 662 #define GETSTRINGW( psz_str, i_size ) \ … … 560 704 { 561 705 asf_object_content_description_t *p_cd = 562 (asf_object_content_description_t*)p_obj;706 (asf_object_content_description_t *)p_obj; 563 707 564 708 FREE( p_cd->psz_title ); … … 575 719 int (*ASF_ReadObject_function)( stream_t *, asf_object_t *p_obj ); 576 720 void (*ASF_FreeObject_function)( asf_object_t *p_obj ); 721 577 722 } ASF_Object_Function [] = 578 723 { 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 }, 588 589 { &asf_object_null_guid, 0, NULL, NULL } 724 { &asf_object_header_guid, ASF_OBJECT_TYPE_HEADER, 725 ASF_ReadObject_Header, ASF_FreeObject_Null }, 726 { &asf_object_data_guid, ASF_OBJECT_TYPE_DATA, 727 ASF_ReadObject_Data, ASF_FreeObject_Null }, 728 { &asf_object_index_guid, ASF_OBJECT_TYPE_INDEX, 729 ASF_ReadObject_Index, ASF_FreeObject_Index }, 730 { &asf_object_file_properties_guid, ASF_OBJECT_TYPE_FILE_PROPERTIES, 731 ASF_ReadObject_file_properties, ASF_FreeObject_Null }, 732 { &asf_object_stream_properties_guid, ASF_OBJECT_TYPE_STREAM_PROPERTIES, 733 ASF_ReadObject_stream_properties,ASF_FreeObject_stream_properties }, 734 { &asf_object_header_extension_guid, ASF_OBJECT_TYPE_HEADER_EXTENSION, 735 ASF_ReadObject_header_extension, ASF_FreeObject_header_extension}, 736 { &asf_object_metadata_guid, ASF_OBJECT_TYPE_METADATA, 737 ASF_ReadObject_metadata, ASF_FreeObject_metadata}, 738 { &asf_object_codec_list_guid, ASF_OBJECT_TYPE_CODEC_LIST, 739 ASF_ReadObject_codec_list, ASF_FreeObject_codec_list }, 740 { &asf_object_marker_guid, ASF_OBJECT_TYPE_MARKER, 741 NULL, NULL }, 742 { &asf_object_content_description_guid, ASF_OBJECT_TYPE_CONTENT_DESCRIPTION, 743 ASF_ReadObject_content_description, ASF_FreeObject_content_description }, 744 745 { &asf_object_null_guid, 0, NULL, NULL } 590 746 }; 591 747 592 static int ASF_ReadObject( stream_t *s, 593 asf_object_t *p_ obj, asf_object_t *p_father )748 static int ASF_ReadObject( stream_t *s, asf_object_t *p_obj, 749 asf_object_t *p_father ) 594 750 { 595 751 int i_result; 596 752 int i_index; 597 753 598 if( !p_obj ) 599 { 600 return( 0 ); 601 } 754 if( !p_obj ) return( 0 ); 755 602 756 if( ASF_ReadObjectCommon( s, p_obj ) ) 603 757 { … … 610 764 p_obj->common.p_last = NULL; 611 765 612 613 766 if( p_obj->common.i_object_size < 24 ) 614 767 { … … 616 769 return VLC_EGENERIC; 617 770 } 771 618 772 /* find this object */ 619 773 for( i_index = 0; ; i_index++ ) 620 774 { 621 775 if( ASF_CmpGUID( ASF_Object_Function[i_index].p_id, 622 &p_obj->common.i_object_id )||776 &p_obj->common.i_object_id ) || 623 777 ASF_CmpGUID( ASF_Object_Function[i_index].p_id, 624 &asf_object_null_guid ) )778 &asf_object_null_guid ) ) 625 779 { 626 780 break; … … 664 818 asf_object_t *p_child; 665 819 666 if( !p_obj ) 667 { 668 return; 669 } 820 if( !p_obj ) return; 670 821 671 822 /* Free all child object */ … … 730 881 p_root->p_fp = NULL; 731 882 p_root->p_index = NULL; 883 p_root->p_hdr_ext = NULL; 884 p_root->p_metadata = NULL; 732 885 733 886 for( ; ; ) 734 887 { 735 p_obj = malloc( sizeof( asf_object_t ) );888 p_obj = malloc( sizeof( asf_object_t ) ); 736 889 737 890 if( ASF_ReadObject( s, p_obj, (asf_object_t*)p_root ) ) 738 891 { 892 free( p_obj ); 739 893 break; 740 894 } … … 750 904 p_root->p_index = (asf_object_index_t*)p_obj; 751 905 break; 906 case( ASF_OBJECT_TYPE_HEADER_EXTENSION ): 907 p_root->p_hdr_ext = (asf_object_header_extension_t*)p_obj; 908 break; 752 909 default: 753 910 msg_Warn( (vlc_object_t*)s, "unknow object found" ); … … 762 919 if( !b_seekable && p_root->p_hdr && p_root->p_data ) 763 920 { 764 /* For unseekable stream it's enou th to play */921 /* For unseekable stream it's enough to play */ 765 922 break; 766 923 } … … 779 936 if( p_root->p_fp ) 780 937 { 938 939 if( p_root->p_hdr_ext != NULL ) 940 { 941 p_root->p_metadata = 942 ASF_FindObject( p_root->p_hdr_ext, 943 &asf_object_metadata_guid, 0 ); 944 } 945 781 946 return p_root; 782 947 } … … 809 974 asf_object_t *p_child; 810 975 811 if( !p_obj ) 812 { 813 return( 0 ); 814 } 976 if( !p_obj ) return( 0 ); 815 977 816 978 i_count = 0; … … 827 989 } 828 990 829 void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number ) 991 void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, 992 int i_number ) 830 993 { 831 994 asf_object_t *p_child; … … 849 1012 return( NULL ); 850 1013 } 851 modules/demux/asf/libasf.h
rffdca9a r6c84da2 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001-2003 VideoLAN 5 * $Id : libasf.h,v 1.8 2004/01/25 20:05:28 hartman Exp$5 * $Id$ 6 6 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 7 7 * … … 40 40 #define ASF_OBJECT_TYPE_FILE_PROPERTIES 0x0005 41 41 #define ASF_OBJECT_TYPE_STREAM_PROPERTIES 0x0006 42 #define ASF_OBJECT_TYPE_ EXTENTION_HEADER0x000742 #define ASF_OBJECT_TYPE_HEADER_EXTENSION 0x0007 43 43 #define ASF_OBJECT_TYPE_CODEC_LIST 0x0008 44 44 #define ASF_OBJECT_TYPE_MARKER 0x0009 45 45 #define ASF_OBJECT_TYPE_CONTENT_DESCRIPTION 0x000a 46 #define ASF_OBJECT_TYPE_METADATA 0x000b 46 47 47 48 static const guid_t asf_object_null_guid = … … 54 55 55 56 static const guid_t asf_object_header_guid = 56 { 57 0x75B22630, 58 0x668E, 59 0x11CF, 60 { 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C } 61 }; 57 {0x75B22630, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}}; 62 58 63 59 static const guid_t asf_object_data_guid = 64 { 65 0x75B22636, 66 0x668E, 67 0x11CF, 68 { 0xA6,0xD9, 0x00,0xAA,0x00,0x62,0xCE,0x6C } 69 }; 70 71 60 {0x75B22636, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C}}; 72 61 73 62 static const guid_t asf_object_index_guid = 74 { 75 0x33000890, 76 0xE5B1, 77 0x11CF, 78 { 0x89,0xF4, 0x00,0xA0,0xC9,0x03,0x49,0xCB } 79 }; 63 {0x33000890, 0xE5B1, 0x11CF, {0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB}}; 80 64 81 65 static const guid_t asf_object_file_properties_guid = 82 { 83 0x8cabdca1, 84 0xa947, 85 0x11cf, 86 { 0x8e,0xe4, 0x00,0xC0,0x0C,0x20,0x53,0x65 } 87 88 }; 66 {0x8cabdca1, 0xa947, 0x11cf, {0x8e, 0xe4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}}; 67 89 68 static const guid_t asf_object_stream_properties_guid = 90 { 91 0xB7DC0791, 92 0xA9B7, 93 0x11CF, 94 { 0x8E,0xE6, 0x00,0xC0,0x0C,0x20,0x53,0x65 } 95 96 }; 69 {0xB7DC0791, 0xA9B7, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}}; 97 70 98 71 static const guid_t asf_object_content_description_guid = 99 { 100 0x75B22633, 101 0x668E, 102 0x11CF, 103 { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c } 104 }; 105 106 static const guid_t asf_object_header_extention_guid = 107 { 108 0x5FBF03B5, 109 0xA92E, 110 0x11CF, 111 { 0x8E,0xE3, 0x00,0xC0,0x0C,0x20,0x53,0x65 } 112 }; 72 {0x75B22633, 0x668E, 0x11CF, {0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}}; 73 74 static const guid_t asf_object_header_extension_guid = 75 {0x5FBF03B5, 0xA92E, 0x11CF, {0x8E, 0xE3, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}}; 76 77 static const guid_t asf_object_metadata_guid = 78 {0xC5F8CBEA, 0x5BAF, 0x4877, {0x84, 0x67, 0xAA, 0x8C, 0x44, 0xFA, 0x4C, 0xCA}}; 113 79 114 80 static const guid_t asf_object_codec_list_guid = 115 { 116 0x86D15240, 117 0x311D, 118 0x11D0, 119 { 0xA3,0xA4, 0x00,0xA0,0xC9,0x03,0x48,0xF6 } 120 }; 81 {0x86D15240, 0x311D, 0x11D0, {0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}}; 121 82 122 83 static const guid_t asf_object_marker_guid = 123 { 124 0xF487CD01, 125 0xA951, 126 0x11CF, 127 { 0x8E,0xE6, 0x00,0xC0,0x0C,0x20,0x53,0x65 } 128 129 }; 84 {0xF487CD01, 0xA951, 0x11CF, {0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65}}; 130 85 131 86 static const guid_t asf_object_stream_type_audio = 132 { 133 0xF8699E40, 134 0x5B4D, 135 0x11CF, 136 { 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B } 137 }; 87 {0xF8699E40, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}}; 138 88 139 89 static const guid_t asf_object_stream_type_video = 140 { 141 0xbc19efc0, 142 0x5B4D, 143 0x11CF, 144 { 0xA8,0xFD, 0x00,0x80,0x5F,0x5C,0x44,0x2B } 145 }; 90 {0xbc19efc0, 0x5B4D, 0x11CF, {0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B}}; 146 91 147 92 static const guid_t asf_object_stream_type_command = 148 { 149 0x59DACFC0, 150 0x59E6, 151 0x11D0, 152 { 0xA3,0xAC, 0x00,0xA0,0xC9,0x03,0x48,0xF6 } 153 }; 154 155 #define ASF_OBJECT_COMMON \ 156 int i_type; \ 157 guid_t i_object_id; \ 158 uint64_t i_object_size; \ 159 uint64_t i_object_pos; \ 93 {0x59DACFC0, 0x59E6, 0x11D0, {0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6}}; 94 95 #define ASF_OBJECT_COMMON \ 96 int i_type; \ 97 guid_t i_object_id; \ 98 uint64_t i_object_size; \ 99 uint64_t i_object_pos; \ 160 100 union asf_object_u *p_father; \ 161 101 union asf_object_u *p_first; \ … … 254 194 } asf_object_stream_properties_t; 255 195 256 typedef struct asf_object_header_exten tion_s196 typedef struct asf_object_header_extension_s 257 197 { 258 198 ASF_OBJECT_COMMON … … 260 200 guid_t i_reserved1; 261 201 uint16_t i_reserved2; 262 uint32_t i_header_extention_size; 263 uint8_t *p_header_extention_data; 264 265 } asf_object_header_extention_t; 202 uint32_t i_header_extension_size; 203 uint8_t *p_header_extension_data; 204 205 } asf_object_header_extension_t; 206 207 #define ASF_METADATA_TYPE_STRING 0x0000 208 #define ASF_METADATA_TYPE_BYTE 0x0001 209 #define ASF_METADATA_TYPE_BOOL 0x0002 210 #define ASF_METADATA_TYPE_DWORD 0x0003 211 #define ASF_METADATA_TYPE_QWORD 0x0004 212 #define ASF_METADATA_TYPE_WORD 0x0005 213 214 typedef struct asf_metadata_record_s 215 { 216 uint16_t i_stream; 217 uint16_t i_type; 218 char *psz_name; 219 220 int64_t i_val; 221 int i_data; 222 uint8_t *p_data; 223 224 } asf_metadata_record_t; 225 226 typedef struct asf_object_metadata_s 227 { 228 ASF_OBJECT_COMMON 229 230 uint32_t i_record_entries_count; 231 asf_metadata_record_t *record; 232 233 } asf_object_metadata_t; 266 234 267 235 typedef struct asf_objec_content_description_s … … 281 249 uint16_t i_length; 282 250 uint16_t *i_char; 251 283 252 } string16_t; 284 253 … … 340 309 /* could be NULL if !b_seekable or not-present */ 341 310 asf_object_index_t *p_index; 311 asf_object_header_extension_t *p_hdr_ext; 342 312 343 313 /* from asf_object_header_t */ 344 314 asf_object_file_properties_t *p_fp; 345 315 316 /* from asf_object_header_extension_t */ 317 asf_object_metadata_t *p_metadata; 318 346 319 } asf_object_root_t; 347 320 … … 358 331 asf_object_file_properties_t file_properties; 359 332 asf_object_stream_properties_t stream_properties; 360 asf_object_header_extention_t header_extention; 333 asf_object_header_extension_t header_extension; 334 asf_object_metadata_t metadata; 361 335 asf_object_codec_list_t codec_list; 362 336 asf_object_marker_t marker; … … 365 339 366 340 367 368 void ASF_GetGUID ( guid_t *p_guid, uint8_t *p_data ); 369 int ASF_CmpGUID ( const guid_t *p_guid1, const guid_t *p_guid2 ); 341 void ASF_GetGUID( guid_t *p_guid, uint8_t *p_data ); 342 int ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 ); 370 343 371 344 asf_object_root_t *ASF_ReadObjectRoot( stream_t *, int b_seekable ); 372 void ASF_FreeObjectRoot ( stream_t *, asf_object_root_t *p_root );345 void ASF_FreeObjectRoot( stream_t *, asf_object_root_t *p_root ); 373 346 374 347 #define ASF_CountObject( a, b ) __ASF_CountObject( (asf_object_t*)(a), b ) 375 int __ASF_CountObject ( asf_object_t *p_obj, const guid_t *p_guid );348 int __ASF_CountObject ( asf_object_t *p_obj, const guid_t *p_guid ); 376 349 377 350 #define ASF_FindObject( a, b, c ) __ASF_FindObject( (asf_object_t*)(a), b, c ) 378 void *__ASF_FindObject ( asf_object_t *p_obj, const guid_t *p_guid, int i_number ); 379 351 void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number );
