Commit 1ed365b8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

input: remove INPUT_FSTAT_NB_READS

This was only used for INPUT_UPDATE_SIZE.
parent 2e42f024
...@@ -59,10 +59,6 @@ ...@@ -59,10 +59,6 @@
/* Used in ErrorThread */ /* Used in ErrorThread */
#define INPUT_IDLE_SLEEP (CLOCK_FREQ/10) #define INPUT_IDLE_SLEEP (CLOCK_FREQ/10)
/* Number of read() calls needed until we check the file size through
* fstat() */
#define INPUT_FSTAT_NB_READS 16
/* /*
* General limitations * General limitations
*/ */
......
...@@ -66,8 +66,6 @@ ...@@ -66,8 +66,6 @@
struct access_sys_t struct access_sys_t
{ {
unsigned int i_nb_reads;
int fd; int fd;
/* */ /* */
...@@ -222,7 +220,6 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -222,7 +220,6 @@ int FileOpen( vlc_object_t *p_this )
p_access->pf_block = NULL; p_access->pf_block = NULL;
p_access->pf_control = FileControl; p_access->pf_control = FileControl;
p_access->p_sys = p_sys; p_access->p_sys = p_sys;
p_sys->i_nb_reads = 0;
p_sys->fd = fd; p_sys->fd = fd;
if (S_ISREG (st.st_mode) || S_ISBLK (st.st_mode)) if (S_ISREG (st.st_mode) || S_ISBLK (st.st_mode))
...@@ -305,11 +302,7 @@ static ssize_t FileRead (access_t *p_access, uint8_t *p_buffer, size_t i_len) ...@@ -305,11 +302,7 @@ static ssize_t FileRead (access_t *p_access, uint8_t *p_buffer, size_t i_len)
p_access->info.i_pos += val; p_access->info.i_pos += val;
p_access->info.b_eof = !val; p_access->info.b_eof = !val;
if (p_access->info.i_pos >= p_access->info.i_size)
p_sys->i_nb_reads++;
if (!(p_sys->i_nb_reads % INPUT_FSTAT_NB_READS)
|| (p_access->info.i_pos > p_access->info.i_size))
{ {
struct stat st; struct stat st;
......
...@@ -63,7 +63,6 @@ static int Control( access_t *, int, va_list ); ...@@ -63,7 +63,6 @@ static int Control( access_t *, int, va_list );
struct access_sys_t struct access_sys_t
{ {
unsigned int i_nb_reads;
char *psz_name; char *psz_name;
GnomeVFSHandle *p_handle; GnomeVFSHandle *p_handle;
...@@ -105,7 +104,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -105,7 +104,6 @@ static int Open( vlc_object_t *p_this )
STANDARD_READ_ACCESS_INIT; STANDARD_READ_ACCESS_INIT;
p_sys->p_handle = p_handle; p_sys->p_handle = p_handle;
p_sys->i_nb_reads = 0;
p_sys->b_pace_control = true; p_sys->b_pace_control = true;
if( strcmp( "gnomevfs", p_access->psz_access ) && if( strcmp( "gnomevfs", p_access->psz_access ) &&
...@@ -288,36 +286,20 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -288,36 +286,20 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
gnome_vfs_result_to_string( i_ret ) ); gnome_vfs_result_to_string( i_ret ) );
} }
} }
else
{ p_access->info.i_pos += (int64_t)i_read_len;
p_sys->i_nb_reads++; if( p_access->info.i_pos >= p_access->info.i_size
if( p_access->info.i_size != 0 && && p_access->info.i_size != 0 && p_sys->b_local )
(p_sys->i_nb_reads % INPUT_FSTAT_NB_READS) == 0 &&
p_sys->b_local )
{ {
gnome_vfs_file_info_clear( p_sys->p_file_info ); gnome_vfs_file_info_clear( p_sys->p_file_info );
i_ret = gnome_vfs_get_file_info_from_handle( p_sys->p_handle, i_ret = gnome_vfs_get_file_info_from_handle( p_sys->p_handle,
p_sys->p_file_info, 8 ); p_sys->p_file_info, 8 );
if( i_ret ) if( i_ret )
{
msg_Warn( p_access, "couldn't get file properties again (%s)", msg_Warn( p_access, "couldn't get file properties again (%s)",
gnome_vfs_result_to_string( i_ret ) ); gnome_vfs_result_to_string( i_ret ) );
}
else else
{
p_access->info.i_size = (int64_t)(p_sys->p_file_info->size); p_access->info.i_size = (int64_t)(p_sys->p_file_info->size);
} }
}
}
p_access->info.i_pos += (int64_t)i_read_len;
/* Some Acces (http) never return EOF and loop on the file */
if( p_access->info.i_pos > p_access->info.i_size )
{
p_access->info.b_eof = true;
return 0;
}
return (int)i_read_len; return (int)i_read_len;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment