Commit 94d3d4d8 authored by Sam Hocevar's avatar Sam Hocevar

  * Applied patch from Jon Lech Johansen <jon-vl@nanocrew.net> to compile
    vlc with MS and Intel C/C++ compilers.
parent b465bcca
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.32 2001/05/30 17:03:11 sam Exp $
* $Id: common.h,v 1.33 2001/05/31 01:37:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -144,6 +144,7 @@ struct es_descriptor_s;
#ifdef NTOHL_IN_SYS_PARAM_H
# include <sys/param.h>
#elif defined(WIN32)
# include <winsock.h>
#else
# include <netinet/in.h>
#endif
......@@ -190,3 +191,18 @@ struct es_descriptor_s;
#define U32_AT(p) ( ntoh32 ( *( (u32 *)(p) ) ) )
#define U16_AT(p) ( ntoh16 ( *( (u16 *)(p) ) ) )
/* win32, cl and icl support */
#if defined( _MSC_VER )
typedef long off_t;
#define __attribute__(x)
#define __inline__ __inline
#define strncasecmp strnicmp
#define strcasecmp stricmp
#define S_ISBLK(m) (0)
#define S_ISCHR(m) (0)
#define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
#define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
#define I64C(x) x
#else
#define I64C(x) x##LL
#endif
......@@ -2,7 +2,7 @@
* int_types.h: internal types
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: int_types.h,v 1.6 2001/03/21 13:42:33 sam Exp $
* $Id: int_types.h,v 1.7 2001/05/31 01:37:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -28,5 +28,10 @@ typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
#if defined( _MSC_VER )
typedef unsigned __int64 u64;
typedef signed __int64 s64;
#else
typedef unsigned long long u64;
typedef signed long long s64;
#endif
......@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_msg.h,v 1.13 2001/04/30 15:00:59 massiot Exp $
* $Id: intf_msg.h,v 1.14 2001/05/31 01:37:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -48,8 +48,13 @@ void _intf_DbgMsgImm ( char *psz_file, char *psz_function, int i_line,
#else
/* Non-TRACE mode */
#if defined( _MSC_VER )
#define intf_DbgMsg
#define intf_DbgMsgImm
#else
#define intf_DbgMsg( format, args... )
#define intf_DbgMsgImm( format, args...)
#endif
#endif
......
/*****************************************************************************
* iovec.h: iovec structure and readv() replacement
*****************************************************************************
* Copyright (C) 2001 VideoLAN
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
*
* 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.
*****************************************************************************/
/*****************************************************************************
* iovec structure: vectored data entry
*****************************************************************************/
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#if defined( WIN32 )
/*****************************************************************************
* readv: readv() replacement for iovec-impaired C libraries
*****************************************************************************/
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-- )
{
register signed int i_bytes;
i_len = p_iovec->iov_len;
p_base = p_iovec->iov_base;
/* Loop is unrolled one time to spare the (i_bytes < 0) test */
if( i_len > 0 )
{
i_bytes = read( i_fd, p_base, i_len );
if( ( i_total == 0 ) && ( i_bytes < 0 ) )
{
return -1;
}
if( i_bytes <= 0 )
{
return i_total;
}
i_len -= i_bytes;
i_total += i_bytes;
p_base += i_bytes;
while( i_len > 0 )
{
i_bytes = read( i_fd, p_base, i_len );
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
......@@ -2,7 +2,7 @@
* aout_dummy.c : dummy audio output plugin
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: aout_dummy.c,v 1.11 2001/05/30 17:03:12 sam Exp $
* $Id: aout_dummy.c,v 1.12 2001/05/31 01:37:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -50,7 +50,9 @@
*****************************************************************************/
typedef struct aout_sys_s
{
#if defined( _MSC_VER )
int i_dummy;
#endif
} aout_sys_t;
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* intf_dummy.c: dummy interface plugin
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: intf_dummy.c,v 1.8 2001/05/30 17:03:12 sam Exp $
* $Id: intf_dummy.c,v 1.9 2001/05/31 01:37:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -50,7 +50,9 @@
*****************************************************************************/
typedef struct intf_sys_s
{
#if defined( _MSC_VER )
int i_dummy;
#endif
} intf_sys_t;
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.29 2001/05/19 00:39:29 stef Exp $
* $Id: dvd_css.c,v 1.30 2001/05/31 01:37:08 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -36,7 +36,13 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#include <string.h>
#include "common.h"
......
......@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.27 2001/05/19 00:39:29 stef Exp $
* $Id: dvd_ifo.c,v 1.28 2001/05/31 01:37:08 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -34,7 +34,13 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#include <string.h>
#include <fcntl.h>
......
......@@ -2,7 +2,7 @@
* dvd_ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.c,v 1.14 2001/05/27 15:16:58 sam Exp $
* $Id: dvd_ioctl.c,v 1.15 2001/05/31 01:37:08 sam Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
......@@ -29,9 +29,11 @@
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h>
#include <netinet/in.h>
#if !defined( WIN32 )
#include <netinet/in.h>
#include <sys/ioctl.h>
#endif
#ifdef DVD_STRUCT_IN_SYS_CDIO_H
# include <sys/cdio.h>
......
......@@ -7,7 +7,7 @@
* will only be given back to netlist when refcount is zero.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: dvd_netlist.c,v 1.5 2001/04/06 09:15:47 sam Exp $
* $Id: dvd_netlist.c,v 1.6 2001/05/31 01:37:08 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
* Stphane Borel <stef@videolan.org>
......@@ -35,8 +35,17 @@
#include <stdlib.h>
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h>
#include <sys/uio.h> /* struct iovec */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if !defined( WIN32 )
#include <sys/uio.h> /* struct iovec */
#else
#include <io.h>
#include "iovec.h"
#endif
#include "config.h"
#include "common.h"
......
......@@ -3,7 +3,7 @@
* found in .ifo.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_summary.c,v 1.1 2001/05/19 00:39:30 stef Exp $
* $Id: dvd_summary.c,v 1.2 2001/05/31 01:37:08 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -36,12 +36,17 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if !defined( WIN32 )
#include <netinet/in.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
......
......@@ -5,7 +5,7 @@
* contains the basic udf handling functions
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_udf.c,v 1.6 2001/04/28 03:36:25 sam Exp $
* $Id: dvd_udf.c,v 1.7 2001/05/31 01:37:08 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -41,7 +41,13 @@
#include "modules_inner.h"
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
......
......@@ -10,7 +10,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.62 2001/05/30 22:16:07 sam Exp $
* $Id: input_dvd.c,v 1.63 2001/05/31 01:37:08 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -43,12 +43,17 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if !defined( WIN32 )
#include <netinet/in.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
......@@ -56,6 +61,13 @@
#endif
#include <errno.h>
#if !defined( WIN32 )
#include <sys/uio.h> /* struct iovec */
#else
#include <io.h>
#include "iovec.h"
#endif
#include "config.h"
#include "common.h"
#include "threads.h"
......@@ -785,7 +797,7 @@ static int DVDRead( input_thread_t * p_input,
thread_dvd_data_t * p_dvd;
dvd_netlist_t * p_netlist;
struct iovec * p_vec;
struct data_packet_s * pp_data[p_input->i_read_once];
struct data_packet_s ** pp_data;
u8 * pi_cur;
int i_block_once;
int i_packet_size;
......@@ -798,6 +810,14 @@ static int DVDRead( input_thread_t * p_input,
boolean_t b_eof;
boolean_t b_eot;
pp_data = (struct data_packet_s **) malloc( p_input->i_read_once *
sizeof( struct data_packet_s * ) );
if( pp_data == NULL )
{
intf_ErrMsg( "dvd error: out of memory" );
return -1;
}
p_dvd = (thread_dvd_data_t *)p_input->p_plugin_data;
p_netlist = (dvd_netlist_t *)p_input->p_method_data;
......@@ -805,6 +825,7 @@ static int DVDRead( input_thread_t * p_input,
if( ( p_vec = DVDGetiovec( p_netlist ) ) == NULL )
{
intf_ErrMsg( "dvd error: can't get iovec" );
free( pp_data );
return -1;
}
......@@ -823,6 +844,7 @@ static int DVDRead( input_thread_t * p_input,
{
pp_packets[0] = NULL;
intf_ErrMsg( "dvd error: can't find next cell" );
free( pp_data );
return 1;
}
......@@ -900,7 +922,7 @@ static int DVDRead( input_thread_t * p_input,
while( i_pos < p_netlist->i_buffer_size )
{
pi_cur = (u8*)(p_vec[i_iovec].iov_base + i_pos);
pi_cur = ((u8*)p_vec[i_iovec].iov_base + i_pos);
/*default header */
if( U32_AT( pi_cur ) != 0x1BA )
......@@ -925,6 +947,7 @@ static int DVDRead( input_thread_t * p_input,
else
{
intf_ErrMsg( "Unable to determine stream type" );
free( pp_data );
return( -1 );
}
......@@ -962,6 +985,8 @@ static int DVDRead( input_thread_t * p_input,
vlc_mutex_unlock( &p_input->stream.stream_lock );
free( pp_data );
if( b_eof )
{
return 1;
......
......@@ -2,7 +2,7 @@
* input_es.c: Elementary Stream demux and packet management
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_es.c,v 1.3 2001/05/30 17:03:12 sam Exp $
* $Id: input_es.c,v 1.4 2001/05/31 01:37:08 sam Exp $
*
* Authors:
*
......@@ -35,7 +35,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#include <fcntl.h>
#include "config.h"
......
......@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.25 2001/05/30 17:03:12 sam Exp $
* $Id: input_ps.c,v 1.26 2001/05/31 01:37:08 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -39,7 +39,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#include <fcntl.h>
#include "config.h"
......
......@@ -2,7 +2,7 @@
* input_ps.h: thread structure of the PS plugin
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ps.h,v 1.6 2001/05/08 00:43:57 sam Exp $
* $Id: input_ps.h,v 1.7 2001/05/31 01:37:08 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
......@@ -22,6 +22,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#if defined( _MSC_VER )
#undef small
#endif
/*****************************************************************************
* thread_ps_data_t: extension of input_thread_t
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.21 2001/05/30 17:03:12 sam Exp $
* $Id: input_ts.c,v 1.22 2001/05/31 01:37:08 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -37,26 +37,30 @@
#include <errno.h>
#include <sys/types.h>
#if !defined( _MSC_VER )
#include <sys/time.h>
#endif
#ifdef SYS_NTO
#include <sys/select.h>
#endif
#ifndef WIN32
# include <sys/uio.h> /* struct iovec */
#else
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#endif
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#if !defined( WIN32 )
#include <sys/uio.h> /* struct iovec */
#else
#include <io.h>
#include "iovec.h"
#endif
#include "config.h"
#include "common.h"
#include "threads.h"
......
......@@ -2,7 +2,7 @@
* input_ts.h: structures of the input not exported to other modules
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ts.h,v 1.5 2001/05/28 04:23:52 sam Exp $
* $Id: input_ts.h,v 1.6 2001/05/31 01:37:08 sam Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
*
......@@ -32,46 +32,3 @@ typedef struct thread_ts_data_s {
fd_set s_fdset;
} thread_ts_data_t;
#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
......@@ -2,7 +2,7 @@
* ac3_decoder_thread.c: ac3 decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.c,v 1.33 2001/05/15 16:19:42 sam Exp $
* $Id: ac3_decoder_thread.c,v 1.34 2001/05/31 01:37:08 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -35,7 +35,9 @@
*****************************************************************************/
#include "defs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* memset() */
......
......@@ -2,7 +2,7 @@
* ac3_iec958.c: ac3 to spdif converter
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_iec958.c,v 1.4 2001/05/06 18:32:30 stef Exp $
* $Id: ac3_iec958.c,v 1.5 2001/05/31 01:37:08 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
......@@ -32,7 +32,10 @@
#include <stdlib.h>
#include <string.h> /* memset() */
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "config.h"
#include "common.h"
......
......@@ -2,7 +2,7 @@
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.c,v 1.6 2001/05/30 05:19:03 stef Exp $
* $Id: ac3_spdif.c,v 1.7 2001/05/31 01:37:08 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
......@@ -32,7 +32,10 @@
#include <stdlib.h>
#include <string.h> /* memcpy() */
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "config.h"
#include "common.h"
......@@ -204,8 +207,8 @@ static void RunThread( ac3_spdif_thread_t * p_spdif )
m_last_pts;
/* Write in the first free packet of aout fifo */
p_spdif->p_iec = (p_spdif->p_aout_fifo->buffer) +
(p_spdif->p_aout_fifo->l_end_frame * SPDIF_FRAME_SIZE );
p_spdif->p_iec = ((u8*)(p_spdif->p_aout_fifo->buffer) +
(p_spdif->p_aout_fifo->l_end_frame * SPDIF_FRAME_SIZE ));
/* Build burst to be sent to hardware decoder */
ac3_iec958_build_burst( p_spdif );
......
......@@ -2,7 +2,7 @@
* audio_decoder.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_decoder.c,v 1.50 2001/05/01 04:18:18 sam Exp $
* $Id: audio_decoder.c,v 1.51 2001/05/31 01:37:08 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -36,7 +36,9 @@
*****************************************************************************/
#include "defs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#include <stdio.h> /* "intf_msg.h" */
#include <string.h> /* memcpy(), memset() */
......
......@@ -2,7 +2,7 @@
* aout_spdif: ac3 passthrough output
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.8 2001/05/30 23:02:04 stef Exp $
* $Id: aout_spdif.c,v 1.9 2001/05/31 01:37:08 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -114,9 +114,9 @@ void aout_SpdifThread( aout_thread_t * p_aout )
mlast = mplay;
/* play spdif frame to the external decoder */
p_aout->pf_play( p_aout,
p_aout->fifo[i_fifo].buffer +
((byte_t*) p_aout->fifo[i_fifo].buffer +
p_aout->fifo[i_fifo].l_start_frame*
SPDIF_FRAME_SIZE,
SPDIF_FRAME_SIZE ),
p_aout->fifo[i_fifo].l_frame_size );
p_aout->fifo[i_fifo].l_start_frame =
......
......@@ -2,7 +2,7 @@
* audio_output.c : audio output thread
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: audio_output.c,v 1.62 2001/05/30 05:19:03 stef Exp $
* $Id: audio_output.c,v 1.63 2001/05/31 01:37:08 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -38,7 +38,10 @@
*****************************************************************************/
#include "defs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#ifdef WIN32 /* getpid() for win32 is located in process.h */
#include <process.h>
#endif
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.114 2001/05/30 22:16:07 sam Exp $
* $Id: input.c,v 1.115 2001/05/31 01:37:08 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -32,7 +32,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
......@@ -231,6 +237,7 @@ void input_DestroyThread( input_thread_t *p_input, int *pi_status )
static void RunThread( input_thread_t *p_input )
{
int i_error, i;
data_packet_t ** pp_packets;
if( InitThread( p_input ) )
{
......@@ -248,10 +255,16 @@ static void RunThread( input_thread_t *p_input )
p_input->stream.b_changed = 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
while( !p_input->b_die && !p_input->b_error && !p_input->b_eof )
pp_packets = (data_packet_t **) malloc( p_input->i_read_once *
sizeof( data_packet_t * ) );
if( pp_packets == NULL )
{
data_packet_t * pp_packets[p_input->i_read_once];
intf_ErrMsg( "input error: out of memory" );
p_input->b_error = 1;
}
while( !p_input->b_die && !p_input->b_error && !p_input->b_eof )
{
#ifdef STATS
p_input->c_loops++;
#endif
......@@ -324,6 +337,8 @@ static void RunThread( input_thread_t *p_input )
}
}
free( pp_packets );
if( p_input->b_error || p_input->b_eof )
{
ErrorThread( p_input );
......@@ -717,7 +732,7 @@ static void NetworkOpen( input_thread_t * p_input )
/* We may want to reuse an already used socket */
i_opt = 1;
if( setsockopt( p_input->i_handle, SOL_SOCKET, SO_REUSEADDR,
&i_opt, sizeof( i_opt ) ) == -1 )
(void*) &i_opt, sizeof( i_opt ) ) == -1 )
{
intf_ErrMsg( "input error: can't configure socket (SO_REUSEADDR: %s)",
strerror(errno));
......@@ -730,7 +745,7 @@ static void NetworkOpen( input_thread_t * p_input )
* packet loss caused by scheduling problems */
i_opt = 0x80000;
if( setsockopt( p_input->i_handle, SOL_SOCKET, SO_RCVBUF,
&i_opt, sizeof( i_opt ) ) == -1 )
(void*) &i_opt, sizeof( i_opt ) ) == -1 )
{
intf_ErrMsg( "input error: can't configure socket (SO_RCVBUF: %s)",
strerror(errno));
......
......@@ -2,7 +2,7 @@
* input_netlist.c: netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_netlist.c,v 1.37 2001/05/28 04:23:52 sam Exp $
* $Id: input_netlist.c,v 1.38 2001/05/31 01:37:08 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -29,16 +29,16 @@
#include <stdlib.h>
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef WIN32
# include <sys/uio.h> /* struct iovec */
#if !defined( WIN32 )
#include <sys/uio.h> /* struct iovec */
#else
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#include <io.h>
#include "iovec.h"
#endif
#include "config.h"
......
......@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: intf_msg.c,v 1.34 2001/05/07 03:14:09 stef Exp $
* $Id: intf_msg.c,v 1.35 2001/05/31 01:37:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -34,7 +34,10 @@
#include <stdarg.h> /* va_list for BSD */
#include <stdlib.h> /* malloc() */
#include <string.h> /* strerror() */
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* close(), write() */
#endif
#include "config.h"
#include "common.h"
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.98 2001/05/30 23:02:04 stef Exp $
* $Id: main.c,v 1.99 2001/05/31 01:37:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -51,7 +51,10 @@
#include <netinet/in.h> /* BSD: struct in_addr */
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* getenv(), strtol(), */
#include <string.h> /* strerror() */
......
......@@ -2,7 +2,7 @@
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: lpcm_decoder_thread.c,v 1.14 2001/05/01 04:18:18 sam Exp $
* $Id: lpcm_decoder_thread.c,v 1.15 2001/05/31 01:37:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -26,7 +26,9 @@
*****************************************************************************/
#include "defs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#include <stdio.h> /* "intf_msg.h" */
#include <string.h> /* memcpy(), memset() */
......
......@@ -2,7 +2,7 @@
* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.31 2001/05/30 17:03:12 sam Exp $
* $Id: modules.c,v 1.32 2001/05/31 01:37:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -34,7 +34,10 @@
#include <stdlib.h> /* free(), strtol() */
#include <stdio.h> /* sprintf() */
#include <string.h> /* strdup() */
#if !defined( _MSC_VER )
#include <dirent.h>
#endif
#if defined(HAVE_DLFCN_H) /* Linux, BSD, Hurd */
# include <dlfcn.h> /* dlopen(), dlsym(), dlclose() */
......
......@@ -3,7 +3,7 @@
* Functions are prototyped in mtime.h.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mtime.c,v 1.18 2001/05/07 04:42:42 sam Exp $
* $Id: mtime.c,v 1.19 2001/05/31 01:37:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -33,14 +33,20 @@
#include "defs.h"
#include <stdio.h> /* sprintf() */
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* select() */
#endif
#if !defined( _MSC_VER )
#include <sys/time.h>
#endif
#ifdef HAVE_KERNEL_OS_H
#include <kernel/OS.h>
#endif
#ifdef WIN32
#if defined( WIN32 )
#include <windows.h>
#endif
......@@ -58,11 +64,11 @@
char *mstrtime( char *psz_buffer, mtime_t date )
{
sprintf( psz_buffer, "%02d:%02d:%02d-%03d.%03d",
(int) (date / (1000LL * 1000LL * 60LL * 60LL) % 24LL),
(int) (date / (1000LL * 1000LL * 60LL) % 60LL),
(int) (date / (1000LL * 1000LL) % 60LL),
(int) (date / 1000LL % 1000LL),
(int) (date % 1000LL) );
(int) (date / (I64C(1000) * I64C(1000) * I64C(60) * I64C(60)) % I64C(24)),
(int) (date / (I64C(1000) * I64C(1000) * I64C(60)) % I64C(60)),
(int) (date / (I64C(1000) * I64C(1000)) % I64C(60)),
(int) (date / I64C(1000) % I64C(1000)),
(int) (date % I64C(1000)) );
return( psz_buffer );
}
......
......@@ -2,7 +2,7 @@
* netutils.c: various network functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: netutils.c,v 1.35 2001/05/30 23:02:04 stef Exp $
* $Id: netutils.c,v 1.36 2001/05/31 01:37:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Benoit Steiner <benny@via.ecp.fr>
......@@ -32,10 +32,18 @@
#include <stdlib.h> /* free(), realloc(), atoi() */
#include <errno.h> /* errno() */
#include <string.h> /* memset() */
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* gethostname() */
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#if !defined( _MSC_VER )
#include <sys/time.h> /* gettimeofday */
#endif
#ifndef WIN32
#if !defined( WIN32 )
#include <netdb.h> /* gethostbyname() */
#include <netinet/in.h> /* BSD: struct in_addr */
#include <sys/socket.h> /* BSD: struct sockaddr */
......@@ -49,7 +57,7 @@
#include <sys/ioctl.h> /* ioctl() */
#endif
#ifdef WIN32 /* tools to get the MAC adress from */
#if defined( WIN32 ) /* tools to get the MAC adress from */
#include <windows.h> /* the interface under Windows */
#include <stdio.h>
#endif
......
......@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: spu_decoder.c,v 1.45 2001/05/11 15:10:01 sam Exp $
* $Id: spu_decoder.c,v 1.46 2001/05/31 01:37:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -26,7 +26,10 @@
*****************************************************************************/
#include "defs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#ifdef WIN32 /* getpid() for win32 is located in process.h */
#include <process.h>
#endif
......
......@@ -2,7 +2,7 @@
* video_decoder.c : video decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_decoder.c,v 1.50 2001/05/30 17:03:12 sam Exp $
* $Id: video_decoder.c,v 1.51 2001/05/31 01:37:08 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gal Hendryckx <jimmy@via.ecp.fr>
......@@ -27,7 +27,9 @@
*****************************************************************************/
#include "defs.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#include <stdlib.h> /* free() */
#include <string.h> /* memcpy(), memset() */
......
......@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_text.c,v 1.26 2001/04/28 03:36:25 sam Exp $
* $Id: video_text.c,v 1.27 2001/05/31 01:37:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -32,7 +32,12 @@
#include <stdio.h> /* sprintf() */
#include <string.h> /* strerror() */
#include <fcntl.h> /* open() */
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* read(), close() */
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#endif
#ifdef SYS_BEOS
# include "beos_specific.h"
......@@ -481,7 +486,7 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
p_font->i_interspacing);
/* compute where to stop... */
i_end = (int) (i_percent * strlen(psz_text) / 100LL);
i_end = (int) (i_percent * strlen(psz_text) / I64C(100));
if(i_end > strlen(psz_text))
i_end = strlen(psz_text);
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.86 2001/05/30 17:03:13 sam Exp $
* $Id: video_parser.c,v 1.87 2001/05/31 01:37:08 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -28,7 +28,11 @@
#include "defs.h"
#include <stdlib.h> /* malloc(), free() */
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* getpid() */
#endif
#include <errno.h>
#include <string.h>
......
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