Changeset 607b74b2a18121c12033f59027f9ab2fa5201235

Show
Ignore:
Timestamp:
24/03/03 18:15:30 (6 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1048526130 +0000
git-parent:

[c4969929b53f7327517b2839a892b0b5b5540215]

git-author:
Gildas Bazin <gbazin@videolan.org> 1048526130 +0000
Message:

* modules/access/*: pf_read() in access modules is now blocking. We still

check regularly for p_input->b_die though. Now the demuxers can safely
assume that pf_read() == 0 means EOF.

* ALL: got rid of the p_input->b_connected flag.
* src/input/input_ext-plugins.c, src/input/input.c: fixed the infinite loop

of "decoder stuck" messages that sometimes happened.

* src/interface/intf_eject.c, modules/misc/network/ipv4.c: fixed compilation

warnings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/input_ext-intf.h

    r74912d2 r607b74b  
    55 ***************************************************************************** 
    66 * Copyright (C) 1999, 2000 VideoLAN 
    7  * $Id: input_ext-intf.h,v 1.86 2003/03/09 23:39:05 jlj Exp $ 
     7 * $Id: input_ext-intf.h,v 1.87 2003/03/24 17:15:29 gbazin Exp $ 
    88 * 
    99 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    223223    vlc_bool_t              b_pace_control;    /* can we read when we want ? */ 
    224224    vlc_bool_t              b_seekable;               /* can we do lseek() ? */ 
    225     vlc_bool_t              b_connected;     /* does read() == 0 imply EOF ? */ 
    226225 
    227226    /* if (b_seekable) : */ 
  • modules/access/directory.c

    reb0eac0 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: directory.c,v 1.2 2003/03/24 01:39:58 gbazin Exp $ 
     5 * $Id: directory.c,v 1.3 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net> 
     
    239239        return (ssize_t) i_ret; 
    240240    } 
    241      
    242     p_input->stream.b_connected = VLC_TRUE; 
     241 
    243242    return 0; 
    244243} 
  • modules/access/dvd/access.c

    r1171979 r607b74b  
    99 ***************************************************************************** 
    1010 * Copyright (C) 1998-2001 VideoLAN 
    11  * $Id: access.c,v 1.11 2003/03/11 23:56:53 gbazin Exp $ 
     11 * $Id: access.c,v 1.12 2003/03/24 17:15:29 gbazin Exp $ 
    1212 * 
    1313 * Author: St�ane Borel <stef@via.ecp.fr> 
     
    192192    p_input->stream.b_pace_control = 1; 
    193193    p_input->stream.b_seekable = 1; 
    194     p_input->stream.b_connected = 1; 
    195194    p_input->stream.p_selected_area->i_size = 0; 
    196195    p_input->stream.p_selected_area->i_tell = 0; 
  • modules/access/dvdplay/access.c

    r3f822b5 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: access.c,v 1.14 2003/03/24 14:18:28 hartman Exp $ 
     5 * $Id: access.c,v 1.15 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Author: St�ane Borel <stef@via.ecp.fr> 
     
    131131    /* seek is only allowed when we have size info */ 
    132132    p_input->stream.b_seekable = 0; 
    133     p_input->stream.b_connected = 1; 
    134133 
    135134    /* Initialize ES structures */ 
  • modules/access/dvdread/input.c

    r3f822b5 r607b74b  
    77 ***************************************************************************** 
    88 * Copyright (C) 2001, 2003 VideoLAN 
    9  * $Id: input.c,v 1.18 2003/03/24 14:18:28 hartman Exp $ 
     9 * $Id: input.c,v 1.19 2003/03/24 17:15:29 gbazin Exp $ 
    1010 * 
    1111 * Author: St�ane Borel <stef@via.ecp.fr> 
     
    365365    p_input->stream.b_pace_control = VLC_TRUE; 
    366366    p_input->stream.b_seekable = VLC_TRUE; 
    367     p_input->stream.b_connected = VLC_TRUE; 
    368367 
    369368    p_input->stream.p_selected_area->i_size = 0; 
  • modules/access/file.c

    r2dd2df6 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: file.c,v 1.13 2003/03/04 21:12:04 gbazin Exp $ 
     5 * $Id: file.c,v 1.14 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    131131    vlc_mutex_lock( &p_input->stream.stream_lock ); 
    132132 
    133     p_input->stream.b_connected = 1; 
    134133    if( *p_input->psz_access && !strncmp( p_input->psz_access, "stream", 7 ) ) 
    135134    { 
  • modules/access/ftp.c

    r7211d64 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: ftp.c,v 1.9 2003/03/03 14:21:08 gbazin Exp $ 
     5 * $Id: ftp.c,v 1.10 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    375375    p_input->stream.p_selected_area->i_tell = 0; 
    376376    p_input->stream.b_seekable = 1; 
    377     p_input->stream.b_connected = 1; 
    378377    p_input->stream.p_selected_area->i_size = p_access->i_filesize; 
    379378    p_input->stream.i_method = INPUT_METHOD_NETWORK; 
     
    818817    struct timeval  timeout; 
    819818    fd_set          fds; 
     819    ssize_t         i_recv; 
    820820    int             i_ret; 
    821821 
     
    829829 
    830830    /* Find if some data is available */ 
    831     i_ret = select( p_socket->i_handle + 1, &fds, 
    832                     NULL, NULL, &timeout ); 
    833  
    834     if( i_ret == -1 && errno != EINTR ) 
     831    while( (i_ret = select( p_socket->i_handle + 1, &fds, 
     832                            NULL, NULL, &timeout )) == 0 
     833           || (i_ret < 0 && errno == EINTR) ) 
     834    { 
     835        if( p_input->b_die || p_input->b_error ) 
     836        { 
     837            return 0; 
     838        } 
     839    } 
     840 
     841    if( i_ret < 0 ) 
    835842    { 
    836843        msg_Err( p_input, "network select error (%s)", strerror(errno) ); 
    837     } 
    838     else if( i_ret > 0 ) 
    839     { 
    840         ssize_t i_recv = recv( p_socket->i_handle, p_buffer, i_len, 0 ); 
    841  
    842         if( i_recv < 0 ) 
    843         { 
    844             msg_Err( p_input, "recv failed (%s)", strerror(errno) ); 
    845         } 
    846  
    847         return i_recv; 
    848     } 
    849  
    850     return 0; 
     844        return -1; 
     845    } 
     846 
     847    i_recv = recv( p_socket->i_handle, p_buffer, i_len, 0 ); 
     848 
     849    if( i_recv < 0 ) 
     850    { 
     851        msg_Err( p_input, "recv failed (%s)", strerror(errno) ); 
     852    } 
     853 
     854    return i_recv; 
    851855 
    852856#endif 
  • modules/access/http.c

    rd5ca285 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: http.c,v 1.27 2003/03/22 23:03:02 sigmunau Exp $ 
     5 * $Id: http.c,v 1.28 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    612612    p_input->stream.b_pace_control = VLC_TRUE; 
    613613    p_input->stream.b_seekable = VLC_TRUE; 
    614     p_input->stream.b_connected = VLC_TRUE; 
    615614    p_input->stream.p_selected_area->i_tell = 0; 
    616615    p_input->stream.p_selected_area->i_size = 0; 
     
    701700    struct timeval  timeout; 
    702701    fd_set          fds; 
     702    ssize_t         i_recv; 
    703703    int             i_ret; 
    704704 
     
    712712 
    713713    /* Find if some data is available */ 
    714     i_ret = select( p_access_data->i_handle + 1, &fds, 
    715                     NULL, NULL, &timeout ); 
    716  
     714    while( (i_ret = select( p_access_data->i_handle + 1, &fds, 
     715                            NULL, NULL, &timeout )) == 0 
    717716#ifdef HAVE_ERRNO_H 
    718     if( i_ret == -1 && errno != EINTR ) 
    719     { 
    720         msg_Err( p_input, "network select error (%s)", strerror(errno) ); 
    721     } 
     717           || (i_ret < 0 && errno == EINTR) 
     718#endif 
     719           ) 
     720    { 
     721        if( p_input->b_die || p_input->b_error ) 
     722        { 
     723            return 0; 
     724        } 
     725    } 
     726 
     727    if( i_ret < 0 ) 
     728    { 
     729        msg_Err( p_input, "network select error" ); 
     730        return -1; 
     731    } 
     732 
     733    i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 ); 
     734 
     735    if( i_recv < 0 ) 
     736    { 
     737#ifdef HAVE_ERRNO_H 
     738        msg_Err( p_input, "recv failed (%s)", strerror(errno) ); 
    722739#else 
    723     if( i_ret == -1 ) 
    724     { 
    725         msg_Err( p_input, "network select error" ); 
    726     } 
    727 #endif 
    728     else if( i_ret > 0 ) 
    729     { 
    730         ssize_t i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 ); 
    731  
    732         if( i_recv < 0 ) 
    733         { 
    734 #ifdef HAVE_ERRNO_H 
    735             msg_Err( p_input, "recv failed (%s)", strerror(errno) ); 
    736 #else 
    737             msg_Err( p_input, "recv failed" ); 
    738 #endif 
    739         } 
    740  
    741         return i_recv; 
    742     } 
    743  
    744     return 0; 
     740        msg_Err( p_input, "recv failed" ); 
     741#endif 
     742    } 
     743 
     744    return i_recv; 
    745745} 
  • modules/access/mms/mms.c

    r2f9b46d r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: mms.c,v 1.27 2003/03/16 01:49:28 fenrir Exp $ 
     5 * $Id: mms.c,v 1.28 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    253253    vlc_mutex_lock( &p_input->stream.stream_lock ); 
    254254    p_input->stream.b_pace_control = 0; 
    255     if( p_access->i_proto == MMS_PROTO_UDP ) 
    256     { 
    257         p_input->stream.b_connected = 0; 
    258     } 
    259     else 
    260     { 
    261         p_input->stream.b_connected = 1; 
    262     } 
    263255    p_input->stream.p_selected_area->i_tell = 0; 
    264256    /* 
     
    14781470 
    14791471    /* Find if some data is available */ 
    1480     i_ret = select( i_handle_max + 1, 
    1481                     &fds, 
    1482                     NULL, NULL, &timeout ); 
    1483  
    1484     if( i_ret == -1 && errno != EINTR ) 
     1472    while( (i_ret = select( i_handle_max + 1, &fds, 
     1473                            NULL, NULL, &timeout )) == 0 
     1474           || (i_ret < 0 && errno == EINTR) ) 
     1475    { 
     1476        if( p_input->b_die || p_input->b_error ) 
     1477        { 
     1478            return 0; 
     1479        } 
     1480    } 
     1481 
     1482    if( i_ret < 0 ) 
    14851483    { 
    14861484        msg_Err( p_input, "network select error (%s)", strerror(errno) ); 
  • modules/access/satellite/access.c

    r86b811f r607b74b  
    288288    p_input->stream.b_pace_control = 1; 
    289289    p_input->stream.b_seekable = 0; 
    290     p_input->stream.b_connected = 0; 
    291290    p_input->stream.p_selected_area->i_tell = 0; 
    292291 
  • modules/access/slp.c

    r5a13b47 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: slp.c,v 1.8 2003/02/20 01:52:45 sigmunau Exp $ 
     5 * $Id: slp.c,v 1.9 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Authors: Lo�Minier <lool@videolan.org> 
     
    341341    p_input->stream.b_pace_control = VLC_FALSE; 
    342342    p_input->stream.b_seekable = VLC_FALSE; 
    343     p_input->stream.b_connected = VLC_TRUE; 
    344343    p_input->stream.p_selected_area->i_tell = 0; 
    345344    p_input->stream.p_selected_area->i_size = 0; 
  • modules/access/udp.c

    r7211d64 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: udp.c,v 1.15 2003/03/03 14:21:08 gbazin Exp $ 
     5 * $Id: udp.c,v 1.16 2003/03/24 17:15:29 gbazin Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    236236    p_input->stream.b_pace_control = 0; 
    237237    p_input->stream.b_seekable = 0; 
    238     p_input->stream.b_connected = 0; 
    239238    p_input->stream.p_selected_area->i_tell = 0; 
    240239    p_input->stream.i_method = INPUT_METHOD_NETWORK; 
     
    325324    struct timeval  timeout; 
    326325    fd_set          fds; 
     326    ssize_t         i_recv; 
    327327    int             i_ret; 
    328328 
     
    336336 
    337337    /* Find if some data is available */ 
    338     i_ret = select( p_access_data->i_handle + 1, &fds, 
    339                     NULL, NULL, &timeout ); 
    340  
    341     if( i_ret == -1 && errno != EINTR ) 
     338    while( (i_ret = select( p_access_data->i_handle + 1, &fds, 
     339                            NULL, NULL, &timeout )) == 0 
     340           || (i_ret < 0 && errno == EINTR) ) 
     341    { 
     342        if( p_input->b_die || p_input->b_error ) 
     343        { 
     344            return 0; 
     345        } 
     346    } 
     347 
     348    if( i_ret < 0 ) 
    342349    { 
    343350        msg_Err( p_input, "network select error (%s)", strerror(errno) ); 
    344     } 
    345     else if( i_ret > 0 ) 
    346     { 
    347         ssize_t i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 ); 
    348  
    349         if( i_recv < 0 ) 
    350        
     351        return -1; 
     352    } 
     353 
     354    i_recv = recv( p_access_data->i_handle, p_buffer, i_len, 0 ); 
     355 
     356    if( i_recv < 0 ) 
     357   
    351358#ifdef WIN32 
    352             /* On win32 recv() will fail if the datagram doesn't fit inside 
    353             * the passed buffer, even though the buffer will be filled with 
    354             * the first part of the datagram. */ 
    355             if( WSAGetLastError() == WSAEMSGSIZE ) 
    356            
    357                 msg_Err( p_input, "recv() failed. " 
    358                                   "Increase the mtu size (--mtu option)" ); 
    359                 i_recv = i_len; 
    360            
    361             else 
     359        /* On win32 recv() will fail if the datagram doesn't fit inside 
     360    * the passed buffer, even though the buffer will be filled with 
     361    * the first part of the datagram. */ 
     362        if( WSAGetLastError() == WSAEMSGSIZE ) 
     363   
     364       msg_Err( p_input, "recv() failed. " 
     365            "Increase the mtu size (--mtu option)" ); 
     366       i_recv = i_len; 
     367   
     368   else 
    362369#endif 
    363             msg_Err( p_input, "recv failed (%s)", strerror(errno) ); 
    364         } 
    365  
    366         return i_recv; 
    367     } 
    368  
    369     return 0; 
     370        msg_Err( p_input, "recv failed (%s)", strerror(errno) ); 
     371    } 
     372 
     373    return i_recv; 
    370374 
    371375#endif 
  • modules/access/v4l/v4l.c

    rd3c3b32 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: v4l.c,v 1.2 2002/12/31 01:54:36 massiot Exp $ 
     5 * $Id: v4l.c,v 1.3 2003/03/24 17:15:30 gbazin Exp $ 
    66 * 
    77 * Author: Samuel Hocevar <sam@zoy.org> 
     
    6565    p_input->stream.b_pace_control = 0; 
    6666    p_input->stream.b_seekable = 0; 
    67     p_input->stream.b_connected = 0; 
    6867    p_input->stream.p_selected_area->i_size = 0; 
    6968    p_input->stream.p_selected_area->i_tell = 0; 
  • modules/access/vcd/vcd.c

    r1171979 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000 VideoLAN 
    5  * $Id: vcd.c,v 1.16 2003/03/11 23:56:54 gbazin Exp $ 
     5 * $Id: vcd.c,v 1.17 2003/03/24 17:15:30 gbazin Exp $ 
    66 * 
    77 * Author: Johan Bilien <jobi@via.ecp.fr> 
     
    172172    p_input->stream.b_pace_control = 1; 
    173173    p_input->stream.b_seekable = 1; 
    174     p_input->stream.b_connected = 1; 
    175174    p_input->stream.p_selected_area->i_size = 0; 
    176175    p_input->stream.p_selected_area->i_tell = 0; 
  • modules/misc/network/ipv4.c

    r097b76d r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: ipv4.c,v 1.16 2003/03/11 13:52:25 titer Exp $ 
     5 * $Id: ipv4.c,v 1.17 2003/03/24 17:15:30 gbazin Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    385385 
    386386            if( setsockopt( i_handle, IPPROTO_IP, IP_MULTICAST_TTL, 
    387                             &ttl, sizeof( ttl ) ) < 0 ) 
     387                            (void *) &ttl, sizeof( ttl ) ) < 0 ) 
    388388            { 
    389389#ifdef HAVE_ERRNO_H 
  • src/input/input.c

    rae1b0c7 r607b74b  
    55 ***************************************************************************** 
    66 * Copyright (C) 1998-2002 VideoLAN 
    7  * $Id: input.c,v 1.225 2003/03/14 00:24:08 sigmunau Exp $ 
     7 * $Id: input.c,v 1.226 2003/03/24 17:15:30 gbazin Exp $ 
    88 * 
    99 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    342342        i_count = p_input->pf_demux( p_input ); 
    343343 
    344         if( i_count == 0 && p_input->stream.b_connected
     344        if( i_count == 0
    345345        { 
    346346            /* End of file - we do not set b_die because only the 
  • src/input/input_ext-plugins.c

    rb7b2c20 r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: input_ext-plugins.c,v 1.30 2003/03/05 17:55:13 gbazin Exp $ 
     5 * $Id: input_ext-plugins.c,v 1.31 2003/03/24 17:15:30 gbazin Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    518518                               + i_remains, 
    519519                              p_input->i_bufsize ); 
     520    if( i_ret < 0 && i_remains == 0 ) 
     521    { 
     522        /* Our internal buffers are empty, we can signal the error */ 
     523        return -1; 
     524    } 
     525 
    520526    if( i_ret < 0 ) i_ret = 0; 
    521527 
     
    539545        ssize_t i_ret = input_FillBuffer( p_input ); 
    540546 
    541         if( i_ret == -1
     547        if( i_ret < 0
    542548        { 
    543549            return -1; 
     
    565571        ssize_t i_ret = input_FillBuffer( p_input ); 
    566572 
    567         if( i_ret == -1
     573        if( i_ret < 0
    568574        { 
    569575            return -1; 
  • src/interface/intf_eject.c

    r774372d r607b74b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: intf_eject.c,v 1.19 2003/03/21 17:14:56 gbazin Exp $ 
     5 * $Id: intf_eject.c,v 1.20 2003/03/24 17:15:30 gbazin Exp $ 
    66 * 
    77 * Author: Julien Blache <jb@technologeek.org> for the Linux part 
     
    158158        st.dwItem = MCI_STATUS_READY; 
    159159    /* Eject disc */ 
    160         mciSendCommand( op.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0 ); 
     160        i_ret = mciSendCommand( op.wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0 ); 
    161161    /* Release access to the device */ 
    162162    mciSendCommand( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 ); 
    163163    } 
    164  
     164    else i_ret = VLC_EGENERIC; 
     165 
     166    return i_ret; 
    165167#else   /* WIN32 */ 
    166168