]> git.sesse.net Git - vlc/blobdiff - src/misc/win32_specific.c
* ALL: using "%ll" in printf format strings is not portable (notably on win32) so
[vlc] / src / misc / win32_specific.c
index 798bb4bd2844d3f34c82bc531f6110b2f9f8a55b..643f177de81b14f08d36de71ccf24c0e8339a700 100644 (file)
@@ -2,9 +2,10 @@
  * win32_specific.c: Win32 specific features 
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: win32_specific.c,v 1.2 2001/11/14 00:01:36 jlj Exp $
+ * $Id: win32_specific.c,v 1.18 2002/11/08 10:26:53 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
+ *          Gildas Bazin <gbazin@netcourrier.com>
  *
  * 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
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
-#include "defs.h"
-
+#include <errno.h>                                                 /* ENOMEM */
 #include <string.h>                                              /* strdup() */
 #include <stdlib.h>                                                /* free() */
 #include <fcntl.h>
 
 #include <winsock2.h>
 
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "win32_specific.h"
+#include <vlc/vlc.h>
 
 /*****************************************************************************
- * system_Init: initialize winsock.
+ * system_Init: initialize winsock and misc other things.
  *****************************************************************************/
-void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
+void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
 {
     WSADATA Data;
     int i_err;
@@ -47,17 +43,42 @@ void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
 
     if( i_err )
     {
-        fprintf( stderr, "error: can't initiate WinSocks, error %i", i_err );
+        fprintf( stderr, "error: can't initiate WinSocks, error %i\n", i_err );
     }
 
-    _fmode = _O_BINARY;  /* sets the default file-translation mode */
+    /* Set the default file-translation mode */
+    _fmode = _O_BINARY;
+}
+
+/*****************************************************************************
+ * system_Configure: check for system specific configuration options.
+ *****************************************************************************/
+void system_Configure( vlc_t *p_this )
+{
+    p_this->p_libvlc->b_fast_mutex = config_GetInt( p_this, "fast-mutex" );
+    p_this->p_libvlc->i_win9x_cv = config_GetInt( p_this, "win9x-cv-method" );
+
+    /* Raise default priority of the current process */
+#ifndef ABOVE_NORMAL_PRIORITY_CLASS
+#   define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
+#endif
+    if( !SetPriorityClass( GetCurrentProcess(),
+                          ABOVE_NORMAL_PRIORITY_CLASS ) )
+    {
+        if( !SetPriorityClass( GetCurrentProcess(),
+                              HIGH_PRIORITY_CLASS ) )
+           msg_Dbg( p_this, "can't raise process priority" );
+       else
+           msg_Dbg( p_this, "raised process priority" );
+    }
+    else
+       msg_Dbg( p_this, "raised process priority" );
 }
 
 /*****************************************************************************
  * system_End: terminate winsock.
  *****************************************************************************/
-void system_End( void )
+void system_End( vlc_t *p_this )
 {
     WSACleanup();
 }
-