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,35 +286,19 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -288,35 +286,19 @@ 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_sys->i_nb_reads++;
if( p_access->info.i_size != 0 &&
(p_sys->i_nb_reads % INPUT_FSTAT_NB_READS) == 0 &&
p_sys->b_local )
{
gnome_vfs_file_info_clear( p_sys->p_file_info );
i_ret = gnome_vfs_get_file_info_from_handle( p_sys->p_handle,
p_sys->p_file_info, 8 );
if( i_ret )
{
msg_Warn( p_access, "couldn't get file properties again (%s)",
gnome_vfs_result_to_string( i_ret ) );
}
else
{
p_access->info.i_size = (int64_t)(p_sys->p_file_info->size);
}
}
}
p_access->info.i_pos += (int64_t)i_read_len; p_access->info.i_pos += (int64_t)i_read_len;
if( p_access->info.i_pos >= p_access->info.i_size
/* Some Acces (http) never return EOF and loop on the file */ && p_access->info.i_size != 0 && p_sys->b_local )
if( p_access->info.i_pos > p_access->info.i_size )
{ {
p_access->info.b_eof = true; gnome_vfs_file_info_clear( p_sys->p_file_info );
return 0; i_ret = gnome_vfs_get_file_info_from_handle( p_sys->p_handle,
p_sys->p_file_info, 8 );
if( i_ret )
msg_Warn( p_access, "couldn't get file properties again (%s)",
gnome_vfs_result_to_string( i_ret ) );
else
p_access->info.i_size = (int64_t)(p_sys->p_file_info->size);
} }
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