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 @@
- (id)applianceController
{
// 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 = [[VLCApplianceController alloc] initWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Movies"]];
......
......@@ -45,15 +45,13 @@
_videoLayer = [VLCVideoLayer layer];
_videoLayer.frame = self.bounds;
_videoLayer.autoresizingMask = kCALayerWidthSizable|kCALayerHeightSizable;
_videoLayer.fillScreen = YES;
[self addSublayer:_videoLayer];
}
if(_player == nil) {
_player = [[VLCMediaPlayer alloc] initWithVideoLayer:_videoLayer];
}
else {
[_player pause];
}
#endif
NSLog(@"playing media: %@", media);
......
......@@ -17,5 +17,5 @@
}
- initWithMediaListAspect:(VLCMediaListAspect *)mediaListAspect;
- initWithMediaListAspect:(VLCMediaListAspect *)aMediaListAspect andTitle:(NSString *)title;
@end
......@@ -12,6 +12,7 @@
#import <BackRow/BRListControl.h>
#import <BackRow/BRTextMenuItemLayer.h>
#import <BackRow/BRControllerStack.h>
#import <BackRow/BRHeaderControl.h>
@interface VLCMediaListController ()
......@@ -25,13 +26,22 @@
- initWithMediaListAspect:(VLCMediaListAspect *)aMediaListAspect
{
self = [super init];
self.mediaListAspect = aMediaListAspect;
[self.mediaListAspect addObserver:self forKeyPath:@"media" options:NSKeyValueChangeRemoval|NSKeyValueChangeInsertion|NSKeyValueChangeSetting context:nil];
[[self list] setDatasource:self];
isReloading = NO;
return [self initWithMediaListAspect:aMediaListAspect andTitle:nil];
}
- 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;
}
......@@ -48,7 +58,7 @@
if(!isReloading)
{
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 {
......@@ -103,7 +113,7 @@
BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf];
BRTextMenuItemLayer * item = nil;
if(isDirectory) {
item = [BRTextMenuItemLayer folderMenuItem];
}
......@@ -118,12 +128,13 @@
- (void)itemSelected:(NSInteger)row
{
BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf];
VLCMediaListAspectNode * node = [mediaListAspect nodeAtIndex:row];
BOOL isDirectory = ![node isLeaf];
BRController * controller = nil;
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 {
static VLCPlayerController * playerController = nil;
......
......@@ -68,6 +68,18 @@
[player setPosition:position];
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:
[[self stack] popController];
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