Commit fb76e3b6 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCVideoLayer: Implement hasVideo.

parent 0b0a9159
...@@ -25,4 +25,8 @@ ...@@ -25,4 +25,8 @@
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
@interface VLCVideoLayer : CALayer @interface VLCVideoLayer : CALayer
{
BOOL hasVideo;
}
@property (readonly) BOOL hasVideo;
@end @end
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
NSColor * backColor; NSColor * backColor;
BOOL stretchesVideo; BOOL stretchesVideo;
id layoutManager; id layoutManager;
// TODO: Allow for view to report transparency to do some cool effects BOOL hasVideo;
// with the video?
} }
@property (assign) id delegate; @property (assign) id delegate;
@property (copy) NSColor *backColor; @property (copy) NSColor *backColor;
@property BOOL fillScreen; @property BOOL fillScreen;
@property (readonly) BOOL hasVideo;
@end @end
...@@ -42,20 +42,25 @@ ...@@ -42,20 +42,25 @@
- (void)addVoutLayer:(CALayer *)aLayer; - (void)addVoutLayer:(CALayer *)aLayer;
@end @end
@interface VLCVideoLayer ()
@property (readwrite) BOOL hasVideo;
@end
/****************************************************************************** /******************************************************************************
* Implementation VLCVideoLayer * Implementation VLCVideoLayer
*/ */
@implementation VLCVideoLayer @implementation VLCVideoLayer
@synthesize hasVideo;
@end @end
/****************************************************************************** /******************************************************************************
* Implementation VLCVideoLayer (Private) * Implementation VLCVideoLayer (Private)
*/ */
@implementation VLCVideoLayer (Private) @implementation VLCVideoLayer (Private)
/* This is called by the libvlc module 'opengllayer' as soon as there is one /* This is called by the libvlc module 'opengllayer' as soon as there is one
* vout available * vout available
*/ */
...@@ -73,6 +78,7 @@ ...@@ -73,6 +78,7 @@
[self setNeedsDisplayOnBoundsChange:YES]; [self setNeedsDisplayOnBoundsChange:YES];
[CATransaction commit]; [CATransaction commit];
self.hasVideo = YES;
} }
- (void)removeVoutLayer:(CALayer*)voutLayer - (void)removeVoutLayer:(CALayer*)voutLayer
...@@ -80,6 +86,7 @@ ...@@ -80,6 +86,7 @@
[CATransaction begin]; [CATransaction begin];
[voutLayer removeFromSuperlayer]; [voutLayer removeFromSuperlayer];
[CATransaction commit]; [CATransaction commit];
self.hasVideo = NO;
} }
@end @end
...@@ -62,6 +62,10 @@ ...@@ -62,6 +62,10 @@
- (void)addVoutLayer:(CALayer *)aLayer; - (void)addVoutLayer:(CALayer *)aLayer;
@end @end
@interface VLCVideoView ()
@property (readwrite) BOOL hasVideo;
@end
/****************************************************************************** /******************************************************************************
* Implementation VLCVideoView * Implementation VLCVideoView
*/ */
...@@ -77,6 +81,7 @@ ...@@ -77,6 +81,7 @@
[self setStretchesVideo:NO]; [self setStretchesVideo:NO];
[self setAutoresizesSubviews:YES]; [self setAutoresizesSubviews:YES];
[self setFillScreen: NO]; [self setFillScreen: NO];
self.hasVideo = NO;
layoutManager = [[VLCVideoLayoutManager layoutManager] retain]; layoutManager = [[VLCVideoLayoutManager layoutManager] retain];
} }
return self; return self;
...@@ -105,6 +110,7 @@ ...@@ -105,6 +110,7 @@
@synthesize delegate; @synthesize delegate;
@synthesize backColor; @synthesize backColor;
@synthesize hasVideo;
- (BOOL)fillScreen - (BOOL)fillScreen
{ {
...@@ -141,10 +147,12 @@ ...@@ -141,10 +147,12 @@
[aLayer setNeedsLayout]; [aLayer setNeedsLayout];
[aLayer setNeedsDisplay]; [aLayer setNeedsDisplay];
[rootLayer setNeedsDisplayOnBoundsChange:YES]; [rootLayer setNeedsDisplayOnBoundsChange:YES];
[rootLayer setNeedsDisplay]; [rootLayer setNeedsDisplay];
[rootLayer layoutIfNeeded]; [rootLayer layoutIfNeeded];
[CATransaction commit]; [CATransaction commit];
self.hasVideo = YES;
} }
- (void)removeVoutLayer:(CALayer*)voutLayer - (void)removeVoutLayer:(CALayer*)voutLayer
...@@ -152,6 +160,7 @@ ...@@ -152,6 +160,7 @@
[CATransaction begin]; [CATransaction begin];
[voutLayer removeFromSuperlayer]; [voutLayer removeFromSuperlayer];
[CATransaction commit]; [CATransaction commit];
self.hasVideo = NO;
} }
@end @end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment