Commit 553ed228 authored by Laurent Aimar's avatar Laurent Aimar

Fixed syntax for VC1 coming from some ASF (packetizer).

The sequence header/entry point are not repeated yet.
parent 43d9cf9d
......@@ -89,6 +89,7 @@ struct decoder_sys_t
mtime_t i_interpolated_dts;
bool b_check_startcode;
};
typedef enum
......@@ -151,6 +152,7 @@ static int Open( vlc_object_t *p_this )
p_sys->pp_last = &p_sys->p_frame;
p_sys->i_interpolated_dts = -1;
p_sys->b_check_startcode = p_dec->fmt_in.b_packetized;
if( p_dec->fmt_out.i_extra > 0 )
{
......@@ -193,7 +195,37 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
return packetizer_Packetize( &p_sys->packetizer, pp_block );
if( p_sys->b_check_startcode && pp_block && *pp_block )
{
/* Fix syntax for (some?) VC1 from asf */
const int i_startcode = sizeof(p_vc1_startcode);
block_t *p_block = *pp_block;
if( p_block->i_buffer > 0 &&
( p_block->i_buffer < i_startcode ||
memcmp( p_block->p_buffer, p_vc1_startcode, i_startcode ) ) )
{
*pp_block = p_block = block_Realloc( p_block, i_startcode+1, p_block->i_buffer );
if( p_block )
{
memcpy( p_block->p_buffer, p_vc1_startcode, i_startcode );
if( p_sys->b_sequence_header && p_sys->sh.b_interlaced &&
p_block->i_buffer > i_startcode+1 &&
(p_block->p_buffer[i_startcode+1] & 0xc0) == 0xc0 )
p_block->p_buffer[i_startcode] = IDU_TYPE_FIELD;
else
p_block->p_buffer[i_startcode] = IDU_TYPE_FRAME;
}
}
p_sys->b_check_startcode = false;
}
block_t *p_au = packetizer_Packetize( &p_sys->packetizer, pp_block );
if( !p_au )
p_sys->b_check_startcode = p_dec->fmt_in.b_packetized;
return p_au;
}
static void PacketizeReset( void *p_private, bool b_broken )
......
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