| | 769 | else if( ASF_CmpGUID( &p_sp->i_stream_type, &asf_object_extended_stream_header ) && |
|---|
| | 770 | p_sp->i_type_specific_data_length >= 64 ) |
|---|
| | 771 | { |
|---|
| | 772 | /* Now follows a 64 byte header of which we don't know much */ |
|---|
| | 773 | es_format_t fmt; |
|---|
| | 774 | guid_t *p_ref = (guid_t *)p_sp->p_type_specific_data; |
|---|
| | 775 | uint8_t *p_data = p_sp->p_type_specific_data + 64; |
|---|
| | 776 | unsigned int i_data = p_sp->i_type_specific_data_length - 64; |
|---|
| | 777 | |
|---|
| | 778 | msg_Dbg( p_demux, "Ext stream header detected. datasize = %d", p_sp->i_type_specific_data_length ); |
|---|
| | 779 | if( ASF_CmpGUID( p_ref, &asf_object_extended_stream_type_audio ) && |
|---|
| | 780 | i_data >= sizeof( WAVEFORMATEX ) - 2) |
|---|
| | 781 | { |
|---|
| | 782 | int i_format; |
|---|
| | 783 | es_format_Init( &fmt, AUDIO_ES, 0 ); |
|---|
| | 784 | i_format = GetWLE( &p_data[0] ); |
|---|
| | 785 | if( i_format == 0 ) |
|---|
| | 786 | fmt.i_codec = VLC_FOURCC( 'a','5','2',' '); |
|---|
| | 787 | else |
|---|
| | 788 | wf_tag_to_fourcc( i_format, &fmt.i_codec, NULL ); |
|---|
| | 789 | fmt.audio.i_channels = GetWLE( &p_data[2] ); |
|---|
| | 790 | fmt.audio.i_rate = GetDWLE( &p_data[4] ); |
|---|
| | 791 | fmt.i_bitrate = GetDWLE( &p_data[8] ) * 8; |
|---|
| | 792 | fmt.audio.i_blockalign = GetWLE( &p_data[12] ); |
|---|
| | 793 | fmt.audio.i_bitspersample = GetWLE( &p_data[14] ); |
|---|
| | 794 | fmt.b_packetized = VLC_TRUE; |
|---|
| | 795 | |
|---|
| | 796 | if( p_sp->i_type_specific_data_length > sizeof( WAVEFORMATEX ) && |
|---|
| | 797 | i_format != WAVE_FORMAT_MPEGLAYER3 && |
|---|
| | 798 | i_format != WAVE_FORMAT_MPEG ) |
|---|
| | 799 | { |
|---|
| | 800 | fmt.i_extra = __MIN( GetWLE( &p_data[16] ), |
|---|
| | 801 | p_sp->i_type_specific_data_length - |
|---|
| | 802 | sizeof( WAVEFORMATEX ) ); |
|---|
| | 803 | fmt.p_extra = malloc( fmt.i_extra ); |
|---|
| | 804 | memcpy( fmt.p_extra, &p_data[sizeof( WAVEFORMATEX )], |
|---|
| | 805 | fmt.i_extra ); |
|---|
| | 806 | } |
|---|
| | 807 | |
|---|
| | 808 | tk->i_cat = AUDIO_ES; |
|---|
| | 809 | tk->p_es = es_out_Add( p_demux->out, &fmt ); |
|---|
| | 810 | es_format_Clean( &fmt ); |
|---|
| | 811 | |
|---|
| | 812 | msg_Dbg( p_demux, "added new audio stream (codec:0x%x,ID:%d)", |
|---|
| | 813 | i_format, p_sp->i_stream_number ); |
|---|
| | 814 | } |
|---|
| | 815 | } |
|---|