]> git.sesse.net Git - vlc/commitdiff
* Applied patch from Jon Lech Johansen <jon-vl@nanocrew.net> to compile
authorSam Hocevar <sam@videolan.org>
Thu, 31 May 2001 01:37:08 +0000 (01:37 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 31 May 2001 01:37:08 +0000 (01:37 +0000)
    vlc with MS and Intel C/C++ compilers.

36 files changed:
include/common.h
include/int_types.h
include/intf_msg.h
include/iovec.h [new file with mode: 0644]
plugins/dummy/aout_dummy.c
plugins/dummy/intf_dummy.c
plugins/dvd/dvd_css.c
plugins/dvd/dvd_ifo.c
plugins/dvd/dvd_ioctl.c
plugins/dvd/dvd_netlist.c
plugins/dvd/dvd_summary.c
plugins/dvd/dvd_udf.c
plugins/dvd/input_dvd.c
plugins/mpeg/input_es.c
plugins/mpeg/input_ps.c
plugins/mpeg/input_ps.h
plugins/mpeg/input_ts.c
plugins/mpeg/input_ts.h
src/ac3_decoder/ac3_decoder_thread.c
src/ac3_spdif/ac3_iec958.c
src/ac3_spdif/ac3_spdif.c
src/audio_decoder/audio_decoder.c
src/audio_output/aout_spdif.c
src/audio_output/audio_output.c
src/input/input.c
src/input/input_netlist.c
src/interface/intf_msg.c
src/interface/main.c
src/lpcm_decoder/lpcm_decoder_thread.c
src/misc/modules.c
src/misc/mtime.c
src/misc/netutils.c
src/spu_decoder/spu_decoder.c
src/video_decoder/video_decoder.c
src/video_output/video_text.c
src/video_parser/video_parser.c

index 423eeb9e6e91849c55206378530e09a74dec1fa5..d2a2c9488d771ded4f477bed55cfc99689455487 100644 (file)
@@ -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
index b4bcc140d705b85da2ff05120bc8d24738720425..bc5a1a9c4b8077c9577b3902ea461822d0b1c24f 100644 (file)
@@ -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
index d36b481c5e24d7b01a4a57c3b3168a603b7ed29b..5bbd6c6c61cc3a320cd444f6387be66b961bdb21 100644 (file)
@@ -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
 
diff --git a/include/iovec.h b/include/iovec.h
new file mode 100644 (file)
index 0000000..26c348c
--- /dev/null
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * 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
index 6e4a6f8e32a56b26a91bf6d840e583a5ba537afa..ef779eed82f362b6ddb72e9ce1db803064bd70f9 100644 (file)
@@ -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;
 
 /*****************************************************************************
index 0ff9e0488e44dba79c2ae8820f1819c51d45b31f..0961f6d12213a8ea19eb3f55a3711f3f17b2d96f 100644 (file)
@@ -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;
 
 /*****************************************************************************
index a3e0b4c07cc665f779d40b3d7a0bbf08c1069278..ab73262471a407d0712d80479ed3b4a5e24bfb47 100644 (file)
@@ -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: Stéphane Borel <stef@via.ecp.fr>
  *
 
 #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"
index 717dd6d7213dba0649603bebabc9e2d7b17a23b1..5644b170b700c015a2c7504ffe72af018a2de29f 100644 (file)
@@ -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: Stéphane Borel <stef@via.ecp.fr>
  *
 
 #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>
 
index 474db5ca627176eb3a7ca76a59dc6b8bf59561f6..67903b1187dad61f79cf63d614938de4cc83efca 100644 (file)
@@ -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>
 
 #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>
index 41a380c89ebd82dcab0bf53f8d953fd1e2c60348..34272c6a4463857db65a3cd7eaeac1b07151102b 100644 (file)
@@ -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>
  *          Stéphane Borel <stef@videolan.org>
 #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"
index 83c5e4b735a2ed137d97f43919ad19a1cfcf547a..c5da11ec56d44307881f94e9871adc6a434cce0b 100644 (file)
@@ -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: Stéphane Borel <stef@via.ecp.fr>
  *
 
 #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
index 50d2ef78e3b9059bd0a1de6c0e4074b1d7da770f..77c027cf969e5b9f75053ae6d15ecad3e4b06062 100644 (file)
@@ -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: Stéphane Borel <stef@via.ecp.fr>
  *
 #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>
index 8c1f6101f9ca078b0e4231c52114176a60d5f355..4462bc435d56f0a9ef3409445edbaa24017338d7 100644 (file)
@@ -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: Stéphane Borel <stef@via.ecp.fr>
  *
 
 #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
 #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;
index 6acbebfa49e30c62ad9f69722e1412080b51d01d..5b9591db6514c3aa229604be0bc8bf9b024b1f1e 100644 (file)
@@ -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: 
  *
 
 #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"
index 856856c723f61ca56ab35a7e85f1ffb8ebb383d5..f8a4cddf4b633b768592fea4c84485d871eff0c0 100644 (file)
@@ -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>
 
 #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"
index 4b37119e1bbe1359b60bc1627e9a681dfdb04d98..c59fb8a1f4bbc64d6fc28adfaf326d6e13eb04f8 100644 (file)
@@ -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>
  * 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
  *****************************************************************************/
index e69b46164a9fba5ee3034d76f6880272a9e226a3..a2bb081457f9b3a95ed1117bf4a40d3c69afd1fc 100644 (file)
@@ -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>
  *
 #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"
index 088d7899859b0166266c0e9a778e87a3e33b709c..633c3e7b92b6e574ba1f1509e26bfd21c9be9d81 100644 (file)
@@ -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
-
index 17e86ac2bcf06e0ceae70c09fada3f4a2d7afa53..1bb8db30f64549f92851c6597a1d88bdd79b27ba 100644 (file)
@@ -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() */
index b9f6b9cf2030445341266bef66ae55cf026d99a7..824554df1458f1a6b85818153fc2d49a742d04b8 100644 (file)
@@ -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: Stéphane Borel <stef@via.ecp.fr>
  *          Juha Yrjola <jyrjola@cc.hut.fi>
 #include <stdlib.h>
 #include <string.h>                                              /* memset() */
 #include <fcntl.h>
+
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #include "config.h"
 #include "common.h"
index 71000a9a99deec1fb0fa9feba9fed83f8ff6c29c..5787f6344cd06bc3802c88adef5a453b02a68926 100644 (file)
@@ -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: Stéphane Borel <stef@via.ecp.fr>
  *          Juha Yrjola <jyrjola@cc.hut.fi>
 #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 );
index 763c3aac829147ed700dd8a3697dec787ee7a27b..4b6c7848f1d95d4d56380dd78d63b51ac04373c2 100644 (file)
@@ -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() */
index cc2c6525aa39b63e30fa5d4c2c2c96d71f30d408..8376930edc61deb3082646c02978774ecd9b6d33 100644 (file)
@@ -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>
  *          Stéphane 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 = 
index 098108e92a33346f281ad5a1ea5cafa2672b09f4..1c0633ffd3e077cfabcd9dba12282a49e6a3f01b 100644 (file)
@@ -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>
  *
  *****************************************************************************/
 #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
index aa46afc39814f30dd34747ecbdeea162373c6cd1..1b225dd9d835a3bb852bd9e393fad99200262ef0 100644 (file)
@@ -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>
  *
 #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));
index 31203ef74285fded6cce8d86f3785df9a0bb5645..7464714fbca06a06edbbedd8a6865fbcec29d5fd 100644 (file)
@@ -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>
  *
 #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"
index 6e93d3ea2dc297ebe7048d10b10b283b14fbab38..5b47a3fdb6a0527b310824c33d92066eda17aed4 100644 (file)
@@ -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>
  *
 #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"
index dffeaa1ca3a6f14b7eee89dd731d601a90f34eca..3f86e43a6317797bd6124466ed1bcb4c9a552eb1 100644 (file)
@@ -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>
 #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() */
index 9a3c3d260c988bf5f699b7bcbfed187cfd2bcccd..cecef936eddf2564cf701a97304734dfe3e66052 100644 (file)
@@ -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() */
index aad88dfc4af94f2ee16a2942cfc72d251c69c14a..d31f7dde76362f4597f25543e85d5cbf7cfd5dcd 100644 (file)
@@ -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>
 #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() */
index e0204f95cc5ca4e8f81d92345ba8cfad666f061e..86b51ee24c293182fae57543e14833e18bd35695 100644 (file)
@@ -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>
  *
 #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
 
 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 );
 }
 
index cfa3214c469b2464bdf6892b2d39494599c4db28..5d163c2dfefaf4dcdf5e26bc0d7976d3f13107bb 100644 (file)
@@ -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>
 #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
index cf5cbbe862efbf00b823d27d42b0f66e57b213f4..d3818b34c50cfeb9a0d99ab96cd44d0bc455c38c 100644 (file)
@@ -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>
  *
  *****************************************************************************/
 #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
index 769aaa21169785d60d7b04d63c6e08cad47a4a4f..b30440ecd86235270b24214d9e6d44b7db5f2642 100644 (file)
@@ -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>
  *          Gaël 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() */
index f94efbd3b84ddbed2dd89960c2dcc12cd7b67539..0a7a588f58d2309bdd9145019f404cbc77083c26 100644 (file)
@@ -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>
 #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);
     
index 957c81a5c7354edeb40b50cb22dca82e5ca6c9bb..aa152305067e9d7e2f5b1369ff902177fd50f5ff 100644 (file)
@@ -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>
 #include "defs.h"
 
 #include <stdlib.h>                                      /* malloc(), free() */
+
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>                                              /* getpid() */
+#endif
+
 #include <errno.h>
 #include <string.h>