Changeset 308d7c4354df86074583e4635cde5cfbb705e00c

Show
Ignore:
Timestamp:
15/10/06 20:00:01 (2 years ago)
Author:
Derk-Jan Hartman <hartman@videolan.org>
git-committer:
Derk-Jan Hartman <hartman@videolan.org> 1160935201 +0000
git-parent:

[9cd8ee7b4ee1f29fc1c0d584be813b4130492246]

git-author:
Derk-Jan Hartman <hartman@videolan.org> 1160935201 +0000
Message:

*demux/asf Support for dvr-ms ASF. This is a a priorietary extension to ASF that allows Media Center to store MPEG2 in ASF.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/asf/asf.c

    r7f779f6 r308d7c4  
    708708            fmt.video.i_height= GetDWLE( p_data + 8 ); 
    709709 
     710 
     711            if( fmt.i_codec == VLC_FOURCC( 'D','V','R',' ') ) 
     712            { 
     713                /* DVR-MS special ASF */ 
     714                fmt.i_codec = VLC_FOURCC( 'm','p','g','2' ) ; 
     715                fmt.b_packetized = VLC_FALSE; 
     716            } 
     717 
    710718            if( p_sp->i_type_specific_data_length > 11 + 
    711719                sizeof( BITMAPINFOHEADER ) ) 
     
    759767                     p_sp->i_stream_number ); 
    760768        } 
     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        } 
    761816        else 
    762817        { 
  • modules/demux/asf/libasf.h

    r2e0102d r308d7c4  
    120120{0xD2D0A440, 0xE307, 0x11D2, {0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50}}; 
    121121 
     122static const guid_t asf_object_extended_stream_header =  
     123{0x3afb65e2, 0x47ef, 0x40f2, { 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43}}; 
     124 
     125static const guid_t asf_object_extended_stream_type_audio = 
     126{0x31178c9d, 0x03e1, 0x4528, { 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03}}; 
     127 
    122128#define ASF_OBJECT_COMMON          \ 
    123129    int          i_type;           \