]> git.sesse.net Git - vlc/blobdiff - src/vlc.c
* Merged trunk changesets 9290 and 9291 to 0.8.1 branch.
[vlc] / src / vlc.c
index b4c1bda17b0f8afd003eaab5b0216f0f32d38ad0..6308970931d3cd6841cf386b3ac6b67d67be8547 100644 (file)
--- a/src/vlc.c
+++ b/src/vlc.c
@@ -41,7 +41,7 @@
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-#ifndef WIN32
+#if !defined(WIN32) && !defined(UNDER_CE)
 static void SigHandler  ( int i_signal );
 #endif
 
@@ -80,7 +80,7 @@ int main( int i_argc, char *ppsz_argv[] )
         return i_ret;
     }
 
-#ifndef WIN32
+#if !defined(WIN32) && !defined(UNDER_CE)
     /* Set the signal handlers. SIGTERM is not intercepted, because we need at
      * least one method to kill the program when all other methods failed, and
      * when we don't want to use SIGKILL.
@@ -113,7 +113,7 @@ int main( int i_argc, char *ppsz_argv[] )
     return i_ret;
 }
 
-#ifndef WIN32
+#if !defined(WIN32) && !defined(UNDER_CE)
 /*****************************************************************************
  * SigHandler: system signal handler
  *****************************************************************************
@@ -155,3 +155,31 @@ static void SigHandler( int i_signal )
     }
 }
 #endif
+
+#if defined(UNDER_CE)
+#include "vlc_common.h"
+/*****************************************************************************
+ * WinMain: parse command line, start interface and spawn threads. (WinCE only)
+ *****************************************************************************/
+int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
+                    LPTSTR lpCmdLine, int nCmdShow )
+{
+    char **argv, psz_cmdline[MAX_PATH];
+    int argc, i_ret;
+
+    WideCharToMultiByte( CP_ACP, 0, lpCmdLine, -1,
+                         psz_cmdline, MAX_PATH, NULL, NULL );
+
+    argv = vlc_parse_cmdline( psz_cmdline, &argc );
+    argv = realloc( argv, (argc + 1) * sizeof(char *) );
+    if( !argv ) return -1;
+
+    if( argc ) memmove( argv + 1, argv, argc * sizeof(char *) );
+    argv[0] = ""; /* Fake program path */
+
+    i_ret = main( argc + 1, argv );
+
+    /* No need to free the argv memory */
+    return i_ret;
+}
+#endif