Commit 9139b342 authored by Laurent Aimar's avatar Laurent Aimar

Forged a TTA1 header in matroska if not present.

parent a1fa3487
...@@ -989,10 +989,30 @@ bool matroska_segment_c::Select( mtime_t i_start_time ) ...@@ -989,10 +989,30 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
} }
else if( !strcmp( tracks[i_track]->psz_codec, "A_TTA1" ) ) else if( !strcmp( tracks[i_track]->psz_codec, "A_TTA1" ) )
{ {
tracks[i_track]->fmt.i_codec = VLC_CODEC_TTA; p_fmt->i_codec = VLC_CODEC_TTA;
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data; p_fmt->i_extra = p_tk->i_extra_data;
tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data ); if( p_fmt->i_extra > 0 )
memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data ); {
p_fmt->p_extra = malloc( p_tk->i_extra_data );
if( !p_fmt->p_extra )
abort();
memcpy( p_fmt->p_extra, p_tk->p_extra_data, p_tk->i_extra_data );
}
else
{
p_fmt->i_extra = 30;
p_fmt->p_extra = malloc( p_fmt->i_extra );
if( !p_fmt->p_extra )
abort();
uint8_t *p_extra = (uint8_t*)p_fmt->p_extra;
memcpy( &p_extra[ 0], "TTA1", 4 );
SetWLE( &p_extra[ 4], 1 );
SetWLE( &p_extra[ 6], p_fmt->audio.i_channels );
SetWLE( &p_extra[ 8], p_fmt->audio.i_bitspersample );
SetDWLE( &p_extra[10], p_fmt->audio.i_rate );
SetDWLE( &p_extra[14], 0xffffffff );
memset( &p_extra[18], 0, 30 - 18 );
}
} }
else if( !strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/BIG" ) || else if( !strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/BIG" ) ||
!strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/LIT" ) || !strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/LIT" ) ||
......
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