* XPCOM implementation in mozilla plugin on MacOSX (Play, pause, stop
authorSimon Latapie <garf@videolan.org>
Tue, 19 Aug 2003 14:07:51 +0000 (14:07 +0000)
committerSimon Latapie <garf@videolan.org>
Tue, 19 Aug 2003 14:07:51 +0000 (14:07 +0000)
 *  buttons. Fullscreen disabled ).

modules/gui/macosx/vout.h
modules/gui/macosx/vout.m
mozilla/support/npmac.cpp
mozilla/vlcpeer.cpp
mozilla/vlcshell.cpp

index b65be8f..7debaa5 100644 (file)
@@ -2,7 +2,7 @@
  * vout.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
  * vout.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.h,v 1.12 2003/08/14 12:38:03 garf Exp $
+ * $Id: vout.h,v 1.13 2003/08/19 14:07:51 garf Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -88,6 +88,7 @@ struct vout_sys_t
     ImageDescriptionHandle h_img_descr;
     Ptr p_fullscreen_state;
     RgnHandle mask;
     ImageDescriptionHandle h_img_descr;
     Ptr p_fullscreen_state;
     RgnHandle mask;
+    Rect rect;
     int portx;
     int porty;
     int isplugin;
     int portx;
     int porty;
     int isplugin;
index cd4c588..49a8b02 100644 (file)
@@ -2,7 +2,7 @@
 /* vout.m: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
 /* vout.m: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.m,v 1.51 2003/08/14 12:38:03 garf Exp $
+ * $Id: vout.m,v 1.52 2003/08/19 14:07:51 garf Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -147,6 +147,11 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
     if( value_drawable.i_int != 0 )
     {
         p_vout->p_sys->mask = NewRgn();
     if( value_drawable.i_int != 0 )
     {
         p_vout->p_sys->mask = NewRgn();
+        p_vout->p_sys->rect.left = 0 ;
+        p_vout->p_sys->rect.right = 0 ;
+        p_vout->p_sys->rect.top = 0 ;
+        p_vout->p_sys->rect.bottom = 0 ;
+
         p_vout->p_sys->isplugin = 1 ;
     
     } else
         p_vout->p_sys->isplugin = 1 ;
     
     } else
@@ -466,16 +471,23 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
 {
     OSErr err;
     CodecFlags flags;
 {
     OSErr err;
     CodecFlags flags;
+    Rect oldrect;
+    RgnHandle oldClip;
 
     if( p_vout->p_sys->isplugin )
     {
 
     if( p_vout->p_sys->isplugin )
     {
+        oldClip = NewRgn();
 
         /* In mozilla plugin, mozilla browser also draws things in
          * the windows. So we have to update the port/Origin for each
          * picture. FIXME : the vout should lock something ! */
         GetPort( &p_vout->p_sys->p_qdportold );
 
         /* In mozilla plugin, mozilla browser also draws things in
          * the windows. So we have to update the port/Origin for each
          * picture. FIXME : the vout should lock something ! */
         GetPort( &p_vout->p_sys->p_qdportold );
+       GetPortBounds( p_vout->p_sys->p_qdportold, &oldrect );
+        GetClip( oldClip );
+
         SetPort( p_vout->p_sys->p_qdport );
         SetOrigin( p_vout->p_sys->portx , p_vout->p_sys->porty );
         SetPort( p_vout->p_sys->p_qdport );
         SetOrigin( p_vout->p_sys->portx , p_vout->p_sys->porty );
+        ClipRect( &p_vout->p_sys->rect );
     
         if( ( err = DecompressSequenceFrameS( 
                         p_vout->p_sys->i_seq,
     
         if( ( err = DecompressSequenceFrameS( 
                         p_vout->p_sys->i_seq,
@@ -490,6 +502,8 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
             QDFlushPortBuffer( p_vout->p_sys->p_qdport, nil );
         }
     
             QDFlushPortBuffer( p_vout->p_sys->p_qdport, nil );
         }
     
+       SetOrigin( oldrect.left , oldrect.top );
+        SetClip( oldClip );
         SetPort( p_vout->p_sys->p_qdportold );
     }
     else
         SetPort( p_vout->p_sys->p_qdportold );
     }
     else
@@ -680,6 +694,10 @@ static void QTScaleMatrix( vout_thread_t *p_vout )
         i_height = valh.i_int;
 
         SetRectRgn( p_vout->p_sys->mask , 0 , 0 , valr.i_int - vall.i_int , valb.i_int - valt.i_int );
         i_height = valh.i_int;
 
         SetRectRgn( p_vout->p_sys->mask , 0 , 0 , valr.i_int - vall.i_int , valb.i_int - valt.i_int );
+        p_vout->p_sys->rect.top = 0;
+        p_vout->p_sys->rect.left = 0;
+        p_vout->p_sys->rect.bottom = valb.i_int - valt.i_int;
+        p_vout->p_sys->rect.right = valr.i_int - vall.i_int;
     }
 
     if( i_height * p_vout->output.i_aspect < i_width * VOUT_ASPECT_FACTOR )
     }
 
     if( i_height * p_vout->output.i_aspect < i_width * VOUT_ASPECT_FACTOR )
