input_ts.h 2.22 KB
Newer Older
Henri Fallon's avatar
 
Henri Fallon committed
1
/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
2
 * input_ts.h: structures of the input not exported to other modules
Henri Fallon's avatar
 
Henri Fallon committed
3 4
 *****************************************************************************
 * Copyright (C) 1999, 2000 VideoLAN
Sam Hocevar's avatar
 
Sam Hocevar committed
5
 * $Id: input_ts.h,v 1.5 2001/05/28 04:23:52 sam Exp $
Henri Fallon's avatar
 
Henri Fallon committed
6
 *
Sam Hocevar's avatar
 
Sam Hocevar committed
7
 * Authors: Henri Fallon <henri@via.ecp.fr>
Henri Fallon's avatar
 
Henri Fallon committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/


Henri Fallon's avatar
 
Henri Fallon committed
25 26
#define NB_DATA 16384 
#define NB_PES  8192
Henri Fallon's avatar
 
Henri Fallon committed
27

Henri Fallon's avatar
 
Henri Fallon committed
28
/* Will be used whne NetworkOpen is ready */
Henri Fallon's avatar
 
Henri Fallon committed
29 30 31
typedef struct thread_ts_data_s { 
    
    // FILE *                  stream;
Henri Fallon's avatar
 
Henri Fallon committed
32
    fd_set s_fdset;
Henri Fallon's avatar
 
Henri Fallon committed
33 34
    
} thread_ts_data_t;
Sam Hocevar's avatar
 
Sam Hocevar committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

#ifdef WIN32
static __inline__ int readv( int i_fd, struct iovec *p_iovec, int i_count )
{
    int i_index, i_len, i_total = 0;
    char *p_base;

    for( i_index = i_count; i_index; i_index-- )
    {
        i_len  = p_iovec->iov_len;
        p_base = p_iovec->iov_base;

        while( i_len > 0 )
        {
            register signed int i_bytes;
            i_bytes = read( i_fd, p_base, i_len );

            if( i_total == 0 )
            {
                if( i_bytes < 0 )
                {
                    intf_ErrMsg( "input error: read failed on socket" );
                    return -1;
                }
            }

            if( i_bytes <= 0 )
            {
                return i_total;
            }

            i_len   -= i_bytes;
            i_total += i_bytes;
            p_base  += i_bytes;
        }

        p_iovec++;
    }

    return i_total;
}
#endif