From 371695c615be05bc7df7a7362e13b4dd71bbc224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org> Date: Mon, 5 Oct 2015 19:57:46 +0200 Subject: [PATCH] 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 --- 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 928f24e24971..55c6fe913b55 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 2dcf5553d7f9..5ac7f05a2651 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) -- GitLab