index a3ea6f2..c3d7584 100644 (file)
@@ -386,6 +386,7 @@ void                Private_Shutdown(void);
 NPError                Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
 NPError        Private_Destroy(NPP instance, NPSavedData** save);
 NPError                Private_SetWindow(NPP instance, NPWindow* window);
 NPError                Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
 NPError        Private_Destroy(NPP instance, NPSavedData** save);
 NPError                Private_SetWindow(NPP instance, NPWindow* window);
+NPError        Private_GetValue( NPP instance, NPPVariable variable, void *value );
 NPError                Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
 NPError                Private_DestroyStream(NPP instance, NPStream* stream, NPError reason);
 int32          Private_WriteReady(NPP instance, NPStream* stream);
 NPError                Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
 NPError                Private_DestroyStream(NPP instance, NPStream* stream, NPError reason);
 int32          Private_WriteReady(NPP instance, NPStream* stream);
@@ -450,6 +451,16 @@ NPError Private_SetWindow(NPP instance, NPWindow* window)
        return err;
 }
 
        return err;
 }
 
+NPError Private_GetValue( NPP instance, NPPVariable variable, void *value )
+{
+       NPError err;
+       EnterCodeResource();
+       PLUGINDEBUGSTR("\pGetValue;g;");
+       err = NPP_GetValue( instance, variable, value);
+       ExitCodeResource();
+       return err;
+}
+
 NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
 {
        NPError err;
 NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
 {
        NPError err;
@@ -746,6 +757,7 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
                pluginFuncs->write          = NewNPP_WriteProc(PLUGIN_TO_HOST_GLUE(write, Private_Write));
                pluginFuncs->print          = NewNPP_PrintProc(PLUGIN_TO_HOST_GLUE(print, Private_Print));
                pluginFuncs->event          = NewNPP_HandleEventProc(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));  
                pluginFuncs->write          = NewNPP_WriteProc(PLUGIN_TO_HOST_GLUE(write, Private_Write));
                pluginFuncs->print          = NewNPP_PrintProc(PLUGIN_TO_HOST_GLUE(print, Private_Print));
                pluginFuncs->event          = NewNPP_HandleEventProc(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));  
+               pluginFuncs->getvalue       = NewNPP_GetValueProc(PLUGIN_TO_HOST_GLUE(getvalue, Private_GetValue));     
                if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
                {       
                        pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));                       
                if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
                {       
                        pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));                       
index c797a29..06fc591 100644 (file)
@@ -2,7 +2,7 @@
  * vlcpeer.cpp: scriptable peer descriptor
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
  * vlcpeer.cpp: scriptable peer descriptor
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: vlcpeer.cpp,v 1.6 2003/07/23 01:13:48 gbazin Exp $
+ * $Id: vlcpeer.cpp,v 1.7 2003/08/19 14:07:51 garf Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -104,7 +104,10 @@ NS_IMETHODIMP VlcPeer::Fullscreen()
 {
     if( p_plugin )
     {
 {
     if( p_plugin )
     {
+#ifdef XP_MACOSX
+#else
         VLC_FullScreen( p_plugin->i_vlc );
         VLC_FullScreen( p_plugin->i_vlc );
+#endif
     }
     return NS_OK;
 }
     }
     return NS_OK;
 }
index 07c3772..1be001f 100644 (file)
@@ -2,7 +2,7 @@
  * vlcshell.cpp: a VLC plugin for Mozilla
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
  * vlcshell.cpp: a VLC plugin for Mozilla
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: vlcshell.cpp,v 1.17 2003/08/14 13:32:12 garf Exp $
+ * $Id: vlcshell.cpp,v 1.18 2003/08/19 14:07:51 garf Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -130,6 +130,7 @@ char * NPP_GetMIMEDescription( void )
 
 NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
 {
 
 NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
 {
+
     static nsIID nsid = VLCINTF_IID;
     static char psz_desc[1000];
 
     static nsIID nsid = VLCINTF_IID;
     static char psz_desc[1000];