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