]> git.sesse.net Git - vlc/blobdiff - mozilla/vlcplugin.cpp
Hide vlc_fix_readdir_charset. It is now integrated in the UTF-8 wrappers.
[vlc] / mozilla / vlcplugin.cpp
index 9e68adb923e146bf936738e44e75a4b66a85059e..f83ebec3f3fec401d02458a465e1ed39f5a1daa4 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
+ *          Damien Fouilleul <damienf.fouilleul@laposte.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
@@ -66,14 +67,8 @@ static int boolValue(const char *value) {
 NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
 {
     /* prepare VLC command line */
-    char *ppsz_argv[32] =
-    {
-        "vlc",
-        "-vv",
-        "--no-stats",
-        "--intf", "dummy",
-    };
-    int ppsz_argc = 5;
+    char *ppsz_argv[32] = { "vlc" };
+    int ppsz_argc = 1;
 
     /* locate VLC module path */
 #ifdef XP_MACOSX
@@ -92,16 +87,42 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
          {
              if( i_type == REG_SZ )
              {
-                 strcat( p_data, "\\vlc" );
-                 ppsz_argv[0] = p_data;
+                 strcat( p_data, "\\plugins" );
+                 ppsz_argv[ppsz_argc++] = "--plugin-path";
+                 ppsz_argv[ppsz_argc++] = p_data;
              }
          }
          RegCloseKey( h_key );
     }
     ppsz_argv[ppsz_argc++] = "--no-one-instance";
+    if( IsDebuggerPresent() )
+    {
+        /*
+        ** VLC default threading mechanism is designed to be as compatible
+        ** with POSIX as possible. However when debugged on win32, threads
+        ** lose signals and eventually VLC get stuck during initialization.
+        ** threading support can be configured to be more debugging friendly
+        ** but it will be less compatible with POSIX.
+        ** This is done by initializing with the following options:
+        */
+        ppsz_argv[ppsz_argc++] = "--fast-mutex";
+        ppsz_argv[ppsz_argc++] = "--win9x-cv-method=1";
+    }
+
+
+#if 0
+    ppsz_argv[0] = "C:\\Cygwin\\home\\damienf\\vlc-trunk\\vlc";
+#endif
 
 #endif /* XP_MACOSX */
 
+    /* common settings */
+    ppsz_argv[ppsz_argc++] = "-vv";
+    ppsz_argv[ppsz_argc++] = "--no-stats";
+    ppsz_argv[ppsz_argc++] = "--no-media-library";
+    ppsz_argv[ppsz_argc++] = "--intf";
+    ppsz_argv[ppsz_argc++] = "dummy";
+
     const char *version = NULL;
 
     /* parse plugin arguments */
@@ -152,9 +173,9 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
             }
         }
         else if( !strcmp( argn[i], "version") )
-       {
-           version = argv[i];
-       }
+        {
+            version = argv[i];
+        }
     }
 
     libvlc_instance = libvlc_new(ppsz_argc, ppsz_argv, NULL);
@@ -209,13 +230,13 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
     /* assign plugin script root class */
     if( (NULL != version) && (!strcmp(version, "VideoLAN.VLCPlugin.2")) )
     {
-       /* new APIs */
-       scriptClass = new RuntimeNPClass<LibvlcRootNPObject>();
+        /* new APIs */
+        scriptClass = RuntimeNPClass<LibvlcRootNPObject>::getClass();
     }
     else
     {
-       /* legacy APIs */
-       scriptClass = new RuntimeNPClass<VlcNPObject>();
+        /* legacy APIs */
+        scriptClass = RuntimeNPClass<VlcNPObject>::getClass();
     }
 
     return NPERR_NO_ERROR;
@@ -259,7 +280,7 @@ VlcPlugin::~VlcPlugin()
     delete psz_baseURL;
     delete psz_target;
     if( libvlc_instance )
-        libvlc_destroy(libvlc_instance);
+        libvlc_destroy(libvlc_instance, NULL );
 }
 
 /*****************************************************************************