]> git.sesse.net Git - vlc/commitdiff
- activex: misc. cleanups
authorDamien Fouilleul <damienf@videolan.org>
Fri, 6 Apr 2007 20:43:33 +0000 (20:43 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Fri, 6 Apr 2007 20:43:33 +0000 (20:43 +0000)
activex/main.cpp
activex/plugin.cpp
activex/vlccontrol2.cpp

index 43c7b3bfd0adac335f26a7fda6bcf4eacf382147..e508557bc62eed8488e31bae969c9e05835ab2af 100644 (file)
@@ -121,7 +121,7 @@ static inline HKEY keyClose(HKEY hKey)
     return NULL;
 };
 
-static HRESULT UnregisterProgID(REFCLSID rclsid, unsigned int version)
+static void UnregisterProgID(REFCLSID rclsid, unsigned int version)
 {
     OLECHAR szCLSID[GUID_STRLEN];
 
index d5e2791bc80881f529886fd0d5b28f10b85bca4a..348d1419b57f23e5055bf0f373e806258285a32d 100644 (file)
@@ -429,55 +429,55 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
         char *ppsz_argv[32] = { "vlc" };
         int   ppsz_argc = 1;
 
+        char p_progpath[MAX_PATH];
+        {
+            TCHAR w_progpath[MAX_PATH];
+            DWORD len = GetModuleFileName(DllGetModule(), w_progpath, MAX_PATH);
+            if( len > 0 )
+            {
+                len = WideCharToMultiByte(CP_UTF8, 0, w_progpath, len, p_progpath,
+                           sizeof(p_progpath)-1, NULL, NULL);
+                if( len > 0 )
+                {
+                    p_progpath[len] = '\0';
+                    ppsz_argv[0] = p_progpath;
+                }
+            }
+        }
+
+        ppsz_argv[ppsz_argc++] = "-vv";
+
         HKEY h_key;
-        char p_data[MAX_PATH];
+        char p_pluginpath[MAX_PATH];
         if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, TEXT("Software\\VideoLAN\\VLC"),
                           0, KEY_READ, &h_key ) == ERROR_SUCCESS )
         {
             DWORD i_type, i_data = MAX_PATH;
-            TCHAR w_data[MAX_PATH];
+            TCHAR w_pluginpath[MAX_PATH];
             if( RegQueryValueEx( h_key, TEXT("InstallDir"), 0, &i_type,
-                                 (LPBYTE)w_data, &i_data ) == ERROR_SUCCESS )
+                                 (LPBYTE)w_pluginpath, &i_data ) == ERROR_SUCCESS )
             {
                 if( i_type == REG_SZ )
                 {
-                    if( WideCharToMultiByte(CP_UTF8, 0, w_data, -1, p_data,
-                             sizeof(p_data)-sizeof("\\plugins")+1, NULL, NULL) )
+                    if( WideCharToMultiByte(CP_UTF8, 0, w_pluginpath, -1, p_pluginpath,
+                             sizeof(p_pluginpath)-sizeof("\\plugins")+1, NULL, NULL) )
                     {
-                        strcat( p_data, "\\plugins" );
+                        strcat( p_pluginpath, "\\plugins" );
                         ppsz_argv[ppsz_argc++] = "--plugin-path";
-                        ppsz_argv[ppsz_argc++] = p_data;
+                        ppsz_argv[ppsz_argc++] = p_pluginpath;
                     }
                 }
             }
             RegCloseKey( h_key );
         }
 
-        char p_path[MAX_PATH];
-        {
-            TCHAR w_path[MAX_PATH];
-            DWORD len = GetModuleFileName(DllGetModule(), w_path, MAX_PATH);
-            if( len > 0 )
-            {
-                len = WideCharToMultiByte(CP_UTF8, 0, w_path, len, p_path,
-                           sizeof(p_path)-1, NULL, NULL);
-                if( len > 0 )
-                {
-                    p_path[len] = '\0';
-                    ppsz_argv[0] = p_path;
-                }
-            }
-        }
-
         // make sure plugin isn't affected with VLC single instance mode
         ppsz_argv[ppsz_argc++] = "--no-one-instance";
 
         /* 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";
+        ppsz_argv[ppsz_argc++] = "--intf=dummy";
 
         // loop mode is a configuration option only
         if( _b_autoloop )
@@ -497,6 +497,8 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
             ppsz_argv[ppsz_argc++] = "--win9x-cv-method=1";
         }
 
+DebugBreak();
+
         _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, NULL);
         if( NULL == _p_libvlc )
         {
index 2b01b84b00c47237df0f7d00ab53c453ff2097ed..a04228203f89d288325e243d950b9ccc3bc6510f 100644 (file)
@@ -628,6 +628,7 @@ STDMETHODIMP VLCInput::get_fps(double* fps)
     if( NULL == fps )
         return E_POINTER;
 
+    *fps = 0.0;
     libvlc_instance_t* p_libvlc;
     HRESULT hr = _p_instance->getVLC(&p_libvlc);
     if( SUCCEEDED(hr) )
@@ -2606,12 +2607,13 @@ STDMETHODIMP VLCControl2::get_VersionInfo(BSTR *version)
     if( NULL != versionStr )
     {
         *version = BSTRFromCStr(CP_UTF8, versionStr);
+
         return NULL == *version ? E_OUTOFMEMORY : NOERROR;
     }
     *version = NULL;
     return E_FAIL;
 };
+
 STDMETHODIMP VLCControl2::get_Visible(VARIANT_BOOL *isVisible)
 {
     if( NULL == isVisible )