]> git.sesse.net Git - vlc/blobdiff - src/misc/win32_specific.c
input: Don't assume the playlist always exists.
[vlc] / src / misc / win32_specific.c
index caea874f9578d9e18b8d99e385c8745de380f0ed..8e6d91b58b1721131269bbee14db167985216863 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include "../libvlc.h"
 #include <vlc_playlist.h>
@@ -34,6 +38,7 @@
 #if !defined( UNDER_CE )
 #   include <io.h>
 #   include <fcntl.h>
+#   include  <mmsystem.h>
 #endif
 
 #include <winsock.h>
@@ -41,7 +46,7 @@
 /*****************************************************************************
  * system_Init: initialize winsock and misc other things.
  *****************************************************************************/
-void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
+void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
 {
     WSADATA Data;
 
@@ -90,6 +95,8 @@ void system_Init( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
 #if !defined( UNDER_CE )
     _fmode = _O_BINARY;
     _setmode( _fileno( stdin ), _O_BINARY ); /* Needed for pipes */
+
+    timeBeginPeriod(5);
 #endif
 
     /* Call mdate() once to make sure it is initialized properly */
@@ -135,7 +142,7 @@ typedef struct
   char data[0];
 } vlc_ipc_data_t;
 
-void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
+void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
 {
 #if !defined( UNDER_CE )
     /* Raise default priority of the current process */
@@ -237,7 +244,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, char *ppsz_argv[] )
                      * with stronger alignment requirements, right. */
                     *((size_t *)(p_data->data + i_data)) = i_len;
                     i_data += sizeof (size_t);
-                    memcpy( &p_data[i_data], ppsz_argv[ i_opt ], i_len );
+                    memcpy( &p_data->data[i_data], ppsz_argv[ i_opt ], i_len );
                     i_data += i_len;
                 }
                 i_data += sizeof (*p_data);
@@ -281,7 +288,7 @@ static void IPCHelperThread( vlc_object_t *p_this )
                   NULL );                               /* sent to WM_CREATE */
 
     SetWindowLong( ipcwindow, GWL_WNDPROC, (LONG)WMCOPYWNDPROC );
-    SetWindowLong( ipcwindow, GWL_USERDATA, (LONG)p_this );
+    SetWindowLongPtr( ipcwindow, GWL_USERDATA, (LONG_PTR)p_this );
 
     /* Signal the creation of the thread and events queue */
     vlc_thread_ready( p_this );
@@ -302,7 +309,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
         vlc_object_t *p_this;
         playlist_t *p_playlist;
 
-        p_this = (vlc_object_t *)GetWindowLong( hwnd, GWL_USERDATA );
+        p_this = (vlc_object_t *)GetWindowLongPtr( hwnd, GWL_USERDATA );
 
         if( !p_this ) return 0;
 
@@ -366,5 +373,9 @@ void system_End( libvlc_int_t *p_this )
         vlc_global()->psz_vlcpath = NULL;
     }
 
+#if !defined( UNDER_CE )
+    timeEndPeriod(5);
+#endif
+
     WSACleanup();
 }