#include "input_internal.h"
-#undef STREAM_DEBUG
+// #define STREAM_DEBUG 1
/* TODO:
* - tune the 2 methods (block/stream)
vlc_iconv_close( s->p_text->conv );
free( s->p_text );
}
+ free( s->psz_path );
vlc_object_release( s );
}
if( !s )
return NULL;
+ s->psz_path = strdup( p_access->psz_path );
s->p_sys = p_sys = malloc( sizeof( *p_sys ) );
- if( !p_sys )
+ if( !s->psz_path || !s->p_sys )
{
stream_CommonDelete( s );
return NULL;
if( p_sys->stream.p_buffer == NULL )
goto error;
p_sys->stream.i_used = 0;
- access_Control( p_access, ACCESS_GET_MTU,
- &p_sys->stream.i_read_size );
- if( p_sys->stream.i_read_size <= 0 )
- p_sys->stream.i_read_size = STREAM_READ_ATONCE;
- else if( p_sys->stream.i_read_size <= 256 )
- p_sys->stream.i_read_size = 256;
+ p_sys->stream.i_read_size = STREAM_READ_ATONCE;
+#if STREAM_READ_ATONCE < 256
+# error "Invalid STREAM_READ_ATONCE value"
+#endif
for( i = 0; i < STREAM_CACHE_TRACK; i++ )
{
return VLC_EGENERIC;
}
- case STREAM_GET_MTU:
- return VLC_EGENERIC;
-
case STREAM_CONTROL_ACCESS:
{
i_int = (int) va_arg( args, int );
static void AStreamPrebufferBlock( stream_t *s )
{
stream_sys_t *p_sys = s->p_sys;
- access_t *p_access = p_sys->p_access;
int64_t i_first = 0;
int64_t i_start;
}
while( p_sys->block.i_start + p_sys->block.i_size < i_pos );
- p_sys->block.i_offset = i_pos - p_sys->i_pos;
+ p_sys->block.i_offset += i_pos - p_sys->i_pos;
p_sys->i_pos = i_pos;
return VLC_SUCCESS;
static int AStreamRefillBlock( stream_t *s )
{
stream_sys_t *p_sys = s->p_sys;
- int64_t i_start, i_stop;
block_t *b;
/* Release data */
}
/* Now read a new block */
- i_start = mdate();
+ const int64_t i_start = mdate();
for( ;; )
{
bool b_eof;
return VLC_EGENERIC;
}
+ p_sys->stat.i_read_time += mdate() - i_start;
while( b )
{
- i_stop = mdate();
-
/* Append the block */
p_sys->block.i_size += b->i_buffer;
*p_sys->block.pp_last = b;
/* Update stat */
p_sys->stat.i_bytes += b->i_buffer;
- p_sys->stat.i_read_time += i_stop - i_start;
p_sys->stat.i_read_count++;
b = b->p_next;
- i_start = mdate();
}
return VLC_SUCCESS;
}
static void AStreamPrebufferStream( stream_t *s )
{
stream_sys_t *p_sys = s->p_sys;
- access_t *p_access = p_sys->p_access;
int64_t i_first = 0;
int64_t i_start;
int i_total = 0;
if( s->p_parent && s->p_parent->p_parent &&
- s->p_parent->p_parent->i_object_type == VLC_OBJECT_INPUT )
+ vlc_internals( s->p_parent->p_parent )->i_object_type == VLC_OBJECT_INPUT )
p_input = (input_thread_t *)s->p_parent->p_parent;
if( !p_sys->i_list )
int i_total = 0;
if( s->p_parent && s->p_parent->p_parent &&
- s->p_parent->p_parent->i_object_type == VLC_OBJECT_INPUT )
+ vlc_internals( s->p_parent->p_parent )->i_object_type == VLC_OBJECT_INPUT )
p_input = (input_thread_t *)s->p_parent->p_parent;
if( !p_sys->i_list )