]> git.sesse.net Git - vlc/blobdiff - projects/activex/plugin.cpp
libvlccore: Don't set the priority on first thread on Mac OS X.
[vlc] / projects / activex / plugin.cpp
index e234c67fc17b161d67b229e2fe19e45da6b70957..72d9848e90b200661dfd9c8472def01b34b2b0e3 100644 (file)
@@ -106,7 +106,7 @@ VLCPluginClass::VLCPluginClass(LONG *p_class_ref, HINSTANCE hInstance, REFCLSID
         _inplace_wndclass_atom = 0;
     }
 
-    HBITMAP hbitmap = (HBITMAP)LoadImage(getHInstance(), MAKEINTRESOURCE(1), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
+    HBITMAP hbitmap = (HBITMAP)LoadImage(getHInstance(), MAKEINTRESOURCE(2), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
     if( NULL != hbitmap )
     {
         PICTDESC pictDesc;
@@ -349,15 +349,16 @@ HRESULT VLCPlugin::onInit(void)
     if( NULL == _p_libvlc )
     {
         // initialize persistable properties
-        _b_autoplay = TRUE;
-        _b_autoloop = FALSE;
+        _b_autoplay   = TRUE;
+        _b_autoloop   = FALSE;
+        _b_toolbar    = FALSE;
         _bstr_baseurl = NULL;
-        _bstr_mrl = NULL;
-        _b_visible = TRUE;
-        _b_mute = FALSE;
-        _i_volume = 50;
-        _i_time   = 0;
-        _i_backcolor = 0;
+        _bstr_mrl     = NULL;
+        _b_visible    = TRUE;
+        _b_mute       = FALSE;
+        _i_volume     = 50;
+        _i_time       = 0;
+        _i_backcolor  = 0;
         // set default/preferred size (320x240) pixels in HIMETRIC
         HDC hDC = CreateDevDC(NULL);
         _extent.cx = 320;
@@ -409,21 +410,6 @@ HRESULT VLCPlugin::onLoad(void)
     return S_OK;
 };
 
-HRESULT VLCPlugin::getVLCObject(int* i_vlc)
-{
-    libvlc_instance_t *p_libvlc;
-    HRESULT result = getVLC(&p_libvlc);
-    if( SUCCEEDED(result) )
-    {
-        *i_vlc = libvlc_get_vlc_id(p_libvlc);
-    }
-    else
-    {
-        *i_vlc = 0;
-    }
-    return result;
-}
-
 HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
 {
     extern HMODULE DllGetModule();
@@ -433,8 +419,8 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
         /*
         ** default initialization options
         */
-        const char *ppsz_argv[32] = { "vlc" };
-        int   ppsz_argc = 1;
+        const char *ppsz_argv[32] = { };
+        int   ppsz_argc = 0;
 
         char p_progpath[MAX_PATH];
         {
@@ -484,16 +470,21 @@ HRESULT VLCPlugin::getVLC(libvlc_instance_t** pp_libvlc)
         /* common settings */
         ppsz_argv[ppsz_argc++] = "--no-stats";
         ppsz_argv[ppsz_argc++] = "--no-media-library";
+        ppsz_argv[ppsz_argc++] = "--ignore-config";
         ppsz_argv[ppsz_argc++] = "--intf=dummy";
 
         // loop mode is a configuration option only
         if( _b_autoloop )
             ppsz_argv[ppsz_argc++] = "--loop";
 
-        _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, NULL);
-        if( NULL == _p_libvlc )
+        libvlc_exception_t ex;
+        libvlc_exception_init(&ex);
+
+        _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv, &ex);
+        if( libvlc_exception_raised(&ex) )
         {
             *pp_libvlc = NULL;
+            libvlc_exception_clear(&ex);
             return E_FAIL;
         }
 
@@ -667,7 +658,8 @@ HRESULT VLCPlugin::onClose(DWORD dwSaveOption)
         _p_libvlc = NULL;
         vlcDataObject->onClose();
 
-        libvlc_release(p_libvlc);
+        if( p_libvlc )
+            libvlc_release(p_libvlc);
     }
     return S_OK;
 };
@@ -818,11 +810,11 @@ void VLCPlugin::setTime(int seconds)
         setStartTime(_i_time);
         if( isRunning() )
         {
-            libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(_p_libvlc, NULL);
+            libvlc_media_player_t *p_md = libvlc_playlist_get_media_player(_p_libvlc, NULL);
             if( NULL != p_md )
             {
-                libvlc_media_instance_set_time(p_md, _i_time, NULL);
-                libvlc_media_instance_release(p_md);
+                libvlc_media_player_set_time(p_md, _i_time, NULL);
+                libvlc_media_player_release(p_md);
             }
         }
     }