- } while( i_size );
-
- return( i_count );
-}
-
-static int SeekAbsolute( input_thread_t *p_input,
- off_t i_pos)
-{
- int i_skip;
-
- i_skip = i_pos - TellAbsolute( p_input );
- if( i_skip == 0 )
- {
- return( VLC_SUCCESS );
- }
- if( i_skip < 0 && !p_input->stream.b_seekable )
- {
- return( VLC_EGENERIC );
- }
- else if( !p_input->stream.b_seekable ||
- ( i_skip > 0 && i_skip < 1024 && p_input->stream.i_method != INPUT_METHOD_FILE ) )
- {
- while( i_skip > 0 )
- {
- uint8_t dummy[1024];
- int i_read;
-
- i_read = ReadData( p_input, dummy, __MIN( i_skip, 1024 ) );
- if( i_read <= 0 )
- {
- return( VLC_EGENERIC );
- }
- i_skip -= i_read;
- }
- return( VLC_SUCCESS );
- }
- else
- {
- input_AccessReinit( p_input );
- p_input->pf_seek( p_input, i_pos );
- return( VLC_SUCCESS );
- }
-}
-
-static int SkipBytes( input_thread_t *p_input, int i_skip )
-{
- return( SeekAbsolute( p_input, TellAbsolute( p_input ) + i_skip ) );
-}
-
-static int ReadPES( input_thread_t *p_input,
- pes_packet_t **pp_pes,
- int i_size )
-{
- pes_packet_t *p_pes;
-
- *pp_pes = NULL;
-
- if( !(p_pes = input_NewPES( p_input->p_method_data )) )
- {
- msg_Err( p_input, "cannot allocate new PES" );
- return( VLC_EGENERIC );
- }
-
- while( i_size > 0 )