Commit 308d7c43 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

*demux/asf Support for dvr-ms ASF. This is a a priorietary extension to ASF...

*demux/asf Support for dvr-ms ASF. This is a a priorietary extension to ASF that allows Media Center to store MPEG2 in ASF.
parent 9cd8ee7b
...@@ -707,6 +707,14 @@ static int DemuxInit( demux_t *p_demux ) ...@@ -707,6 +707,14 @@ static int DemuxInit( demux_t *p_demux )
fmt.video.i_width = GetDWLE( p_data + 4 ); fmt.video.i_width = GetDWLE( p_data + 4 );
fmt.video.i_height= GetDWLE( p_data + 8 ); fmt.video.i_height= GetDWLE( p_data + 8 );
if( fmt.i_codec == VLC_FOURCC( 'D','V','R',' ') )
{
/* DVR-MS special ASF */
fmt.i_codec = VLC_FOURCC( 'm','p','g','2' ) ;
fmt.b_packetized = VLC_FALSE;
}
if( p_sp->i_type_specific_data_length > 11 + if( p_sp->i_type_specific_data_length > 11 +
sizeof( BITMAPINFOHEADER ) ) sizeof( BITMAPINFOHEADER ) )
{ {
...@@ -758,6 +766,53 @@ static int DemuxInit( demux_t *p_demux ) ...@@ -758,6 +766,53 @@ static int DemuxInit( demux_t *p_demux )
msg_Dbg( p_demux, "added new video stream(ID:%d)", msg_Dbg( p_demux, "added new video stream(ID:%d)",
p_sp->i_stream_number ); p_sp->i_stream_number );
} }
else if( ASF_CmpGUID( &p_sp->i_stream_type, &asf_object_extended_stream_header ) &&
p_sp->i_type_specific_data_length >= 64 )
{
/* Now follows a 64 byte header of which we don't know much */
es_format_t fmt;
guid_t *p_ref = (guid_t *)p_sp->p_type_specific_data;
uint8_t *p_data = p_sp->p_type_specific_data + 64;
unsigned int i_data = p_sp->i_type_specific_data_length - 64;
msg_Dbg( p_demux, "Ext stream header detected. datasize = %d", p_sp->i_type_specific_data_length );
if( ASF_CmpGUID( p_ref, &asf_object_extended_stream_type_audio ) &&
i_data >= sizeof( WAVEFORMATEX ) - 2)
{
int i_format;
es_format_Init( &fmt, AUDIO_ES, 0 );
i_format = GetWLE( &p_data[0] );
if( i_format == 0 )
fmt.i_codec = VLC_FOURCC( 'a','5','2',' ');
else
wf_tag_to_fourcc( i_format, &fmt.i_codec, NULL );
fmt.audio.i_channels = GetWLE( &p_data[2] );
fmt.audio.i_rate = GetDWLE( &p_data[4] );
fmt.i_bitrate = GetDWLE( &p_data[8] ) * 8;
fmt.audio.i_blockalign = GetWLE( &p_data[12] );
fmt.audio.i_bitspersample = GetWLE( &p_data[14] );
fmt.b_packetized = VLC_TRUE;
if( p_sp->i_type_specific_data_length > sizeof( WAVEFORMATEX ) &&
i_format != WAVE_FORMAT_MPEGLAYER3 &&
i_format != WAVE_FORMAT_MPEG )
{
fmt.i_extra = __MIN( GetWLE( &p_data[16] ),
p_sp->i_type_specific_data_length -
sizeof( WAVEFORMATEX ) );
fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, &p_data[sizeof( WAVEFORMATEX )],
fmt.i_extra );
}
tk->i_cat = AUDIO_ES;
tk->p_es = es_out_Add( p_demux->out, &fmt );
es_format_Clean( &fmt );
msg_Dbg( p_demux, "added new audio stream (codec:0x%x,ID:%d)",
i_format, p_sp->i_stream_number );
}
}
else else
{ {
tk->i_cat = UNKNOWN_ES; tk->i_cat = UNKNOWN_ES;
......
...@@ -119,6 +119,12 @@ static const guid_t asf_object_stream_prioritization = ...@@ -119,6 +119,12 @@ static const guid_t asf_object_stream_prioritization =
static const guid_t asf_object_extended_content_description = static const guid_t asf_object_extended_content_description =
{0xD2D0A440, 0xE307, 0x11D2, {0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50}}; {0xD2D0A440, 0xE307, 0x11D2, {0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50}};
static const guid_t asf_object_extended_stream_header =
{0x3afb65e2, 0x47ef, 0x40f2, { 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43}};
static const guid_t asf_object_extended_stream_type_audio =
{0x31178c9d, 0x03e1, 0x4528, { 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03}};
#define ASF_OBJECT_COMMON \ #define ASF_OBJECT_COMMON \
int i_type; \ int i_type; \
guid_t i_object_id; \ guid_t i_object_id; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment