+ /* extra data ? */
+ if( (header[0]&0x0f) != 0x0 )
+ {
+ uint8_t aux[6];
+ int i_aux;
+ vlc_fourcc_t fcc;
+ if( stream_Read( p_demux->s, aux, 6 ) < 6 )
+ {
+ msg_Warn( p_demux, "cannot read" );
+ return 0;
+ }
+ i_aux = GetWLE( aux );
+ fcc = VLC_FOURCC( aux[2], aux[3], aux[4], aux[5] );
+
+ msg_Dbg( p_demux, "Belekas: %d - size=%d fcc=%4.4s",
+ header[0]&0xf, i_aux, (char*)&fcc );
+
+ if( fcc == VLC_FOURCC( 'S', 'U', 'B', 'T' ) && i_aux > 2 )
+ {
+ if( p_sys->p_sub == NULL )
+ {
+ p_sys->fmt_sub.i_codec = VLC_FOURCC( 's', 'u', 'b', 't' );
+ p_sys->p_sub = es_out_Add( p_demux->out, &p_sys->fmt_sub );
+ es_out_Control( p_demux->out, ES_OUT_SET_ES, p_sys->p_sub );
+ }
+ stream_Read( p_demux->s, NULL, 2 );
+
+ if( ( p_frame = stream_Block( p_demux->s, i_aux - 2 ) ) )
+ {
+ uint8_t *p = p_frame->p_buffer;
+
+ while( p < &p_frame->p_buffer[p_frame->i_buffer] && *p != 0 )
+ {
+ p++;
+ }
+ if( *p == 0 && p + 1 < &p_frame->p_buffer[p_frame->i_buffer] )
+ {
+ p_frame->i_buffer -= p + 1 - p_frame->p_buffer;
+ p_frame->p_buffer = p + 1;
+ }
+
+ /* Skip the first part (it is the language name) */
+ p_frame->i_pts = p_sys->i_pcr;
+ p_frame->i_dts = p_sys->i_pcr + 4000000; /* 4s */
+
+ es_out_Send( p_demux->out, p_sys->p_sub, p_frame );
+ }
+ }
+ else
+ {
+ /* We skip this extra data */
+ if( stream_Read( p_demux->s, NULL, i_aux ) < i_aux )
+ {
+ msg_Warn( p_demux, "cannot read" );
+ return 0;
+ }
+ }
+ i_size -= 6 + i_aux;
+ }
+