Changeset 2fc62e061142cb3f3062a353678db6890fc6776b
- Timestamp:
- 06/28/02 21:31:40
(6 years ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1025292700 +0000
- git-parent:
[660db6d87715f5b677edbb8fddd071ad236511eb]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1025292700 +0000
- Message:
plugins/avi/avi.c : audio seems to be better.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3a31acc |
r2fc62e0 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: avi.c,v 1.24 2002/06/27 19:05:17 sam Exp $ |
|---|
| | 5 | * $Id: avi.c,v 1.25 2002/06/28 19:31:40 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 162 | 162 | |
|---|
| 163 | 163 | |
|---|
| 164 | | static inline int __AVI_GetESTypeFromTwoCC( u16 i_type ) |
|---|
| | 164 | static inline int AVI_GetESTypeFromTwoCC( u16 i_type ) |
|---|
| 165 | 165 | { |
|---|
| 166 | 166 | switch( i_type ) |
|---|
| … | … | |
| 171 | 171 | case( TWOCC_db ): |
|---|
| 172 | 172 | return( VIDEO_ES ); |
|---|
| 173 | | } |
|---|
| 174 | | return( UNKNOWN_ES ); |
|---|
| | 173 | default: |
|---|
| | 174 | return( UNKNOWN_ES ); |
|---|
| | 175 | } |
|---|
| 175 | 176 | } |
|---|
| 176 | 177 | |
|---|
| … | … | |
| 222 | 223 | return( MSMPEG4v3_VIDEO_ES ); |
|---|
| 223 | 224 | |
|---|
| 224 | | |
|---|
| 225 | 225 | case( FOURCC_DIVX ): |
|---|
| 226 | 226 | case( FOURCC_divx ): |
|---|
| … | … | |
| 332 | 332 | |
|---|
| 333 | 333 | |
|---|
| 334 | | |
|---|
| 335 | | |
|---|
| 336 | | |
|---|
| 337 | | |
|---|
| 338 | | |
|---|
| 339 | | static void __AVIFreeDemuxData( input_thread_t *p_input ) |
|---|
| 340 | | { |
|---|
| 341 | | int i; |
|---|
| 342 | | demux_data_avi_file_t *p_avi_demux; |
|---|
| 343 | | p_avi_demux = (demux_data_avi_file_t*)p_input->p_demux_data ; |
|---|
| 344 | | |
|---|
| 345 | | if( p_avi_demux->p_riff != NULL ) |
|---|
| 346 | | RIFF_DeleteChunk( p_input, p_avi_demux->p_riff ); |
|---|
| 347 | | if( p_avi_demux->p_hdrl != NULL ) |
|---|
| 348 | | RIFF_DeleteChunk( p_input, p_avi_demux->p_hdrl ); |
|---|
| 349 | | if( p_avi_demux->p_movi != NULL ) |
|---|
| 350 | | RIFF_DeleteChunk( p_input, p_avi_demux->p_movi ); |
|---|
| 351 | | if( p_avi_demux->p_idx1 != NULL ) |
|---|
| 352 | | RIFF_DeleteChunk( p_input, p_avi_demux->p_idx1 ); |
|---|
| 353 | | if( p_avi_demux->pp_info != NULL ) |
|---|
| 354 | | { |
|---|
| 355 | | for( i = 0; i < p_avi_demux->i_streams; i++ ) |
|---|
| 356 | | { |
|---|
| 357 | | if( p_avi_demux->pp_info[i] != NULL ) |
|---|
| 358 | | { |
|---|
| 359 | | if( p_avi_demux->pp_info[i]->p_index != NULL ) |
|---|
| 360 | | { |
|---|
| 361 | | free( p_avi_demux->pp_info[i]->p_index ); |
|---|
| 362 | | AVI_PESBuffer_Flush( p_input->p_method_data, p_avi_demux->pp_info[i] ); |
|---|
| 363 | | } |
|---|
| 364 | | free( p_avi_demux->pp_info[i] ); |
|---|
| 365 | | } |
|---|
| 366 | | } |
|---|
| 367 | | free( p_avi_demux->pp_info ); |
|---|
| 368 | | } |
|---|
| 369 | | } |
|---|
| 370 | | |
|---|
| 371 | 334 | static void AVI_ParseStreamHeader( u32 i_id, int *i_number, int *i_type ) |
|---|
| 372 | 335 | { |
|---|
| … | … | |
| 503 | 466 | if( ( i_number < p_avi_demux->i_streams ) |
|---|
| 504 | 467 | &&(p_avi_demux->pp_info[i_number]->i_cat == |
|---|
| 505 | | __AVI_GetESTypeFromTwoCC( i_type ))) |
|---|
| | 468 | AVI_GetESTypeFromTwoCC( i_type ))) |
|---|
| 506 | 469 | { |
|---|
| 507 | 470 | __AVI_AddEntryIndex( p_avi_demux->pp_info[i_number], |
|---|
| … | … | |
| 552 | 515 | } |
|---|
| 553 | 516 | |
|---|
| 554 | | |
|---|
| 555 | | #if 0 |
|---|
| 556 | | FILE *DumpAudio; |
|---|
| 557 | | #endif |
|---|
| | 517 | /***************************************************************************** |
|---|
| | 518 | * AVIEnd: frees unused data |
|---|
| | 519 | *****************************************************************************/ |
|---|
| | 520 | static void AVIEnd( input_thread_t *p_input ) |
|---|
| | 521 | { |
|---|
| | 522 | int i; |
|---|
| | 523 | demux_data_avi_file_t *p_avi_demux; |
|---|
| | 524 | p_avi_demux = (demux_data_avi_file_t*)p_input->p_demux_data ; |
|---|
| | 525 | |
|---|
| | 526 | if( p_avi_demux->p_riff ) |
|---|
| | 527 | RIFF_DeleteChunk( p_input, p_avi_demux->p_riff ); |
|---|
| | 528 | if( p_avi_demux->p_hdrl ) |
|---|
| | 529 | RIFF_DeleteChunk( p_input, p_avi_demux->p_hdrl ); |
|---|
| | 530 | if( p_avi_demux->p_movi ) |
|---|
| | 531 | RIFF_DeleteChunk( p_input, p_avi_demux->p_movi ); |
|---|
| | 532 | if( p_avi_demux->p_idx1 ) |
|---|
| | 533 | RIFF_DeleteChunk( p_input, p_avi_demux->p_idx1 ); |
|---|
| | 534 | if( p_avi_demux->pp_info ) |
|---|
| | 535 | { |
|---|
| | 536 | for( i = 0; i < p_avi_demux->i_streams; i++ ) |
|---|
| | 537 | { |
|---|
| | 538 | if( p_avi_demux->pp_info[i] ) |
|---|
| | 539 | { |
|---|
| | 540 | if( p_avi_demux->pp_info[i]->p_index ) |
|---|
| | 541 | { |
|---|
| | 542 | free( p_avi_demux->pp_info[i]->p_index ); |
|---|
| | 543 | AVI_PESBuffer_Flush( p_input->p_method_data, |
|---|
| | 544 | p_avi_demux->pp_info[i] ); |
|---|
| | 545 | } |
|---|
| | 546 | free( p_avi_demux->pp_info[i] ); |
|---|
| | 547 | } |
|---|
| | 548 | } |
|---|
| | 549 | free( p_avi_demux->pp_info ); |
|---|
| | 550 | } |
|---|
| | 551 | } |
|---|
| 558 | 552 | |
|---|
| 559 | 553 | /***************************************************************************** |
|---|
| … | … | |
| 590 | 584 | if( RIFF_TestFileHeader( p_input, &p_riff, FOURCC_AVI ) != 0 ) |
|---|
| 591 | 585 | { |
|---|
| 592 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 586 | AVIEnd( p_input ); |
|---|
| 593 | 587 | msg_Warn( p_input, "RIFF-AVI module discarded" ); |
|---|
| 594 | 588 | return( -1 ); |
|---|
| … | … | |
| 598 | 592 | if ( RIFF_DescendChunk(p_input) != 0 ) |
|---|
| 599 | 593 | { |
|---|
| 600 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 594 | AVIEnd( p_input ); |
|---|
| 601 | 595 | msg_Err( p_input, "cannot look for subchunk" ); |
|---|
| 602 | 596 | return ( -1 ); |
|---|
| … | … | |
| 606 | 600 | if( RIFF_FindListChunk(p_input ,&p_hdrl,p_riff, FOURCC_hdrl) != 0 ) |
|---|
| 607 | 601 | { |
|---|
| 608 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 602 | AVIEnd( p_input ); |
|---|
| 609 | 603 | msg_Err( p_input, "cannot find \"LIST-hdrl\"" ); |
|---|
| 610 | 604 | return( -1 ); |
|---|
| … | … | |
| 614 | 608 | if( RIFF_DescendChunk(p_input) != 0 ) |
|---|
| 615 | 609 | { |
|---|
| 616 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 610 | AVIEnd( p_input ); |
|---|
| 617 | 611 | msg_Err( p_input, "cannot look for subchunk" ); |
|---|
| 618 | 612 | return ( -1 ); |
|---|
| … | … | |
| 622 | 616 | &p_avih, FOURCC_avih ) != 0 ) |
|---|
| 623 | 617 | { |
|---|
| 624 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 618 | AVIEnd( p_input ); |
|---|
| 625 | 619 | msg_Err( p_input, "cannot find \"avih\" chunk" ); |
|---|
| 626 | 620 | return( -1 ); |
|---|
| … | … | |
| 632 | 626 | /* no stream found, perhaps it would be cool to find it */ |
|---|
| 633 | 627 | { |
|---|
| 634 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 628 | AVIEnd( p_input ); |
|---|
| 635 | 629 | msg_Err( p_input, "no stream defined!" ); |
|---|
| 636 | 630 | return( -1 ); |
|---|
| … | … | |
| 642 | 636 | { |
|---|
| 643 | 637 | vlc_mutex_unlock( &p_input->stream.stream_lock ); |
|---|
| 644 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 638 | AVIEnd( p_input ); |
|---|
| 645 | 639 | msg_Err( p_input, "cannot init stream" ); |
|---|
| 646 | 640 | return( -1 ); |
|---|
| … | … | |
| 649 | 643 | { |
|---|
| 650 | 644 | vlc_mutex_unlock( &p_input->stream.stream_lock ); |
|---|
| 651 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 645 | AVIEnd( p_input ); |
|---|
| 652 | 646 | msg_Err( p_input, "cannot add program" ); |
|---|
| 653 | 647 | return( -1 ); |
|---|
| … | … | |
| 662 | 656 | p_avi_demux->pp_info = calloc( p_avi_demux->i_streams, |
|---|
| 663 | 657 | sizeof( AVIStreamInfo_t* ) ); |
|---|
| 664 | | memset( p_avi_demux->pp_info, 0, |
|---|
| 665 | | sizeof( AVIStreamInfo_t* ) * p_avi_demux->i_streams ); |
|---|
| | 658 | memset( p_avi_demux->pp_info, |
|---|
| | 659 | 0, |
|---|
| | 660 | sizeof( AVIStreamInfo_t* ) * p_avi_demux->i_streams ); |
|---|
| 666 | 661 | |
|---|
| 667 | 662 | for( i = 0 ; i < p_avi_demux->i_streams; i++ ) |
|---|
| … | … | |
| 675 | 670 | ||( RIFF_DescendChunk(p_input) != 0 )) |
|---|
| 676 | 671 | { |
|---|
| 677 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 672 | AVIEnd( p_input ); |
|---|
| 678 | 673 | msg_Err( p_input, "cannot find \"LIST-strl\"" ); |
|---|
| 679 | 674 | return( -1 ); |
|---|
| … | … | |
| 685 | 680 | { |
|---|
| 686 | 681 | RIFF_DeleteChunk( p_input, p_strl ); |
|---|
| 687 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 682 | AVIEnd( p_input ); |
|---|
| 688 | 683 | msg_Err( p_input, "cannot find \"strh\"" ); |
|---|
| 689 | 684 | return( -1 ); |
|---|
| … | … | |
| 698 | 693 | { |
|---|
| 699 | 694 | RIFF_DeleteChunk( p_input, p_strl ); |
|---|
| 700 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 695 | AVIEnd( p_input ); |
|---|
| 701 | 696 | msg_Err( p_input, "cannot find \"strf\"" ); |
|---|
| 702 | 697 | return( -1 ); |
|---|
| … | … | |
| 707 | 702 | RIFF_DeleteChunk( p_input, p_strf ); |
|---|
| 708 | 703 | RIFF_DeleteChunk( p_input, p_strl ); |
|---|
| 709 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 704 | AVIEnd( p_input ); |
|---|
| 710 | 705 | msg_Err( p_input, "cannot go out (\"strl\")" ); |
|---|
| 711 | 706 | return( -1 ); |
|---|
| … | … | |
| 772 | 767 | if( RIFF_AscendChunk(p_input, p_hdrl) != 0) |
|---|
| 773 | 768 | { |
|---|
| 774 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 769 | AVIEnd( p_input ); |
|---|
| 775 | 770 | msg_Err( p_input, "cannot go out (\"hdrl\")" ); |
|---|
| 776 | 771 | return( -1 ); |
|---|
| … | … | |
| 781 | 776 | { |
|---|
| 782 | 777 | msg_Err( p_input, "cannot find \"LIST-movi\"" ); |
|---|
| 783 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 778 | AVIEnd( p_input ); |
|---|
| 784 | 779 | return( -1 ); |
|---|
| 785 | 780 | } |
|---|
| … | … | |
| 798 | 793 | if( RIFF_DescendChunk( p_input ) != 0 ) |
|---|
| 799 | 794 | { |
|---|
| 800 | | __AVIFreeDemuxData( p_input ); |
|---|
| | 795 | AVIEnd( p_input ); |
|---|
| 801 | 796 | msg_Err( p_input, "cannot go in (\"movi\")" ); |
|---|
| 802 | 797 | return( -1 ); |
|---|
| … | … | |
| 833 | 828 | { |
|---|
| 834 | 829 | p_avi_demux->p_info_video = p_info; |
|---|
| 835 | | /* TODO add test to see if a decoder has been foud */ |
|---|
| | 830 | /* TODO add test to see if a decoder has been found */ |
|---|
| 836 | 831 | vlc_mutex_lock( &p_input->stream.stream_lock ); |
|---|
| 837 | 832 | input_SelectES( p_input, p_info->p_es ); |
|---|
| … | … | |
| 841 | 836 | |
|---|
| 842 | 837 | case( AUDIO_ES ): |
|---|
| 843 | | msg_Dbg( p_input, "audio(0x%x) %d channels %dHz %dbits %d bytes", |
|---|
| | 838 | msg_Dbg( p_input, "audio(0x%x) %d channels %dHz %dbits (unit %d)", |
|---|
| 844 | 839 | p_info->audio_format.i_formattag, |
|---|
| 845 | 840 | p_info->audio_format.i_channels, |
|---|
| … | … | |
| 875 | 870 | p_input->stream.p_selected_program->b_is_ok = 1; |
|---|
| 876 | 871 | vlc_mutex_unlock( &p_input->stream.stream_lock ); |
|---|
| 877 | | #if 0 |
|---|
| 878 | | DumpAudio = fopen( "tmp.mp3", "w+" ); |
|---|
| 879 | | #endif |
|---|
| 880 | 872 | |
|---|
| 881 | 873 | return( 0 ); |
|---|
| … | … | |
| 883 | 875 | |
|---|
| 884 | 876 | |
|---|
| 885 | | /***************************************************************************** |
|---|
| 886 | | * AVIEnd: frees unused data |
|---|
| 887 | | *****************************************************************************/ |
|---|
| 888 | | static void AVIEnd( input_thread_t *p_input ) |
|---|
| 889 | | { |
|---|
| 890 | | #if 0 |
|---|
| 891 | | fclose( DumpAudio ); |
|---|
| 892 | | #endif |
|---|
| 893 | | __AVIFreeDemuxData( p_input ); |
|---|
| 894 | | return; |
|---|
| 895 | | } |
|---|
| | 877 | |
|---|
| 896 | 878 | |
|---|
| 897 | 879 | |
|---|
| … | … | |
| 904 | 886 | mtime_t i_pts ) |
|---|
| 905 | 887 | { |
|---|
| 906 | | return( (mtime_t)((double)i_pts * |
|---|
| 907 | | (double)p_info->header.i_rate / |
|---|
| 908 | | (double)p_info->header.i_scale / |
|---|
| 909 | | (double)1000000.0 ) ); |
|---|
| | 888 | return( (mtime_t)((s64)i_pts * |
|---|
| | 889 | (s64)p_info->header.i_rate / |
|---|
| | 890 | (s64)p_info->header.i_scale / |
|---|
| | 891 | (s64)1000000 ) ); |
|---|
| 910 | 892 | } |
|---|
| 911 | 893 | static inline mtime_t AVI_PTSToByte( AVIStreamInfo_t *p_info, |
|---|
| 912 | 894 | mtime_t i_pts ) |
|---|
| 913 | 895 | { |
|---|
| 914 | | return( (mtime_t)((double)i_pts * |
|---|
| 915 | | (double)p_info->header.i_samplesize * |
|---|
| 916 | | (double)p_info->header.i_rate / |
|---|
| 917 | | (double)p_info->header.i_scale / |
|---|
| 918 | | (double)1000000.0 ) ); |
|---|
| | 896 | return( (mtime_t)((s64)i_pts * |
|---|
| | 897 | (s64)p_info->header.i_samplesize * |
|---|
| | 898 | (s64)p_info->header.i_rate / |
|---|
| | 899 | (s64)p_info->header.i_scale / |
|---|
| | 900 | (s64)1000000 ) ); |
|---|
| 919 | 901 | |
|---|
| 920 | 902 | } |
|---|
| … | … | |
| 925 | 907 | if( p_info->header.i_samplesize != 0 ) |
|---|
| 926 | 908 | { |
|---|
| 927 | | return( (mtime_t)( (double)1000000.0 * |
|---|
| 928 | | (double)(p_info->p_index[p_info->i_idxposc].i_lengthtotal + |
|---|
| | 909 | return( (mtime_t)( (s64)1000000 * |
|---|
| | 910 | (s64)(p_info->p_index[p_info->i_idxposc].i_lengthtotal + |
|---|
| 929 | 911 | p_info->i_idxposb )* |
|---|
| 930 | | (double)p_info->header.i_scale / |
|---|
| 931 | | (double)p_info->header.i_rate / |
|---|
| 932 | | (double)p_info->header.i_samplesize ) ); |
|---|
| 933 | | } |
|---|
| 934 | | else |
|---|
| 935 | | { |
|---|
| 936 | | return( (mtime_t)( (double)1000000.0 * |
|---|
| 937 | | (double)(p_info->i_idxposc ) * |
|---|
| 938 | | (double)p_info->header.i_scale / |
|---|
| 939 | | (double)p_info->header.i_rate) ); |
|---|
| | 912 | (s64)p_info->header.i_scale / |
|---|
| | 913 | (s64)p_info->header.i_rate / |
|---|
| | 914 | (s64)p_info->header.i_samplesize ) ); |
|---|
| | 915 | } |
|---|
| | 916 | else |
|---|
| | 917 | { |
|---|
| | 918 | return( (mtime_t)( (s64)1000000 * |
|---|
| | 919 | (s64)(p_info->i_idxposc ) * |
|---|
| | 920 | (s64)p_info->header.i_scale / |
|---|
| | 921 | (s64)p_info->header.i_rate) ); |
|---|
| 940 | 922 | } |
|---|
| 941 | 923 | } |
|---|
| … | … | |
| 1035 | 1017 | { |
|---|
| 1036 | 1018 | if( ( p_info->p_pes_first->i_posc == p_info->i_idxposc ) |
|---|
| 1037 | | /* &&( p_info->i_idxposb == p_info->p_pes_first->i_posb ) ) */ |
|---|
| 1038 | 1019 | &&( p_info->i_idxposb >= p_info->p_pes_first->i_posb ) |
|---|
| 1039 | | &&( p_info->i_idxposb < p_info->p_pes_first->i_posb + p_info->p_pes_first->p_pes->i_pes_size ) ) |
|---|
| | 1020 | &&( p_info->i_idxposb < p_info->p_pes_first->i_posb + |
|---|
| | 1021 | p_info->p_pes_first->p_pes->i_pes_size ) ) |
|---|
| 1040 | 1022 | |
|---|
| 1041 | 1023 | { |
|---|
| … | … | |
| 1052 | 1034 | if( p_other ) |
|---|
| 1053 | 1035 | { |
|---|
| 1054 | | i_other_ck = p_other->p_pes_last ? p_other->p_pes_last->i_posc : p_other->i_idxposc - 1; |
|---|
| | 1036 | i_other_ck = p_other->p_pes_last ? p_other->p_pes_last->i_posc : |
|---|
| | 1037 | p_other->i_idxposc - 1; |
|---|
| 1055 | 1038 | } |
|---|
| 1056 | 1039 | else |
|---|
| … | … | |
| 1186 | 1169 | // msg_Dbg( p_input, "ck: %4.4s", &p_ck->i_id ); |
|---|
| 1187 | 1170 | if( ( i >= p_avi_demux->i_streams ) |
|---|
| 1188 | | ||(__AVI_GetESTypeFromTwoCC( i_type ) != p_info_i->i_cat ) ) |
|---|
| | 1171 | ||(AVI_GetESTypeFromTwoCC( i_type ) != p_info_i->i_cat ) ) |
|---|
| 1189 | 1172 | { |
|---|
| 1190 | 1173 | if( RIFF_NextChunk( p_input, p_avi_demux->p_movi ) != 0 ) |
|---|
| … | … | |
| 1425 | 1408 | } |
|---|
| 1426 | 1409 | } |
|---|
| 1427 | | #if 0 |
|---|
| 1428 | | fwrite( p_data->p_payload_start, 1, i_count, DumpAudio ); |
|---|
| 1429 | | #endif |
|---|
| 1430 | 1410 | return( p_pes ); |
|---|
| 1431 | 1411 | } |
|---|
| … | … | |
| 1510 | 1490 | #define p_info_video p_avi_demux->p_info_video |
|---|
| 1511 | 1491 | #define p_info_audio p_avi_demux->p_info_audio |
|---|
| 1512 | | if( ( p_info_video )&&( p_info_audio ) ) |
|---|
| 1513 | | { |
|---|
| 1514 | | /* now resynch audio video video */ |
|---|
| 1515 | | /*don't care of AVIF_KEYFRAME */ |
|---|
| 1516 | | if( !p_info_audio->header.i_samplesize ) |
|---|
| 1517 | | { |
|---|
| 1518 | | int i_chunk = AVI_PTSToChunk( p_info_audio, |
|---|
| 1519 | | AVI_GetPTS( p_info_video )); |
|---|
| 1520 | | |
|---|
| 1521 | | AVI_SetStreamChunk( p_input, |
|---|
| 1522 | | p_info_audio, |
|---|
| 1523 | | i_chunk ); |
|---|
| 1524 | | } |
|---|
| 1525 | | else |
|---|
| 1526 | | { |
|---|
| 1527 | | int i_byte = AVI_PTSToByte( p_info_audio, |
|---|
| 1528 | | AVI_GetPTS( p_info_video ) ) ; |
|---|
| 1529 | | AVI_SetStreamBytes( p_input, |
|---|
| 1530 | | p_info_audio, |
|---|
| 1531 | | i_byte ); |
|---|
| 1532 | | } |
|---|
| 1533 | | } |
|---|
| | 1492 | if( ( !p_info_audio )||( !p_info_video ) ) |
|---|
| | 1493 | { |
|---|
| | 1494 | return; |
|---|
| | 1495 | } |
|---|
| | 1496 | /* now resynch audio video video */ |
|---|
| | 1497 | /*don't care of AVIF_KEYFRAME */ |
|---|
| | 1498 | if( !p_info_audio->header.i_samplesize ) |
|---|
| | 1499 | { |
|---|
| | 1500 | AVI_SetStreamChunk( p_input, |
|---|
| | 1501 | p_info_audio, |
|---|
| | 1502 | AVI_PTSToChunk( p_info_audio, |
|---|
| | 1503 | AVI_GetPTS( p_info_video ) ) ); |
|---|
| | 1504 | } |
|---|
| | 1505 | else |
|---|
| | 1506 | { |
|---|
| | 1507 | AVI_SetStreamBytes( p_input, |
|---|
| | 1508 | p_info_audio, |
|---|
| | 1509 | AVI_PTSToByte( p_info_audio, |
|---|
| | 1510 | AVI_GetPTS( p_info_video ) ) ); |
|---|
| | 1511 | } |
|---|
| 1534 | 1512 | #undef p_info_video |
|---|
| 1535 | 1513 | #undef p_info_audio |
|---|
| … | … | |
| 1614 | 1592 | /* input_decode want only one pes, but AVI_GetFrameInPES give |
|---|
| 1615 | 1593 | multiple pes so send one by one */ |
|---|
| 1616 | | /* we now that p_info != NULL */ |
|---|
| 1617 | 1594 | while( p_pes ) |
|---|
| 1618 | 1595 | { |
|---|
| … | … | |
| 1633 | 1610 | * Returns -1 in case of error, 0 in case of EOF, 1 otherwise |
|---|
| 1634 | 1611 | *****************************************************************************/ |
|---|
| | 1612 | |
|---|
| 1635 | 1613 | static int AVIDemux( input_thread_t *p_input ) |
|---|
| 1636 | 1614 | { |
|---|
| … | … | |
| 1652 | 1630 | { |
|---|
| 1653 | 1631 | if( ( p_avi_demux->pp_info[i]->i_cat == VIDEO_ES ) |
|---|
| 1654 | | &&( p_avi_demux->pp_info[i]->p_es->p_decoder_fifo != NULL ) ) |
|---|
| | 1632 | &&( p_avi_demux->pp_info[i]->p_es->p_decoder_fifo ) ) |
|---|
| 1655 | 1633 | { |
|---|
| 1656 | 1634 | p_avi_demux->p_info_video = p_avi_demux->pp_info[i]; |
|---|
| … | … | |
| 1667 | 1645 | { |
|---|
| 1668 | 1646 | if( ( p_avi_demux->pp_info[i]->i_cat == AUDIO_ES ) |
|---|
| 1669 | | &&( p_avi_demux->pp_info[i]->p_es->p_decoder_fifo != NULL ) ) |
|---|
| | 1647 | &&( p_avi_demux->pp_info[i]->p_es->p_decoder_fifo ) ) |
|---|
| 1670 | 1648 | { |
|---|
| 1671 | 1649 | p_avi_demux->p_info_audio = p_avi_demux->pp_info[i]; |
|---|
| … | … | |
| 1737 | 1715 | input_ClockManageRef( p_input, |
|---|
| 1738 | 1716 | p_input->stream.p_selected_program, |
|---|
| 1739 | | p_avi_demux->i_pcr ); |
|---|
| | 1717 | p_avi_demux->i_pcr /*- DEFAULT_PTS_DELAY / 2 */); |
|---|
| 1740 | 1718 | /* calculate pcr, time when we must read the next data */ |
|---|
| 1741 | 1719 | /* 9/100 kludge ->need to convert to 1/1000000 clock unit to 1/90000 */ |
|---|
| … | … | |
| 1775 | 1753 | return( p_pes ? 1 : 0 ); |
|---|
| 1776 | 1754 | |
|---|
| 1777 | | /* return( p_info_master->i_idxposc > p_info_master->i_idxnb ? 0 : 1 );*/ |
|---|
| 1778 | | } |
|---|
| 1779 | | |
|---|
| | 1755 | } |
|---|
| | 1756 | |
|---|