]> git.sesse.net Git - vlc/blobdiff - mozilla/vlcshell.cpp
- activate (make visible) as soon as embedded into a container, no longer wait for...
[vlc] / mozilla / vlcshell.cpp
index 327efa40e76d532feab1a3acc0465aa8e0c08b41..c5be39751c4c893ffd74fec33caf92cef8f71e62 100644 (file)
@@ -196,7 +196,7 @@ int16 NPP_HandleEvent( NPP instance, void * event )
     if (pouetEvent->what == 6)
     {
         value.i_int = 1;
-        VLC_Set( p_plugin->i_vlc, "drawableredraw", value );
+        VLC_VariableSet( p_plugin->i_vlc, "drawableredraw", value );
         return true;
     }
 
@@ -342,11 +342,11 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
     }
 
     value.psz_string = "dummy";
-    VLC_Set( p_plugin->i_vlc, "conf::intf", value );
+    VLC_VariableSet( p_plugin->i_vlc, "conf::intf", value );
     value.psz_string = VOUT_PLUGINS;
-    VLC_Set( p_plugin->i_vlc, "conf::vout", value );
+    VLC_VariableSet( p_plugin->i_vlc, "conf::vout", value );
     value.psz_string = AOUT_PLUGINS;
-    VLC_Set( p_plugin->i_vlc, "conf::aout", value );
+    VLC_VariableSet( p_plugin->i_vlc, "conf::aout", value );
 
 #else
     p_plugin->i_vlc = 1;
@@ -392,7 +392,7 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
             if( !strcmp( argv[i], "yes" ) )
             {
                 value.b_bool = VLC_TRUE;
-                VLC_Set( p_plugin->i_vlc, "conf::loop", value );
+                VLC_VariableSet( p_plugin->i_vlc, "conf::loop", value );
             }
         }
         else if( !strcmp( argn[i], "fullscreen" ) )
@@ -400,7 +400,14 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
             if( !strcmp( argv[i], "yes" ) )
             {
                 value.b_bool = VLC_TRUE;
-                VLC_Set( p_plugin->i_vlc, "conf::fullscreen", value );
+                VLC_VariableSet( p_plugin->i_vlc, "conf::fullscreen", value );
+            }
+        }
+        else if( !strcmp( argn[i], "mute" ) )
+        {
+            if( !strcmp( argv[i], "yes" ) )
+            {
+                VLC_VolumeMute( p_plugin->i_vlc );
             }
         }
 #endif
@@ -414,6 +421,37 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
     return NPERR_NO_ERROR;
 }
 
+#ifdef XP_WIN
+/* This is really ugly but there is a deadlock when stopping a stream
+ * (in VLC_CleanUp()) because the video output is a child of the drawable but
+ * is in a different thread. */
+static void HackStopVout( VlcPlugin* p_plugin )
+{
+    MSG msg;
+    HWND hwnd;
+    vlc_value_t value;
+
+    VLC_VariableGet( p_plugin->i_vlc, "drawable", &value );
+
+    hwnd = FindWindowEx( (HWND)value.i_int, 0, 0, 0 );
+    if( !hwnd ) return;
+
+    PostMessage( hwnd, WM_CLOSE, 0, 0 );
+
+    do
+    {
+        fprintf( stderr, "FindWindow: %p\n", hwnd );
+        while( PeekMessage( &msg, (HWND)value.i_int, 0, 0, PM_REMOVE ) )
+        {
+            TranslateMessage(&msg);
+            DispatchMessage(&msg);
+        }
+        if( FindWindowEx( (HWND)value.i_int, 0, 0, 0 ) ) Sleep( 10 );
+    }
+    while( (hwnd = FindWindowEx( (HWND)value.i_int, 0, 0, 0 )) );
+}
+#endif
+
 NPError NPP_Destroy( NPP instance, NPSavedData** save )
 {
     if( instance == NULL )
@@ -428,7 +466,10 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
         if( p_plugin->i_vlc )
         {
 #if USE_LIBVLC
-            VLC_Stop( p_plugin->i_vlc );
+#   ifdef XP_WIN
+            HackStopVout( p_plugin );
+#   endif
+            VLC_CleanUp( p_plugin->i_vlc );
             VLC_Destroy( p_plugin->i_vlc );
 #endif
             p_plugin->i_vlc = 0;
@@ -478,12 +519,12 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
 
 #ifdef XP_MACOSX
     value.i_int = ((NP_Port*) (window->window))->port;
-    VLC_Set( p_plugin->i_vlc, "drawable", value );
+    VLC_VariableSet( p_plugin->i_vlc, "drawable", value );
 
     valueportx.i_int = ((NP_Port*) (window->window))->portx;
     valueporty.i_int = ((NP_Port*) (window->window))->porty;
-    VLC_Set( p_plugin->i_vlc, "drawableportx", valueportx );
-    VLC_Set( p_plugin->i_vlc, "drawableporty", valueporty );
+    VLC_VariableSet( p_plugin->i_vlc, "drawableportx", valueportx );
+    VLC_VariableSet( p_plugin->i_vlc, "drawableporty", valueporty );
 
     valuex.i_int = window->x;
     valuey.i_int = window->y;
@@ -494,14 +535,14 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
     valueb.i_int = window->clipRect.bottom;
     valuer.i_int = window->clipRect.right;
 
-    VLC_Set( p_plugin->i_vlc, "drawablet", valuet );
-    VLC_Set( p_plugin->i_vlc, "drawablel", valuel );
-    VLC_Set( p_plugin->i_vlc, "drawableb", valueb );
-    VLC_Set( p_plugin->i_vlc, "drawabler", valuer );
-    VLC_Set( p_plugin->i_vlc, "drawablex", valuex );
-    VLC_Set( p_plugin->i_vlc, "drawabley", valuey );
-    VLC_Set( p_plugin->i_vlc, "drawablew", valuew );
-    VLC_Set( p_plugin->i_vlc, "drawableh", valueh );
+    VLC_VariableSet( p_plugin->i_vlc, "drawablet", valuet );
+    VLC_VariableSet( p_plugin->i_vlc, "drawablel", valuel );
+    VLC_VariableSet( p_plugin->i_vlc, "drawableb", valueb );
+    VLC_VariableSet( p_plugin->i_vlc, "drawabler", valuer );
+    VLC_VariableSet( p_plugin->i_vlc, "drawablex", valuex );
+    VLC_VariableSet( p_plugin->i_vlc, "drawabley", valuey );
+    VLC_VariableSet( p_plugin->i_vlc, "drawablew", valuew );
+    VLC_VariableSet( p_plugin->i_vlc, "drawableh", valueh );
 
     p_plugin->window = window;
 
@@ -527,7 +568,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
 #else
     /* FIXME: this cast sucks */
     value.i_int = (int) (ptrdiff_t) (void *) window->window;
-    VLC_Set( p_plugin->i_vlc, "drawable", value );
+    VLC_VariableSet( p_plugin->i_vlc, "drawable", value );
 #endif
 
 #endif