[vlc-commits] add basic support to passthrough the base CALayer from the browser

Felix Paul Kühne git at videolan.org
Tue Jan 1 18:59:46 CET 2013


npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jan  1 18:37:56 2013 +0100| [35ea732401b684d9bfa3ac7f8d79af3b127bdd84] | committer: Felix Paul Kühne

add basic support to passthrough the base CALayer from the browser

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=35ea732401b684d9bfa3ac7f8d79af3b127bdd84
---

 npapi/control/nporuntime.h  |    1 -
 npapi/vlcplugin_base.cpp    |   10 ++++++++++
 npapi/vlcplugin_base.h      |    4 ++++
 npapi/vlcplugin_mac.h       |    8 ++++----
 npapi/vlcplugin_mac.mm      |    5 +++++
 npapi/vlcshell.cpp          |    9 +++++++++
 npapi/vlcwindowless_mac.cpp |    5 +++++
 npapi/vlcwindowless_mac.h   |    1 +
 8 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/npapi/control/nporuntime.h b/npapi/control/nporuntime.h
index 0999542..d67ec8c 100644
--- a/npapi/control/nporuntime.h
+++ b/npapi/control/nporuntime.h
@@ -33,7 +33,6 @@
 //from Microsoft SDK (rather then from Mozilla SDK),
 //#include it indirectly via <npfunctions.h>
 #include <npfunctions.h>
-
 #include <npruntime.h>
 
 static void RuntimeNPClassDeallocate(NPObject *npobj);
diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index a03d611..51a36f1 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -121,6 +121,9 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[])
     ppsz_argv[ppsz_argc++] = "--no-one-instance";
 
 #endif
+#ifdef XP_MACOSX
+    ppsz_argv[ppsz_argc++] = "--vout=vmem";
+#endif
 
     /* common settings */
     ppsz_argv[ppsz_argc++] = "-vv";
@@ -274,6 +277,13 @@ void VlcPluginBase::setWindow(const NPWindow &window)
     npwindow = window;
 }
 
+#if defined(XP_MACOSX)
+NPError VlcPluginBase::get_root_layer(void *value)
+{
+    return NPERR_GENERIC_ERROR;
+}
+#endif
+
 bool VlcPluginBase::handle_event(void *event)
 {
     return false;
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index c9f6eb8..78933a2 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -162,6 +162,10 @@ public:
 
     virtual bool handle_event(void *event);
 
+#if defined(XP_MACOSX)
+    virtual NPError get_root_layer(void *value);
+#endif
+
     virtual void toggle_fullscreen() = 0;
     virtual void set_fullscreen(int) = 0;
     virtual int get_fullscreen() = 0;
diff --git a/npapi/vlcplugin_mac.h b/npapi/vlcplugin_mac.h
index cae0af1..cafebf3 100644
--- a/npapi/vlcplugin_mac.h
+++ b/npapi/vlcplugin_mac.h
@@ -48,13 +48,13 @@ public:
     void update_controls()      {/* STUB */}
     void popup_menu()           {/* STUB */}
 
-    virtual bool handle_event(void *event);
+
+    bool handle_event(void *event);
+    NPError get_root_layer(void *value);
+
 private:
     void set_player_window();
 
-    unsigned int     i_width, i_height;
-
-    int i_last_position;
 };
 
 #endif /* __VLCPLUGIN_MAC_H__ */
diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index 2be4228..edfccaf 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -102,6 +102,11 @@ bool VlcPluginMac::destroy_windows()
     return true;
 }
 
+NPError VlcPluginMac::get_root_layer(void *value)
+{
+    return NPERR_GENERIC_ERROR;
+}
+
 bool VlcPluginMac::handle_event(void *event)
 {
     NPCocoaEvent* cocoaEvent = (NPCocoaEvent*)event;
diff --git a/npapi/vlcshell.cpp b/npapi/vlcshell.cpp
index bee5704..401f494 100644
--- a/npapi/vlcshell.cpp
+++ b/npapi/vlcshell.cpp
@@ -172,6 +172,15 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
             }
             break;
         }
+#if defined(XP_MACOSX)
+        case NPPVpluginCoreAnimationLayer:
+        {
+            if( instance )
+                return p_plugin->get_root_layer(&value);;
+
+            break;
+        }
+#endif
 
         default:
             ;
diff --git a/npapi/vlcwindowless_mac.cpp b/npapi/vlcwindowless_mac.cpp
index 7f62115..844ed76 100644
--- a/npapi/vlcwindowless_mac.cpp
+++ b/npapi/vlcwindowless_mac.cpp
@@ -121,6 +121,11 @@ void VlcWindowlessMac::drawNoPlayback(CGContextRef cgContext)
     CGContextRestoreGState(cgContext);
 }
 
+NPError VlcWindowlessMac::get_root_layer(void *value)
+{
+    return NPERR_GENERIC_ERROR;
+}
+
 bool VlcWindowlessMac::handle_event(void *event)
 {
     NPCocoaEvent* cocoaEvent = (NPCocoaEvent*)event;
diff --git a/npapi/vlcwindowless_mac.h b/npapi/vlcwindowless_mac.h
index dc14369..5fe6cb9 100644
--- a/npapi/vlcwindowless_mac.h
+++ b/npapi/vlcwindowless_mac.h
@@ -32,6 +32,7 @@ public:
     VlcWindowlessMac(NPP instance, NPuint16_t mode);
 
     bool handle_event(void *event);
+    NPError get_root_layer(void *value);
 
 protected:
     void drawBackground(CGContextRef cgContext);



More information about the vlc-commits mailing list