* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.86 2003/03/09 23:39:05 jlj Exp $
+ * $Id: input_ext-intf.h,v 1.87 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
disc or network */
vlc_bool_t b_pace_control; /* can we read when we want ? */
vlc_bool_t b_seekable; /* can we do lseek() ? */
- vlc_bool_t b_connected; /* does read() == 0 imply EOF ? */
/* if (b_seekable) : */
unsigned int i_area_nb;
* directory.c: expands a directory (directory: access plug-in)
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: directory.c,v 1.2 2003/03/24 01:39:58 gbazin Exp $
+ * $Id: directory.c,v 1.3 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
*
p_access_data->i_buf_pos += i_ret;
return (ssize_t) i_ret;
}
-
- p_input->stream.b_connected = VLC_TRUE;
+
return 0;
}
* -udf.* to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: access.c,v 1.11 2003/03/11 23:56:53 gbazin Exp $
+ * $Id: access.c,v 1.12 2003/03/24 17:15:29 gbazin Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
p_input->stream.i_method = INPUT_METHOD_DVD;
p_input->stream.b_pace_control = 1;
p_input->stream.b_seekable = 1;
- p_input->stream.b_connected = 1;
p_input->stream.p_selected_area->i_size = 0;
p_input->stream.p_selected_area->i_tell = 0;
* access.c: access capabilities for dvdplay plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: access.c,v 1.14 2003/03/24 14:18:28 hartman Exp $
+ * $Id: access.c,v 1.15 2003/03/24 17:15:29 gbazin Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
p_input->stream.b_pace_control = 1;
/* seek is only allowed when we have size info */
p_input->stream.b_seekable = 0;
- p_input->stream.b_connected = 1;
/* Initialize ES structures */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001, 2003 VideoLAN
- * $Id: input.c,v 1.18 2003/03/24 14:18:28 hartman Exp $
+ * $Id: input.c,v 1.19 2003/03/24 17:15:29 gbazin Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
/* If we are here we can control the pace... */
p_input->stream.b_pace_control = VLC_TRUE;
p_input->stream.b_seekable = VLC_TRUE;
- p_input->stream.b_connected = VLC_TRUE;
p_input->stream.p_selected_area->i_size = 0;
p_input->stream.p_selected_area->i_tell = 0;
* file.c: file input (file: access plug-in)
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: file.c,v 1.13 2003/03/04 21:12:04 gbazin Exp $
+ * $Id: file.c,v 1.14 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
vlc_mutex_lock( &p_input->stream.stream_lock );
- p_input->stream.b_connected = 1;
if( *p_input->psz_access && !strncmp( p_input->psz_access, "stream", 7 ) )
{
/* stream:%s */
* ftp.c:
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: ftp.c,v 1.9 2003/03/03 14:21:08 gbazin Exp $
+ * $Id: ftp.c,v 1.10 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
p_input->stream.b_pace_control = 1;
p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.b_seekable = 1;
- p_input->stream.b_connected = 1;
p_input->stream.p_selected_area->i_size = p_access->i_filesize;
p_input->stream.i_method = INPUT_METHOD_NETWORK;
vlc_mutex_unlock( &p_input->stream.stream_lock );
#else
struct timeval timeout;
fd_set fds;
+ ssize_t i_recv;
int i_ret;
/* Initialize file descriptor set */
timeout.tv_usec = 1000000;
/* Find if some data is available */
- i_ret = select( p_socket->i_handle + 1, &fds,
- NULL, NULL, &timeout );
+ while( (i_ret = select( p_socket->i_handle + 1, &fds,
+ NULL, NULL, &timeout )) == 0
+ || (i_ret < 0 && errno == EINTR) )
+ {
+ if( p_input->b_die || p_input->b_error )
+ {
+ return 0;
+ }
+ }
- if( i_ret == -1 && errno != EINTR )
+ if( i_ret < 0 )
{
msg_Err( p_input, "network select error (%s)", strerror(errno) );
+ return -1;
}
- else if( i_ret > 0 )
- {
- ssize_t i_recv = recv( p_socket->i_handle, p_buffer, i_len, 0 );
- if( i_recv < 0 )
- {
- msg_Err( p_input, "recv failed (%s)", strerror(errno) );
- }
+ i_recv = recv( p_socket->i_handle, p_buffer, i_len, 0 );
- return i_recv;
+ if( i_recv < 0 )
+ {
+ msg_Err( p_input, "recv failed (%s)", strerror(errno) );
}
- return 0;
+ return i_recv;
#endif
}
* http.c: HTTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: http.c,v 1.27 2003/03/22 23:03:02 sigmunau Exp $
+ * $Id: http.c,v 1.28 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_pace_control = VLC_TRUE;
p_input->stream.b_seekable = VLC_TRUE;
- p_input->stream.b_connected = VLC_TRUE;
p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.p_selected_area->i_size = 0;
p_input->stream.i_method = INPUT_METHOD_NETWORK;
input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
struct timeval timeout;
fd_set fds;
+ ssize_t i_recv;
int i_ret;
/* Initialize file descriptor set */
timeout.tv_usec = 500000;
/* Find if some data is available */
- i_ret = select( p_access_data->i_handle + 1, &fds,
- NULL, NULL, &timeout );
-
+ while( (i_ret = select( p_access_data->i_handle + 1, &fds,
+ NULL, NULL, &timeout )) == 0
#ifdef HAVE_ERRNO_H
- if( i_ret == -1 && errno != EINTR )
+ || (i_ret < 0 && errno == EINTR)
+#endif
+ )
{
- msg_Err( p_input, "network select error (%s)", strerror(errno) );
+ if( p_input->b_die || p_input->b_error )
+ {
+ return 0;
+ }
}
-#else
- if( i_ret == -1 )
+
+ if( i_ret < 0 )
{
msg_Err( p_input, "network select error" );
+ return -1;
}
-#endif
- else if( i_ret > 0 )
- {
- ssize_t i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 );
- if( i_recv < 0 )
- {
+ i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 );
+
+ if( i_recv < 0 )
+ {
#ifdef HAVE_ERRNO_H
- msg_Err( p_input, "recv failed (%s)", strerror(errno) );
+ msg_Err( p_input, "recv failed (%s)", strerror(errno) );
#else
- msg_Err( p_input, "recv failed" );
+ msg_Err( p_input, "recv failed" );
#endif
- }
-
- return i_recv;
}
- return 0;
+ return i_recv;
}
* mms.c: MMS access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: mms.c,v 1.27 2003/03/16 01:49:28 fenrir Exp $
+ * $Id: mms.c,v 1.28 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
/* *** finished to set some variable *** */
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_pace_control = 0;
- if( p_access->i_proto == MMS_PROTO_UDP )
- {
- p_input->stream.b_connected = 0;
- }
- else
- {
- p_input->stream.b_connected = 1;
- }
p_input->stream.p_selected_area->i_tell = 0;
/*
* i_flags_broadcast
timeout.tv_usec = 500000;
/* Find if some data is available */
- i_ret = select( i_handle_max + 1,
- &fds,
- NULL, NULL, &timeout );
+ while( (i_ret = select( i_handle_max + 1, &fds,
+ NULL, NULL, &timeout )) == 0
+ || (i_ret < 0 && errno == EINTR) )
+ {
+ if( p_input->b_die || p_input->b_error )
+ {
+ return 0;
+ }
+ }
- if( i_ret == -1 && errno != EINTR )
+ if( i_ret < 0 )
{
msg_Err( p_input, "network select error (%s)", strerror(errno) );
return -1;
p_input->stream.b_pace_control = 1;
p_input->stream.b_seekable = 0;
- p_input->stream.b_connected = 0;
p_input->stream.p_selected_area->i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
* slp.c: SLP access plugin
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: slp.c,v 1.8 2003/02/20 01:52:45 sigmunau Exp $
+ * $Id: slp.c,v 1.9 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Loïc Minier <lool@videolan.org>
*
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_pace_control = VLC_FALSE;
p_input->stream.b_seekable = VLC_FALSE;
- p_input->stream.b_connected = VLC_TRUE;
p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.p_selected_area->i_size = 0;
p_input->stream.i_method = INPUT_METHOD_SLP;
* udp.c: raw UDP & RTP access plug-in
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: udp.c,v 1.15 2003/03/03 14:21:08 gbazin Exp $
+ * $Id: udp.c,v 1.16 2003/03/24 17:15:29 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Tristan Leteurtre <tooney@via.ecp.fr>
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_pace_control = 0;
p_input->stream.b_seekable = 0;
- p_input->stream.b_connected = 0;
p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.i_method = INPUT_METHOD_NETWORK;
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
struct timeval timeout;
fd_set fds;
+ ssize_t i_recv;
int i_ret;
/* Initialize file descriptor set */
timeout.tv_usec = 500000;
/* Find if some data is available */
- i_ret = select( p_access_data->i_handle + 1, &fds,
- NULL, NULL, &timeout );
+ while( (i_ret = select( p_access_data->i_handle + 1, &fds,
+ NULL, NULL, &timeout )) == 0
+ || (i_ret < 0 && errno == EINTR) )
+ {
+ if( p_input->b_die || p_input->b_error )
+ {
+ return 0;
+ }
+ }
- if( i_ret == -1 && errno != EINTR )
+ if( i_ret < 0 )
{
msg_Err( p_input, "network select error (%s)", strerror(errno) );
+ return -1;
}
- else if( i_ret > 0 )
- {
- ssize_t i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 );
- if( i_recv < 0 )
- {
+ i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 );
+
+ if( i_recv < 0 )
+ {
#ifdef WIN32
- /* On win32 recv() will fail if the datagram doesn't fit inside
- * the passed buffer, even though the buffer will be filled with
- * the first part of the datagram. */
- if( WSAGetLastError() == WSAEMSGSIZE )
- {
- msg_Err( p_input, "recv() failed. "
- "Increase the mtu size (--mtu option)" );
- i_recv = i_len;
- }
- else
+ /* On win32 recv() will fail if the datagram doesn't fit inside
+ * the passed buffer, even though the buffer will be filled with
+ * the first part of the datagram. */
+ if( WSAGetLastError() == WSAEMSGSIZE )
+ {
+ msg_Err( p_input, "recv() failed. "
+ "Increase the mtu size (--mtu option)" );
+ i_recv = i_len;
+ }
+ else
#endif
- msg_Err( p_input, "recv failed (%s)", strerror(errno) );
- }
-
- return i_recv;
+ msg_Err( p_input, "recv failed (%s)", strerror(errno) );
}
- return 0;
+ return i_recv;
#endif
}
* v4l.c : Video4Linux input module for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: v4l.c,v 1.2 2002/12/31 01:54:36 massiot Exp $
+ * $Id: v4l.c,v 1.3 2003/03/24 17:15:30 gbazin Exp $
*
* Author: Samuel Hocevar <sam@zoy.org>
*
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_pace_control = 0;
p_input->stream.b_seekable = 0;
- p_input->stream.b_connected = 0;
p_input->stream.p_selected_area->i_size = 0;
p_input->stream.p_selected_area->i_tell = 0;
p_input->stream.i_method = INPUT_METHOD_FILE;
* vcd.c : VCD input module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
- * $Id: vcd.c,v 1.16 2003/03/11 23:56:54 gbazin Exp $
+ * $Id: vcd.c,v 1.17 2003/03/24 17:15:30 gbazin Exp $
*
* Author: Johan Bilien <jobi@via.ecp.fr>
*
p_input->stream.b_pace_control = 1;
p_input->stream.b_seekable = 1;
- p_input->stream.b_connected = 1;
p_input->stream.p_selected_area->i_size = 0;
p_input->stream.p_selected_area->i_tell = 0;
* ipv4.c: IPv4 network abstraction layer
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: ipv4.c,v 1.16 2003/03/11 13:52:25 titer Exp $
+ * $Id: ipv4.c,v 1.17 2003/03/24 17:15:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Mathias Kretschmer <mathias@research.att.com>
ttl = 1;
if( setsockopt( i_handle, IPPROTO_IP, IP_MULTICAST_TTL,
- &ttl, sizeof( ttl ) ) < 0 )
+ (void *) &ttl, sizeof( ttl ) ) < 0 )
{
#ifdef HAVE_ERRNO_H
msg_Warn( p_this, "failed to set ttl (%s)",
* decoders.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id: input.c,v 1.225 2003/03/14 00:24:08 sigmunau Exp $
+ * $Id: input.c,v 1.226 2003/03/24 17:15:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
/* Read and demultiplex some data. */
i_count = p_input->pf_demux( p_input );
- if( i_count == 0 && p_input->stream.b_connected )
+ if( i_count == 0 )
{
/* End of file - we do not set b_die because only the
* playlist is allowed to do so. */
* input_ext-plugins.c: useful functions for access and demux plug-ins
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: input_ext-plugins.c,v 1.30 2003/03/05 17:55:13 gbazin Exp $
+ * $Id: input_ext-plugins.c,v 1.31 2003/03/24 17:15:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
(byte_t *)p_buf + sizeof(data_buffer_t)
+ i_remains,
p_input->i_bufsize );
+ if( i_ret < 0 && i_remains == 0 )
+ {
+ /* Our internal buffers are empty, we can signal the error */
+ return -1;
+ }
+
if( i_ret < 0 ) i_ret = 0;
p_input->p_data_buffer = p_buf;
/* Go to the next buffer */
ssize_t i_ret = input_FillBuffer( p_input );
- if( i_ret == -1 )
+ if( i_ret < 0 )
{
return -1;
}
/* Go to the next buffer */
ssize_t i_ret = input_FillBuffer( p_input );
- if( i_ret == -1 )
+ if( i_ret < 0 )
{
return -1;
}
* intf_eject.c: CD/DVD-ROM ejection handling functions
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
- * $Id: intf_eject.c,v 1.19 2003/03/21 17:14:56 gbazin Exp $
+ * $Id: intf_eject.c,v 1.20 2003/03/24 17:15:30 gbazin Exp $
*
* Author: Julien Blache <jb@technologeek.org> for the Linux part
* with code taken from the Linux "eject" command
{
st.dwItem = MCI_STATUS_READY;
/* Eject disc */
- mciSendCommand( op.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0 );
+ i_ret = mciSendCommand( op.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0 );
/* Release access to the device */
mciSendCommand( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 );
}
+ else i_ret = VLC_EGENERIC;
+ return i_ret;
#else /* WIN32 */
int i_fd;