Changeset 14aec2164042b834c59c5ba53c0ea6def78a79cd
- Timestamp:
- 10/21/02 11:18:37
(6 years ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1035191917 +0000
- git-parent:
[df45b8c5e0549eb599fe4ee643e901ddff9f9eb0]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1035191917 +0000
- Message:
- configure.ac.in Makefile.am: enable asf demuxer plugin
- modules/demux/asf/*: some clean up
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rec8c631 |
r14aec21 |
|
| 1041 | 1041 | then |
|---|
| 1042 | 1042 | PLUGINS="${PLUGINS} avi" |
|---|
| | 1043 | fi |
|---|
| | 1044 | |
|---|
| | 1045 | dnl |
|---|
| | 1046 | dnl ASF demux plugin |
|---|
| | 1047 | dnl |
|---|
| | 1048 | AC_ARG_ENABLE(asf, |
|---|
| | 1049 | [ --enable-asf ASF demux module (default enabled)]) |
|---|
| | 1050 | if test "x${enable_asf}" != "xno" |
|---|
| | 1051 | then |
|---|
| | 1052 | PLUGINS="${PLUGINS} asf" |
|---|
| 1043 | 1053 | fi |
|---|
| 1044 | 1054 | |
|---|
| r9a5df48 |
r14aec21 |
|
| 33 | 33 | demux/aac/Modules.am \ |
|---|
| 34 | 34 | demux/avi/Modules.am \ |
|---|
| | 35 | demux/asf/Modules.am \ |
|---|
| 35 | 36 | demux/mp4/Modules.am \ |
|---|
| 36 | 37 | demux/mpeg/Modules.am \ |
|---|
| rc72215f |
r14aec21 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: asf.c,v 1.1 2002/10/20 17:22:33 fenrir Exp $ |
|---|
| | 5 | * $Id: asf.c,v 1.2 2002/10/21 09:18:37 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 84 | 84 | |
|---|
| 85 | 85 | /* a little test to see if it could be a asf stream */ |
|---|
| 86 | | if( input_Peek( p_input, &p_peek, 16 ) < 8 ) |
|---|
| | 86 | if( input_Peek( p_input, &p_peek, 16 ) < 16 ) |
|---|
| 87 | 87 | { |
|---|
| 88 | 88 | msg_Warn( p_input, "ASF v1.0 plugin discarded (cannot peek)" ); |
|---|
| … | … | |
| 104 | 104 | } |
|---|
| 105 | 105 | memset( p_demux, 0, sizeof( demux_sys_t ) ); |
|---|
| 106 | | p_input->p_demux_data = p_demux; |
|---|
| 107 | | |
|---|
| 108 | 106 | |
|---|
| 109 | 107 | /* Now load all object ( except raw data ) */ |
|---|
| … | … | |
| 123 | 121 | } |
|---|
| 124 | 122 | |
|---|
| 125 | | if( !( p_demux->p_fp = ASF_FindObject( (asf_object_t*)p_demux->root.p_hdr, |
|---|
| | 123 | if( !( p_demux->p_fp = ASF_FindObject( p_demux->root.p_hdr, |
|---|
| 126 | 124 | &asf_object_file_properties_guid, 0 ) ) ) |
|---|
| 127 | 125 | { |
|---|
| … | … | |
| 140 | 138 | } |
|---|
| 141 | 139 | |
|---|
| 142 | | p_demux->i_streams = ASF_CountObject( (asf_object_t*)p_demux->root.p_hdr, |
|---|
| | 140 | p_demux->i_streams = ASF_CountObject( p_demux->root.p_hdr, |
|---|
| 143 | 141 | &asf_object_stream_properties_guid ); |
|---|
| 144 | 142 | if( !p_demux->i_streams ) |
|---|
| … | … | |
| 177 | 175 | asf_object_stream_properties_t *p_sp; |
|---|
| 178 | 176 | |
|---|
| 179 | | p_sp = (asf_object_stream_properties_t*) |
|---|
| 180 | | ASF_FindObject( (asf_object_t*)p_demux->root.p_hdr, |
|---|
| 181 | | &asf_object_stream_properties_guid, |
|---|
| 182 | | i_stream ); |
|---|
| 183 | | |
|---|
| 184 | | p_stream = p_demux->stream[p_sp->i_stream_number] = malloc( sizeof( asf_stream_t ) ); |
|---|
| | 177 | p_sp = ASF_FindObject( p_demux->root.p_hdr, |
|---|
| | 178 | &asf_object_stream_properties_guid, |
|---|
| | 179 | i_stream ); |
|---|
| | 180 | |
|---|
| | 181 | p_stream = |
|---|
| | 182 | p_demux->stream[p_sp->i_stream_number] = |
|---|
| | 183 | malloc( sizeof( asf_stream_t ) ); |
|---|
| 185 | 184 | memset( p_stream, 0, sizeof( asf_stream_t ) ); |
|---|
| 186 | 185 | p_stream->p_sp = p_sp; |
|---|
| … | … | |
| 219 | 218 | switch( i_codec ) |
|---|
| 220 | 219 | { |
|---|
| | 220 | case( 0x01 ): |
|---|
| | 221 | p_stream->p_es->i_fourcc = |
|---|
| | 222 | VLC_FOURCC( 'a', 'r', 'a', 'w' ); |
|---|
| | 223 | break; |
|---|
| 221 | 224 | case( 0x50 ): |
|---|
| 222 | 225 | case( 0x55 ): |
|---|
| … | … | |
| 277 | 280 | vlc_mutex_unlock( &p_input->stream.stream_lock ); |
|---|
| 278 | 281 | |
|---|
| 279 | | // go to first packet |
|---|
| 280 | 282 | p_demux->i_data_begin = p_demux->root.p_data->i_object_pos + 50; |
|---|
| 281 | 283 | if( p_demux->root.p_data->i_object_size != 0 ) |
|---|
| … | … | |
| 288 | 290 | p_demux->i_data_end = -1; |
|---|
| 289 | 291 | } |
|---|
| | 292 | |
|---|
| | 293 | |
|---|
| | 294 | // go to first packet |
|---|
| 290 | 295 | ASF_SeekAbsolute( p_input, p_demux->i_data_begin ); |
|---|
| 291 | 296 | return( 0 ); |
|---|
| … | … | |
| 296 | 301 | *****************************************************************************/ |
|---|
| 297 | 302 | #define GETVALUE2b( bits, var, def ) \ |
|---|
| 298 | | switch( bits ) \ |
|---|
| | 303 | switch( (bits)&0x03 ) \ |
|---|
| 299 | 304 | { \ |
|---|
| 300 | 305 | case 1: var = p_peek[i_skip]; i_skip++; break; \ |
|---|
| … | … | |
| 314 | 319 | { |
|---|
| 315 | 320 | off_t i_offset; |
|---|
| | 321 | |
|---|
| 316 | 322 | i_offset = ASF_TellAbsolute( p_input ) - p_demux->i_data_begin; |
|---|
| 317 | | |
|---|
| | 323 | |
|---|
| 318 | 324 | if( i_offset < 0 ) |
|---|
| 319 | 325 | { |
|---|
| … | … | |
| 325 | 331 | |
|---|
| 326 | 332 | p_demux->i_time = 0; |
|---|
| 327 | | for( i = 0; i < 127 ; i++ ) |
|---|
| | 333 | for( i = 0; i < 128 ; i++ ) |
|---|
| 328 | 334 | { |
|---|
| 329 | 335 | #define p_stream p_demux->stream[i] |
|---|
| … | … | |
| 344 | 350 | /* update pcr XXX in mpeg scale so in 90000 unit/s */ |
|---|
| 345 | 351 | p_demux->i_pcr = p_demux->i_time * 9 / 100; |
|---|
| 346 | | |
|---|
| 347 | | // /* we will read 100ms for each stream so */ |
|---|
| 348 | | // p_demux->i_time += 100 * 1000; |
|---|
| 349 | 352 | |
|---|
| 350 | 353 | for( i = 0; i < 10; i++ ) // parse 10 packets |
|---|
| … | … | |
| 410 | 413 | |
|---|
| 411 | 414 | /* read some value */ |
|---|
| 412 | | GETVALUE2b( ( i_packet_flags >> 5 )&0x3, i_packet_length, i_data_packet_min ); |
|---|
| 413 | | GETVALUE2b( ( i_packet_flags >> 1 )&0x3, i_packet_sequence, 0 ); |
|---|
| 414 | | GETVALUE2b( ( i_packet_flags >> 3 )&0x3, i_packet_padding_length, 0 ); |
|---|
| | 415 | GETVALUE2b( i_packet_flags >> 5, i_packet_length, i_data_packet_min ); |
|---|
| | 416 | GETVALUE2b( i_packet_flags >> 1, i_packet_sequence, 0 ); |
|---|
| | 417 | GETVALUE2b( i_packet_flags >> 3, i_packet_padding_length, 0 ); |
|---|
| 415 | 418 | |
|---|
| 416 | 419 | i_packet_send_time = GetDWLE( p_peek + i_skip ); i_skip += 4; |
|---|
| … | … | |
| 450 | 453 | i_skip++; |
|---|
| 451 | 454 | |
|---|
| 452 | | GETVALUE2b( ( i_packet_property >> 4 )&0x03, i_media_object_number, 0 ); |
|---|
| 453 | | GETVALUE2b( ( i_packet_property >> 2 )&0x03, i_tmp, 0 ); |
|---|
| 454 | | GETVALUE2b( i_packet_property&0x03, i_replicated_data_length, 0 ); |
|---|
| | 455 | GETVALUE2b( i_packet_property >> 4, i_media_object_number, 0 ); |
|---|
| | 456 | GETVALUE2b( i_packet_property >> 2, i_tmp, 0 ); |
|---|
| | 457 | GETVALUE2b( i_packet_property, i_replicated_data_length, 0 ); |
|---|
| 455 | 458 | |
|---|
| 456 | 459 | if( i_replicated_data_length > 1 ) // should be at least 8 bytes |
|---|
| … | … | |
| 491 | 494 | } |
|---|
| 492 | 495 | |
|---|
| | 496 | #if 0 |
|---|
| 493 | 497 | msg_Dbg( p_input, |
|---|
| 494 | 498 | "payload(%d/%d) stream_number:%d media_object_number:%d media_object_offset:%d replicated_data_length:%d payload_data_length %d", |
|---|
| … | … | |
| 500 | 504 | i_replicated_data_length, |
|---|
| 501 | 505 | i_payload_data_length ); |
|---|
| 502 | | |
|---|
| | 506 | #endif |
|---|
| 503 | 507 | |
|---|
| 504 | 508 | if( !( p_stream = p_demux->stream[i_stream_number] ) ) |
|---|
| … | … | |
| 516 | 520 | |
|---|
| 517 | 521 | |
|---|
| 518 | | for( i_payload_data_pos = 0; i_payload_data_pos < i_payload_data_length; i_payload_data_pos += i_sub_payload_data_length ) |
|---|
| | 522 | for( i_payload_data_pos = 0; |
|---|
| | 523 | i_payload_data_pos < i_payload_data_length && |
|---|
| | 524 | i_packet_size_left > 0; |
|---|
| | 525 | i_payload_data_pos += i_sub_payload_data_length ) |
|---|
| 519 | 526 | { |
|---|
| 520 | 527 | data_packet_t *p_data; |
|---|
| … | … | |
| 531 | 538 | } |
|---|
| 532 | 539 | |
|---|
| 533 | | |
|---|
| 534 | | if( p_stream->p_pes && i_media_object_offset == 0 ) // I don't use i_media_object_number, sould I ? |
|---|
| 535 | | { |
|---|
| 536 | | // send complete packet to decoder |
|---|
| | 540 | /* FIXME I don't use i_media_object_number, sould I ? */ |
|---|
| | 541 | if( p_stream->p_pes && i_media_object_offset == 0 ) { |
|---|
| | 542 | /* send complete packet to decoder */ |
|---|
| 537 | 543 | if( p_stream->p_pes->i_pes_size > 0 ) |
|---|
| 538 | 544 | { |
|---|
| … | … | |
| 544 | 550 | if( !p_stream->p_pes ) // add a new PES |
|---|
| 545 | 551 | { |
|---|
| 546 | | mtime_t i_date; |
|---|
| 547 | 552 | p_stream->i_time = ( (mtime_t)i_pts + i_payload * (mtime_t)i_pts_delta ); |
|---|
| 548 | 553 | |
|---|
| … | … | |
| 582 | 587 | |
|---|
| 583 | 588 | i_skip = 0; |
|---|
| 584 | | if( i_packet_size_left <= 0 ) |
|---|
| | 589 | if( i_packet_size_left > 0 ) |
|---|
| 585 | 590 | { |
|---|
| 586 | | break; |
|---|
| 587 | | } |
|---|
| 588 | | if( input_Peek( p_input, &p_peek, i_packet_size_left ) < i_packet_size_left ) |
|---|
| 589 | | { |
|---|
| 590 | | // EOF ? |
|---|
| 591 | | msg_Err( p_input, "cannot peek, EOF ?" ); |
|---|
| 592 | | return( 0 ); |
|---|
| 593 | | } |
|---|
| 594 | | |
|---|
| 595 | | |
|---|
| 596 | | } |
|---|
| 597 | | if( i_packet_size_left <= 0 ) |
|---|
| 598 | | { |
|---|
| 599 | | break; |
|---|
| 600 | | } |
|---|
| 601 | | } |
|---|
| 602 | | |
|---|
| 603 | | loop_ok: |
|---|
| | 591 | if( input_Peek( p_input, &p_peek, i_packet_size_left ) < i_packet_size_left ) |
|---|
| | 592 | { |
|---|
| | 593 | // EOF ? |
|---|
| | 594 | msg_Warn( p_input, "cannot peek, EOF ?" ); |
|---|
| | 595 | return( 0 ); |
|---|
| | 596 | } |
|---|
| | 597 | } |
|---|
| | 598 | } |
|---|
| | 599 | } |
|---|
| | 600 | |
|---|
| 604 | 601 | if( i_packet_size_left > 0 ) |
|---|
| 605 | 602 | { |
|---|
| 606 | 603 | if( !ASF_SkipBytes( p_input, i_packet_size_left ) ) |
|---|
| 607 | 604 | { |
|---|
| 608 | | msg_Err( p_input, "cannot skip data, EOF ?" ); |
|---|
| | 605 | msg_Warn( p_input, "cannot skip data, EOF ?" ); |
|---|
| 609 | 606 | return( 0 ); |
|---|
| 610 | 607 | } |
|---|
| 611 | 608 | } |
|---|
| 612 | | |
|---|
| 613 | 609 | |
|---|
| 614 | 610 | continue; |
|---|
| … | … | |
| 623 | 619 | ASF_SkipBytes( p_input, i_data_packet_min ); |
|---|
| 624 | 620 | |
|---|
| 625 | | continue; |
|---|
| 626 | 621 | } // loop over packet |
|---|
| 627 | 622 | |
|---|
| 628 | 623 | p_demux->i_time = 0; |
|---|
| 629 | | for( i = 0; i < 127 ; i++ ) |
|---|
| | 624 | for( i = 0; i < 128 ; i++ ) |
|---|
| 630 | 625 | { |
|---|
| 631 | 626 | #define p_stream p_demux->stream[i] |
|---|
| … | … | |
| 650 | 645 | input_thread_t * p_input = (input_thread_t *)p_this; |
|---|
| 651 | 646 | demux_sys_t *p_demux = p_input->p_demux_data; |
|---|
| | 647 | int i_stream; |
|---|
| 652 | 648 | |
|---|
| 653 | 649 | msg_Dbg( p_input, "Freeing all memory" ); |
|---|
| 654 | 650 | ASF_FreeObjectRoot( p_input, &p_demux->root ); |
|---|
| | 651 | for( i_stream = 0; i_stream < 128; i_stream++ ) |
|---|
| | 652 | { |
|---|
| | 653 | #define p_stream p_demux->stream[i_stream] |
|---|
| | 654 | if( p_stream ) |
|---|
| | 655 | { |
|---|
| | 656 | if( p_stream->p_pes ) |
|---|
| | 657 | { |
|---|
| | 658 | input_DeletePES( p_input->p_method_data, p_stream->p_pes ); |
|---|
| | 659 | } |
|---|
| | 660 | free( p_stream ); |
|---|
| | 661 | } |
|---|
| | 662 | #undef p_stream |
|---|
| | 663 | } |
|---|
| 655 | 664 | |
|---|
| 656 | 665 | #undef FREE |
|---|
| rc72215f |
r14aec21 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: libasf.c,v 1.1 2002/10/20 17:22:33 fenrir Exp $ |
|---|
| | 5 | * $Id: libasf.c,v 1.2 2002/10/21 09:18:37 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 893 | 893 | } |
|---|
| 894 | 894 | |
|---|
| 895 | | int ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid ) |
|---|
| | 895 | int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid ) |
|---|
| 896 | 896 | { |
|---|
| 897 | 897 | int i_count; |
|---|
| … | … | |
| 916 | 916 | } |
|---|
| 917 | 917 | |
|---|
| 918 | | asf_object_t *ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number ) |
|---|
| | 918 | void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number ) |
|---|
| 919 | 919 | { |
|---|
| 920 | 920 | asf_object_t *p_child; |
|---|
| rc72215f |
r14aec21 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: libasf.h,v 1.1 2002/10/20 17:22:33 fenrir Exp $ |
|---|
| | 5 | * $Id: libasf.h,v 1.2 2002/10/21 09:18:37 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 441 | 441 | void ASF_FreeObjectRoot( input_thread_t *p_input, |
|---|
| 442 | 442 | asf_object_root_t *p_root ); |
|---|
| 443 | | |
|---|
| 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 ); |
|---|
| 446 | | |
|---|
| 447 | | |
|---|
| | 443 | #define ASF_CountObject( a, b ) __ASF_CountObject( (asf_object_t*)(a), b ) |
|---|
| | 444 | int __ASF_CountObject( asf_object_t *p_obj, const guid_t *p_guid ); |
|---|
| | 445 | |
|---|
| | 446 | #define ASF_FindObject( a, b, c ) __ASF_FindObject( (asf_object_t*)(a), b, c ) |
|---|
| | 447 | void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid, int i_number ); |
|---|
| | 448 | |
|---|
| | 449 | |
|---|