}
else if( ( i_id&0xff ) == 0x70 )
{
- es_format_Init( &tk->fmt, SPU_ES, VLC_FOURCC('o','g','t',' ') );
+ es_format_Init( &tk->fmt, SPU_ES, VLC_CODEC_OGT );
}
else if( ( i_id&0xfc ) == 0x00 )
{
- es_format_Init( &tk->fmt, SPU_ES, VLC_FOURCC('c','v','d',' ') );
+ es_format_Init( &tk->fmt, SPU_ES, VLC_CODEC_CVD );
}
else if( ( i_id&0xff ) == 0x10 )
{
return p_pkt->p_buffer[3];
}
-/* return the size of the next packet
- * You need to give him at least 14 bytes (and it need to start as a
- * valid packet) It does not handle less than 6 bytes */
+/* return the size of the next packet */
static inline int ps_pkt_size( const uint8_t *p, int i_peek )
{
- assert( i_peek >= 6 );
- if( p[3] == 0xb9 && i_peek >= 4 )
+ if( unlikely(i_peek < 4) )
+ {
+ return -1;
+ }
+ else if( p[3] == 0xb9 )
{
return 4;
}
else if( p[3] == 0xba )
{
- if( (p[4] >> 6) == 0x01 && i_peek >= 14 )
+ if( i_peek >= 14 && (p[4] >> 6) == 0x01 )
{
return 14 + (p[13]&0x07);
}
- else if( (p[4] >> 4) == 0x02 && i_peek >= 12 )
+ else if( i_peek >= 12 && (p[4] >> 4) == 0x02 )
{
return 12;
}
{
int i_buffer = p_pkt->i_buffer;
uint8_t *p_buffer = p_pkt->p_buffer;
- int i_length, i_version, i_info_length, i_esm_length, i_es_base;
+ int i_length, i_version, i_info_length, i_es_base;
if( !p_psm || p_buffer[3] != 0xbc ) return VLC_EGENERIC;
if( i_info_length + 10 > i_length ) return VLC_EGENERIC;
/* Elementary stream map */
- i_esm_length = (uint16_t)(p_buffer[ 10 + i_info_length ] << 8) +
- p_buffer[ 11 + i_info_length];
+ /* int i_esm_length = (uint16_t)(p_buffer[ 10 + i_info_length ] << 8) +
+ p_buffer[ 11 + i_info_length]; */
i_es_base = 12 + i_info_length;
while( i_es_base + 4 < i_length )
if( ps_track_fill( &tk_tmp, p_psm, tk[i].i_id ) != VLC_SUCCESS )
continue;
- if( tk_tmp.fmt.i_codec == tk[i].fmt.i_codec ) continue;
+ if( tk_tmp.fmt.i_codec == tk[i].fmt.i_codec )
+ {
+ es_format_Clean( &tk_tmp.fmt );
+ continue;
+ }
es_out_Del( out, tk[i].es );
+ es_format_Clean( &tk[i].fmt );
+
tk[i] = tk_tmp;
tk[i].b_seen = true;
tk[i].es = es_out_Add( out, &tk[i].fmt );