Commit 632ef79d authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

frontrow_plugin: Cleanups, and improvement such as audio volume settings.

parent e651381f
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
- (id)applianceController - (id)applianceController
{ {
// Disabled until we properly display a menu for that. You can test it by uncommenting those lines, and comment the following line. // Disabled until we properly display a menu for that. You can test it by uncommenting those lines, and comment the following line.
// VLCMediaListAspect * mediaListAspect = [[[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] discoveredMedia] hierarchicalAspect]; // VLCMediaListAspect * mediaListAspect = [[[[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] discoveredMedia] retain] hierarchicalAspect];
// VLCApplianceController * controller = [[VLCMediaListController alloc] initWithMediaListAspect:mediaListAspect]; // VLCApplianceController * controller = [[VLCMediaListController alloc] initWithMediaListAspect:mediaListAspect];
VLCApplianceController * controller = [[VLCApplianceController alloc] initWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Movies"]]; VLCApplianceController * controller = [[VLCApplianceController alloc] initWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Movies"]];
......
...@@ -45,15 +45,13 @@ ...@@ -45,15 +45,13 @@
_videoLayer = [VLCVideoLayer layer]; _videoLayer = [VLCVideoLayer layer];
_videoLayer.frame = self.bounds; _videoLayer.frame = self.bounds;
_videoLayer.autoresizingMask = kCALayerWidthSizable|kCALayerHeightSizable; _videoLayer.autoresizingMask = kCALayerWidthSizable|kCALayerHeightSizable;
_videoLayer.fillScreen = YES;
[self addSublayer:_videoLayer]; [self addSublayer:_videoLayer];
} }
if(_player == nil) { if(_player == nil) {
_player = [[VLCMediaPlayer alloc] initWithVideoLayer:_videoLayer]; _player = [[VLCMediaPlayer alloc] initWithVideoLayer:_videoLayer];
} }
else {
[_player pause];
}
#endif #endif
NSLog(@"playing media: %@", media); NSLog(@"playing media: %@", media);
......
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
} }
- initWithMediaListAspect:(VLCMediaListAspect *)mediaListAspect; - initWithMediaListAspect:(VLCMediaListAspect *)mediaListAspect;
- initWithMediaListAspect:(VLCMediaListAspect *)aMediaListAspect andTitle:(NSString *)title;
@end @end
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#import <BackRow/BRListControl.h> #import <BackRow/BRListControl.h>
#import <BackRow/BRTextMenuItemLayer.h> #import <BackRow/BRTextMenuItemLayer.h>
#import <BackRow/BRControllerStack.h> #import <BackRow/BRControllerStack.h>
#import <BackRow/BRHeaderControl.h>
@interface VLCMediaListController () @interface VLCMediaListController ()
...@@ -25,13 +26,22 @@ ...@@ -25,13 +26,22 @@
- initWithMediaListAspect:(VLCMediaListAspect *)aMediaListAspect - initWithMediaListAspect:(VLCMediaListAspect *)aMediaListAspect
{ {
self = [super init]; return [self initWithMediaListAspect:aMediaListAspect andTitle:nil];
}
self.mediaListAspect = aMediaListAspect;
[self.mediaListAspect addObserver:self forKeyPath:@"media" options:NSKeyValueChangeRemoval|NSKeyValueChangeInsertion|NSKeyValueChangeSetting context:nil];
[[self list] setDatasource:self];
isReloading = NO;
- initWithMediaListAspect:(VLCMediaListAspect *)aMediaListAspect andTitle:(NSString *)title
{
if( self = [super init] )
{
self.mediaListAspect = aMediaListAspect;
[self.mediaListAspect addObserver:self forKeyPath:@"media" options:NSKeyValueChangeRemoval|NSKeyValueChangeInsertion|NSKeyValueChangeSetting context:nil];
[[self list] setDatasource:self];
isReloading = NO;
if(title)
{
[[self header] setTitle: title];
}
}
return self; return self;
} }
...@@ -48,7 +58,7 @@ ...@@ -48,7 +58,7 @@
if(!isReloading) if(!isReloading)
{ {
isReloading = YES; isReloading = YES;
[self performSelector:@selector(reload) withObject:nil afterDelay:2.]; [self performSelector:@selector(reload) withObject:nil afterDelay: [[self list] itemCount] > 10 ? 2. : [[self list] itemCount] ? 0.3 : 0.0];
} }
} }
else { else {
...@@ -103,7 +113,7 @@ ...@@ -103,7 +113,7 @@
BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf]; BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf];
BRTextMenuItemLayer * item = nil; BRTextMenuItemLayer * item = nil;
if(isDirectory) { if(isDirectory) {
item = [BRTextMenuItemLayer folderMenuItem]; item = [BRTextMenuItemLayer folderMenuItem];
} }
...@@ -118,12 +128,13 @@ ...@@ -118,12 +128,13 @@
- (void)itemSelected:(NSInteger)row - (void)itemSelected:(NSInteger)row
{ {
BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf]; VLCMediaListAspectNode * node = [mediaListAspect nodeAtIndex:row];
BOOL isDirectory = ![node isLeaf];
BRController * controller = nil; BRController * controller = nil;
if(isDirectory) { if(isDirectory) {
controller = [[[VLCMediaListController alloc] initWithMediaListAspect:[[mediaListAspect nodeAtIndex:row] children]] autorelease]; controller = [[[VLCMediaListController alloc] initWithMediaListAspect:[node children] andTitle:[[node media] valueForKeyPath:@"metaDictionary.title"]] autorelease];
} }
else { else {
static VLCPlayerController * playerController = nil; static VLCPlayerController * playerController = nil;
......
...@@ -68,6 +68,18 @@ ...@@ -68,6 +68,18 @@
[player setPosition:position]; [player setPosition:position];
break; break;
} }
case BREventUpUsage:
{
NSLog(@"UP");
[[[VLCLibrary sharedLibrary] audio] setVolume:[[[VLCLibrary sharedLibrary] audio] volume]+20];
break;
}
case BREventDownUsage:
{
NSLog(@"DOWN");
[[[VLCLibrary sharedLibrary] audio] setVolume:[[[VLCLibrary sharedLibrary] audio] volume]-20];
break;
}
case BREventMenuUsage: case BREventMenuUsage:
[[self stack] popController]; [[self stack] popController];
default: default:
......
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