Commit 75424d35 authored by Sam Hocevar's avatar Sam Hocevar

* src/input/input_ext-plugins.c, src/input/input_ext-intf.c: boundary checks

    on seek.
parent be685831
......@@ -2,7 +2,7 @@
* input_ext-intf.c: services to the interface
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ext-intf.c,v 1.35 2002/03/05 17:46:33 stef Exp $
* $Id: input_ext-intf.c,v 1.36 2002/05/21 00:23:37 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -130,10 +130,18 @@ void input_Seek( input_thread_t * p_input, off_t i_position )
char psz_time2[OFFSETTOTIME_MAX_SIZE];
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_seek = i_position;
if( i_position < 0 )
{
i_position = 0;
}
else if( i_position >= p_input->stream.p_selected_area->i_size )
{
i_position = p_input->stream.p_selected_area->i_size;
}
intf_WarnMsg( 3, "input: seeking position %lld/%lld (%s/%s)", i_position,
p_input->stream.p_selected_area->i_size,
p_input->stream.p_selected_area->i_seek = i_position;
intf_WarnMsg( 3, "input: seeking position %lld/%lld (%s/%s)",
i_position, p_input->stream.p_selected_area->i_size,
input_OffsetToTime( p_input, psz_time1, i_position ),
input_OffsetToTime( p_input, psz_time2,
p_input->stream.p_selected_area->i_size ) );
......
......@@ -2,7 +2,7 @@
* input_ext-plugins.c: useful functions for access and demux plug-ins
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: input_ext-plugins.c,v 1.9 2002/05/18 17:47:47 sam Exp $
* $Id: input_ext-plugins.c,v 1.10 2002/05/21 00:23:37 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -790,13 +790,25 @@ ssize_t input_FDNetworkRead( input_thread_t * p_input, byte_t * p_buffer,
*****************************************************************************/
void input_FDSeek( input_thread_t * p_input, off_t i_pos )
{
#define S p_input->stream
input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
lseek( p_access_data->i_handle, i_pos, SEEK_SET );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_tell = i_pos;
vlc_mutex_unlock( &p_input->stream.stream_lock );
vlc_mutex_lock( &S.stream_lock );
S.p_selected_area->i_tell = i_pos;
if( S.p_selected_area->i_tell > S.p_selected_area->i_size )
{
intf_ErrMsg( "input error: seeking too far" );
S.p_selected_area->i_tell = S.p_selected_area->i_size;
}
else if( S.p_selected_area->i_tell < 0 )
{
intf_ErrMsg( "input error: seeking too early" );
S.p_selected_area->i_tell = 0;
}
vlc_mutex_unlock( &S.stream_lock );
#undef S
}
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