|
@@ -48,34 +48,17 @@
|
|
|
- (void)detachFromVout;
|
|
|
@end
|
|
|
|
|
|
-/* Depreacted methods */
|
|
|
-@interface VLCVideoView (Deprecated)
|
|
|
-- (void)setStretchesVideo:(BOOL)value;
|
|
|
-- (BOOL)stretchesVideo;
|
|
|
-
|
|
|
-- (void)addVoutSubview:(NSView *)aView; /* (Scheduled to deletion) */
|
|
|
-- (void)removeVoutSubview:(NSView *)aView; /* (Scheduled to deletion) */
|
|
|
-@end
|
|
|
-
|
|
|
/******************************************************************************
|
|
|
* VLCVideoView (Private)
|
|
|
*/
|
|
|
|
|
|
-@interface VLCVideoView (Private)
|
|
|
-/* Method */
|
|
|
+@interface VLCVideoView ()
|
|
|
+
|
|
|
+@property (nonatomic, readwrite) BOOL hasVideo;
|
|
|
+@property (nonatomic, retain) VLCVideoLayoutManager *layoutManager;
|
|
|
+
|
|
|
- (void)addVoutLayer:(CALayer *)aLayer;
|
|
|
-@end
|
|
|
|
|
|
-@interface VLCVideoView ()
|
|
|
-{
|
|
|
- id delegate;
|
|
|
- NSColor * backColor;
|
|
|
- BOOL stretchesVideo;
|
|
|
- id layoutManager;
|
|
|
- BOOL hasVideo;
|
|
|
-}
|
|
|
-/* Proeprties */
|
|
|
-@property (readwrite) BOOL hasVideo;
|
|
|
@end
|
|
|
|
|
|
/******************************************************************************
|
|
@@ -89,31 +72,18 @@
|
|
|
{
|
|
|
if (self = [super initWithFrame:rect])
|
|
|
{
|
|
|
- self.delegate = nil;
|
|
|
self.backColor = [NSColor blackColor];
|
|
|
- self.fillScreen = NO;
|
|
|
- self.hasVideo = NO;
|
|
|
-
|
|
|
- [self setStretchesVideo:NO];
|
|
|
- [self setAutoresizesSubviews:YES];
|
|
|
- layoutManager = [[VLCVideoLayoutManager layoutManager] retain];
|
|
|
+ self.autoresizesSubviews = YES;
|
|
|
+ self.layoutManager = [VLCVideoLayoutManager layoutManager];
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
-- (void)dealloc
|
|
|
-{
|
|
|
- self.delegate = nil;
|
|
|
- self.backColor = nil;
|
|
|
- [layoutManager release];
|
|
|
- [super dealloc];
|
|
|
-}
|
|
|
-
|
|
|
/* NSView Overrides */
|
|
|
- (void)drawRect:(NSRect)aRect
|
|
|
{
|
|
|
[self lockFocus];
|
|
|
- [backColor set];
|
|
|
+ [self.backColor set];
|
|
|
NSRectFill(aRect);
|
|
|
[self unlockFocus];
|
|
|
}
|
|
@@ -123,46 +93,40 @@
|
|
|
return YES;
|
|
|
}
|
|
|
|
|
|
-/* Properties */
|
|
|
-@synthesize delegate;
|
|
|
-@synthesize backColor;
|
|
|
-@synthesize hasVideo;
|
|
|
-
|
|
|
- (BOOL)fillScreen
|
|
|
{
|
|
|
- return [layoutManager fillScreenEntirely];
|
|
|
+ return [self.layoutManager fillScreenEntirely];
|
|
|
}
|
|
|
|
|
|
- (void)setFillScreen:(BOOL)fillScreen
|
|
|
{
|
|
|
- [(VLCVideoLayoutManager *)layoutManager setFillScreenEntirely:fillScreen];
|
|
|
- [[self layer] setNeedsLayout];
|
|
|
+ [self.layoutManager setFillScreenEntirely:fillScreen];
|
|
|
+ [self.layer setNeedsLayout];
|
|
|
}
|
|
|
-@end
|
|
|
|
|
|
/******************************************************************************
|
|
|
* Implementation VLCVideoView (Private)
|
|
|
*/
|
|
|
|
|
|
-@implementation VLCVideoView (Private)
|
|
|
-
|
|
|
/* This is called by the libvlc module 'opengllayer' as soon as there is one
|
|
|
* vout available
|
|
|
*/
|
|
|
- (void)addVoutLayer:(CALayer *)aLayer
|
|
|
{
|
|
|
+ aLayer.name = @"vlcopengllayer";
|
|
|
+
|
|
|
[CATransaction begin];
|
|
|
- [self setWantsLayer: YES];
|
|
|
- CALayer * rootLayer = [self layer];
|
|
|
|
|
|
- aLayer.name = @"vlcopengllayer";
|
|
|
+ self.wantsLayer = YES;
|
|
|
+ CALayer * rootLayer = self.layer;
|
|
|
|
|
|
- [layoutManager setOriginalVideoSize:aLayer.bounds.size];
|
|
|
- [rootLayer setLayoutManager:layoutManager];
|
|
|
+ [self.layoutManager setOriginalVideoSize:aLayer.bounds.size];
|
|
|
+ [rootLayer setLayoutManager:self.layoutManager];
|
|
|
[rootLayer insertSublayer:aLayer atIndex:0];
|
|
|
[aLayer setNeedsDisplayOnBoundsChange:YES];
|
|
|
|
|
|
[CATransaction commit];
|
|
|
+
|
|
|
self.hasVideo = YES;
|
|
|
}
|
|
|
|
|
@@ -171,43 +135,9 @@
|
|
|
[CATransaction begin];
|
|
|
[voutLayer removeFromSuperlayer];
|
|
|
[CATransaction commit];
|
|
|
+
|
|
|
self.hasVideo = NO;
|
|
|
}
|
|
|
|
|
|
@end
|
|
|
|
|
|
-/******************************************************************************
|
|
|
- * Implementation VLCVideoView (Deprecated)
|
|
|
- */
|
|
|
-
|
|
|
-@implementation VLCVideoView (Deprecated)
|
|
|
-
|
|
|
-- (void)setStretchesVideo:(BOOL)value
|
|
|
-{
|
|
|
- stretchesVideo = value;
|
|
|
-}
|
|
|
-
|
|
|
-- (BOOL)stretchesVideo
|
|
|
-{
|
|
|
- return stretchesVideo;
|
|
|
-}
|
|
|
-
|
|
|
-/* This is called by the libvlc module 'minimal_macosx' as soon as there is one
|
|
|
- * vout available
|
|
|
- */
|
|
|
-- (void)addVoutSubview:(NSView *)aView /* (Scheduled to deletion) */
|
|
|
-{
|
|
|
- [aView setFrame:[self bounds]];
|
|
|
-
|
|
|
- [self addSubview:aView];
|
|
|
-
|
|
|
- // TODO: Should we let the media player specify these values?
|
|
|
- [aView setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)removeVoutSubview:(NSView *)view /* (Scheduled to deletion) */
|
|
|
-{
|
|
|
- // Should we do something? I don't know, however the protocol requires
|
|
|
- // this to be implemented
|
|
|
-}
|
|
|
-@end
|