+ if( i_type == META_STREAMINFO && !*pp_streaminfo )
+ {
+ if( i_len != (STREAMINFO_SIZE - 4) ) {
+ msg_Err( p_demux, "invalid size %d for a STREAMINFO metadata block", i_len );
+ return VLC_EGENERIC;
+ }
+ i_peek = stream_Peek( p_demux->s, &p_peek, STREAMINFO_SIZE);
+ if( i_peek == STREAMINFO_SIZE)
+
+ *pi_streaminfo = STREAMINFO_SIZE + 4;
+ *pp_streaminfo = malloc( STREAMINFO_SIZE + 4 );
+ if( *pp_streaminfo == NULL )
+ return VLC_EGENERIC;
+
+ if( stream_Read( p_demux->s, &(*pp_streaminfo)[4], STREAMINFO_SIZE ) != STREAMINFO_SIZE )
+ {
+ msg_Err( p_demux, "failed to read STREAMINFO metadata block" );
+ free( *pp_streaminfo );
+ return VLC_EGENERIC;
+ }
+
+ memcpy(*pp_streaminfo, marker, 4);
+
+ /* */
+ ParseStreamInfo( &i_sample_rate, &i_sample_count, *pp_streaminfo );
+ if( i_sample_rate > 0 )
+ p_sys->i_length = i_sample_count * INT64_C(1000000)/i_sample_rate;
+ }
+ else if( i_type == META_SEEKTABLE )