[vlc-commits] macosx: added support for the CAOpenGLLayer vout

Felix Paul Kühne git at videolan.org
Mon Oct 5 20:02:23 CEST 2015


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Oct  5 19:57:46 2015 +0200| [371695c615be05bc7df7a7362e13b4dd71bbc224] | committer: Felix Paul Kühne

macosx: added support for the CAOpenGLLayer vout

Note that this won't work if the video output is embedded in the main window

This is done mainly for debug purposes for now

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=371695c615be05bc7df7a7362e13b4dd71bbc224
---

 modules/gui/macosx/Makefile.am |    3 ++-
 modules/gui/macosx/VideoView.m |   29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 928f24e..55c6fe9 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -8,7 +8,8 @@ libmacosx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(guidir)' \
 	-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,CoreServices \
 	-Wl,-framework,QTKit -Wl,-framework,IOKit -Wl,-framework,AddressBook \
 	-Wl,-framework,WebKit -Wl,-framework,CoreAudio -Wl,-framework,SystemConfiguration \
-	-Wl,-framework,ScriptingBridge -F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit
+	-Wl,-framework,ScriptingBridge -F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit \
+	-Wl,-framework,QuartzCore
 
 if HAVE_SPARKLE
 libmacosx_plugin_la_LDFLAGS += -Wl,-framework,Sparkle
diff --git a/modules/gui/macosx/VideoView.m b/modules/gui/macosx/VideoView.m
index 2dcf555..5ac7f05 100644
--- a/modules/gui/macosx/VideoView.m
+++ b/modules/gui/macosx/VideoView.m
@@ -37,6 +37,8 @@
 #import "CoreInteraction.h"
 #import "MainMenu.h"
 
+#import <QuartzCore/QuartzCore.h>
+
 #import <vlc_keys.h>
 
 
@@ -79,6 +81,33 @@
     return self;
 }
 
+- (void)addVoutLayer:(CALayer *)aLayer
+{
+    if (self.layer == nil) {
+        [self setLayer:[CALayer layer]];
+        [self setWantsLayer:YES];
+    }
+
+    [CATransaction begin];
+    aLayer.opaque = 1.;
+    aLayer.hidden = NO;
+    aLayer.bounds = self.layer.bounds;
+    [self.layer addSublayer:aLayer];
+    [self setNeedsDisplay:YES];
+    [aLayer setNeedsDisplay];
+    CGRect frame = aLayer.bounds;
+    frame.origin.x = frame.origin.y = 0.;
+    aLayer.frame = frame;
+    [CATransaction commit];
+}
+
+- (void)removeVoutLayer:(CALayer *)aLayer
+{
+    [CATransaction begin];
+    [aLayer removeFromSuperlayer];
+    [CATransaction commit];
+}
+
 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
 {
     if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric)



More information about the vlc-commits mailing list