]> git.sesse.net Git - vlc/commitdiff
frontrow_plugin: Cleanups, and improvement such as audio volume settings.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 14 Feb 2008 01:00:07 +0000 (01:00 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 14 Feb 2008 01:00:07 +0000 (01:00 +0000)
projects/macosx/frontrow_plugin/VLCAppliance.m
projects/macosx/frontrow_plugin/VLCMediaLayer.m
projects/macosx/frontrow_plugin/VLCMediaListController.h
projects/macosx/frontrow_plugin/VLCMediaListController.m
projects/macosx/frontrow_plugin/VLCPlayerController.m

index b622575b1617a4113ff3aab9606420a7bf824e02..404808dd9bc0b11936d9e92b4b099ad03a946e19 100644 (file)
@@ -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"]];
index 9c054a4b951572933f4c222c59a44f05fe3349b5..903903b5d9891713d8c1ec684134da6d76f9fab0 100644 (file)
         _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);
index a3b904b3a904a70d6dbb96fa8d6799d948a78dc5..942975e7b6105dfab40c8d71194347c25b5050f9 100644 (file)
@@ -17,5 +17,5 @@
 }
 
 - initWithMediaListAspect:(VLCMediaListAspect *)mediaListAspect;
-
+- initWithMediaListAspect:(VLCMediaListAspect *)aMediaListAspect andTitle:(NSString *)title;
 @end
index 167ae6d88ce8eddafc91a27d917d8619d43a9ded..d3d6843749ec6757ee8473fb67b0092acc9267a1 100644 (file)
@@ -12,6 +12,7 @@
 #import <BackRow/BRListControl.h>
 #import <BackRow/BRTextMenuItemLayer.h>
 #import <BackRow/BRControllerStack.h>
+#import <BackRow/BRHeaderControl.h>
 
 @interface VLCMediaListController ()
 
 
 - 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 {
     BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf];
     
     BRTextMenuItemLayer * item = nil;
-    
+
     if(isDirectory) {
         item = [BRTextMenuItemLayer folderMenuItem];
     }
 
 - (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;
index b74229e54b01b52f52d4acfafe54bd8044cd9230..39a48111e125dfe87c7b500835f6305d12e6ff38 100644 (file)
             [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: