Commit 0eef3125 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx/frontrow_plugin: VLCMediaListController, display a mediaListAspect in a...

macosx/frontrow_plugin: VLCMediaListController, display a mediaListAspect in a FrontRow list. To get a service discovery in frontrow go into VLCAppliance.m -applianceController and uncomment the right part.
parent 4c7600b8
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
6322C2AC0D609FEC00B020BB /* VLCMediaListController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6322C2AB0D609FEC00B020BB /* VLCMediaListController.m */; };
63F954120D5B9B4C00616D1F /* VLCKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63F954110D5B9B4C00616D1F /* VLCKit.framework */; }; 63F954120D5B9B4C00616D1F /* VLCKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63F954110D5B9B4C00616D1F /* VLCKit.framework */; };
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
...@@ -42,24 +43,14 @@ ...@@ -42,24 +43,14 @@
}; };
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
A79488020C9089F800B97E56 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* FRVLC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FRVLC_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* FRVLC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FRVLC_Prefix.pch; sourceTree = "<group>"; };
6322C2AA0D609FEC00B020BB /* VLCMediaListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCMediaListController.h; sourceTree = "<group>"; };
6322C2AB0D609FEC00B020BB /* VLCMediaListController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCMediaListController.m; sourceTree = "<group>"; };
63F954110D5B9B4C00616D1F /* VLCKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VLCKit.framework; path = ../framework/build/Debug/VLCKit.framework; sourceTree = SOURCE_ROOT; }; 63F954110D5B9B4C00616D1F /* VLCKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VLCKit.framework; path = ../framework/build/Debug/VLCKit.framework; sourceTree = SOURCE_ROOT; };
8D5B49B6048680CD000E48DA /* VLC.frappliance */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VLC.frappliance; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* VLC.frappliance */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VLC.frappliance; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
...@@ -147,6 +138,8 @@ ...@@ -147,6 +138,8 @@
A730338A0C8796BA00DA8E0A /* VLCAppliance.m */, A730338A0C8796BA00DA8E0A /* VLCAppliance.m */,
A70B95850C8F889500D5A5FF /* VLCApplianceController.h */, A70B95850C8F889500D5A5FF /* VLCApplianceController.h */,
A70B95860C8F889500D5A5FF /* VLCApplianceController.m */, A70B95860C8F889500D5A5FF /* VLCApplianceController.m */,
6322C2AA0D609FEC00B020BB /* VLCMediaListController.h */,
6322C2AB0D609FEC00B020BB /* VLCMediaListController.m */,
A70B959A0C8F936500D5A5FF /* VLCPlayerController.h */, A70B959A0C8F936500D5A5FF /* VLCPlayerController.h */,
A70B959B0C8F936500D5A5FF /* VLCPlayerController.m */, A70B959B0C8F936500D5A5FF /* VLCPlayerController.m */,
); );
...@@ -208,11 +201,10 @@ ...@@ -208,11 +201,10 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "FRVLC" */; buildConfigurationList = 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "FRVLC" */;
buildPhases = ( buildPhases = (
63F956E80D5B9D4800616D1F /* ShellScript */,
8D5B49AF048680CD000E48DA /* Resources */, 8D5B49AF048680CD000E48DA /* Resources */,
8D5B49B1048680CD000E48DA /* Sources */, 8D5B49B1048680CD000E48DA /* Sources */,
8D5B49B3048680CD000E48DA /* Frameworks */, 8D5B49B3048680CD000E48DA /* Frameworks */,
A79488020C9089F800B97E56 /* CopyFiles */,
63F956E80D5B9D4800616D1F /* ShellScript */,
); );
buildRules = ( buildRules = (
); );
...@@ -285,7 +277,7 @@ ...@@ -285,7 +277,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "if test \"$SYMROOT\" == \"$PROJECT_DIR/build\"\nthen\n\tVLCFRAMEWORK=\"$SRCROOT/../Framework/build/$CONFIGURATION/VLCKit.framework\"\nelse\n\tVLCFRAMEWORK=\"$SYMROOT/$CONFIGURATION/VLCKit.framework\"\nfi\n/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks $VLCFRAMEWORK $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH\n\n\n"; shellScript = "if test \"$SYMROOT\" == \"$PROJECT_DIR/build\"\nthen\n\tVLCFRAMEWORK=\"$SRCROOT/../Framework/build/$CONFIGURATION/VLCKit.framework\"\nelse\n\tVLCFRAMEWORK=\"$SYMROOT/$CONFIGURATION/VLCKit.framework\"\nfi\nmkdir -p $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH\n/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks $VLCFRAMEWORK $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH\n\n\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
...@@ -300,6 +292,7 @@ ...@@ -300,6 +292,7 @@
A70B958A0C8F88CF00D5A5FF /* VLCDebug.m in Sources */, A70B958A0C8F88CF00D5A5FF /* VLCDebug.m in Sources */,
A70B959C0C8F936500D5A5FF /* VLCPlayerController.m in Sources */, A70B959C0C8F936500D5A5FF /* VLCPlayerController.m in Sources */,
A7E542900C960B5500EBBC34 /* VLCMediaLayer.m in Sources */, A7E542900C960B5500EBBC34 /* VLCMediaLayer.m in Sources */,
6322C2AC0D609FEC00B020BB /* VLCMediaListController.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -343,7 +336,7 @@ ...@@ -343,7 +336,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = FRVLC_Prefix.pch; GCC_PREFIX_HEADER = FRVLC_Prefix.pch;
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles"; INSTALL_PATH = "$(SYSTEM)/Library/CoreServices/Front\\ Row.app/PlugIns";
PRODUCT_NAME = VLC; PRODUCT_NAME = VLC;
WRAPPER_EXTENSION = frappliance; WRAPPER_EXTENSION = frappliance;
ZERO_LINK = YES; ZERO_LINK = YES;
...@@ -365,7 +358,7 @@ ...@@ -365,7 +358,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = FRVLC_Prefix.pch; GCC_PREFIX_HEADER = FRVLC_Prefix.pch;
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles"; INSTALL_PATH = "$(SYSTEM)/Library/CoreServices/Front\\ Row.app/PlugIns";
PRODUCT_NAME = VLC; PRODUCT_NAME = VLC;
WRAPPER_EXTENSION = frappliance; WRAPPER_EXTENSION = frappliance;
}; };
......
...@@ -6,9 +6,12 @@ ...@@ -6,9 +6,12 @@
// Copyright 2007 __MyCompanyName__. All rights reserved. // Copyright 2007 __MyCompanyName__. All rights reserved.
// //
#import <VLCKit/VLCKit.h>
#import "VLCAppliance.h" #import "VLCAppliance.h"
#import "VLCApplianceController.h" #import "VLCApplianceController.h"
#import "VLCMediaListController.h"
@implementation VLCAppliance @implementation VLCAppliance
...@@ -24,6 +27,10 @@ ...@@ -24,6 +27,10 @@
- (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.
// VLCMediaListAspect * mediaListAspect = [[[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] discoveredMedia] hierarchicalAspect];
// VLCApplianceController * controller = [[VLCMediaListController alloc] initWithMediaListAspect:mediaListAspect];
VLCApplianceController * controller = [[VLCApplianceController alloc] initWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Movies"]]; VLCApplianceController * controller = [[VLCApplianceController alloc] initWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Movies"]];
return [controller autorelease]; return [controller autorelease];
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
playerController = [[VLCPlayerController alloc] init]; playerController = [[VLCPlayerController alloc] init];
} }
playerController.path = path; playerController.media = [VLCMedia mediaWithPath:path];
controller = playerController; controller = playerController;
#endif #endif
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
VLCMediaPlayer * _player; VLCMediaPlayer * _player;
} }
@property(retain, nonatomic) NSURL * url; @property(retain, nonatomic) VLCMedia * media;
@property(readonly) VLCMediaPlayer * player; @property(readonly) VLCMediaPlayer * player;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
[super dealloc]; [super dealloc];
} }
- (void)setUrl:(NSURL*)url - (void)setMedia:(VLCMedia*)media
{ {
#if 0 #if 0
if(_videoLayer != nil) { if(_videoLayer != nil) {
...@@ -56,19 +56,23 @@ ...@@ -56,19 +56,23 @@
} }
#endif #endif
NSLog(@"playing url: %@", url); NSLog(@"playing media: %@", media);
VLCMedia * media = [VLCMedia mediaWithURL:url];
[_player setMedia:media]; [_player setMedia:media];
} }
- (NSURL*)url - (VLCMedia *)media
{
return [_player media];
}
- (VLCMedia *)url
{ {
if(_player == nil) { if(_player == nil) {
return nil; return nil;
} }
else { else {
return [[_player media] url]; return [_player media];
} }
} }
......
//
// VLCMediaListController.h
// FRVLC
//
// Created by Pierre d'Herbemont on 2/11/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <VLCKit/VLCKit.h>
#import <BackRow/BRMenuController.h>
@interface VLCMediaListController : BRMenuController {
VLCMediaListAspect * mediaListAspect;
BOOL isReloading;
}
- initWithMediaListAspect:(VLCMediaListAspect *)mediaListAspect;
@end
//
// VLCMediaListController.m
// FRVLC
//
// Created by Pierre d'Herbemont on 2/11/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "VLCMediaListController.h"
#import "VLCPlayerController.h"
#import <BackRow/BRListControl.h>
#import <BackRow/BRTextMenuItemLayer.h>
#import <BackRow/BRControllerStack.h>
@interface VLCMediaListController ()
@property(retain, nonatomic) VLCMediaListAspect * mediaListAspect;
@end
@implementation VLCMediaListController
@synthesize mediaListAspect;
- 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;
}
- (void)dealloc
{
[self.mediaListAspect removeObserver:self forKeyPath:@"media"];
[mediaListAspect release];
[super dealloc];
}
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"media"]) {
if(!isReloading)
{
isReloading = YES;
[self performSelector:@selector(reload) withObject:nil afterDelay:2.];
}
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
- (void)willBePushed
{
PRINT_ME();
}
- (void)willBePopped
{
PRINT_ME();
}
#pragma mark -
#pragma mark Reload hack
- (void) reload
{
[[self list] reload];
isReloading = NO;
}
#pragma mark -
#pragma mark Data source
- (NSInteger)itemCount
{
return [mediaListAspect count];
}
- (CGFloat)heightForRow:(NSInteger)row
{
return 64.0;
}
- (BOOL)rowSelectable:(NSInteger)row
{
return YES;
}
- (NSString*)titleForRow:(NSInteger)row
{
return [[mediaListAspect mediaAtIndex:row] valueForKeyPath:@"metaDictionary.title"];
}
- (id)itemForRow:(NSInteger)row
{
BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf];
BRTextMenuItemLayer * item = nil;
if(isDirectory) {
item = [BRTextMenuItemLayer folderMenuItem];
}
else {
item = [BRTextMenuItemLayer menuItem];
}
[item setTitle:[self titleForRow:row]];
return item;
}
- (void)itemSelected:(NSInteger)row
{
BOOL isDirectory = ![[mediaListAspect nodeAtIndex:row] isLeaf];
BRController * controller = nil;
if(isDirectory) {
controller = [[[VLCMediaListController alloc] initWithMediaListAspect:[[mediaListAspect nodeAtIndex:row] children]] autorelease];
}
else {
static VLCPlayerController * playerController = nil;
if(playerController == nil) {
playerController = [[VLCPlayerController alloc] init];
}
playerController.media = [mediaListAspect mediaAtIndex:row];
controller = playerController;
}
if(controller != nil) {
[[self stack] pushController:controller];
}
}
@end
\ No newline at end of file
...@@ -9,12 +9,13 @@ ...@@ -9,12 +9,13 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <BackRow/BRMediaPlayerController.h> #import <BackRow/BRMediaPlayerController.h>
#import "VLCMediaLayer.h" #import "VLCMediaLayer.h"
#import <VLCKit/VLCKit.h>
@interface VLCPlayerController : BRController @interface VLCPlayerController : BRController
{ {
VLCMediaLayer * _mediaLayer; VLCMediaLayer * _mediaLayer;
} }
@property(retain) NSString * path; @property(retain) VLCMedia * media;
@end @end
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import "VLCPlayerController.h" #import "VLCPlayerController.h"
#import <BackRow/BREvent.h> #import <BackRow/BREvent.h>
#import <BackRow/BRLayer.h> #import <BackRow/BRLayer.h>
#import <BackRow/BRControllerStack.h> #import <BackRow/BRControllerStack.h>
...@@ -27,14 +28,14 @@ ...@@ -27,14 +28,14 @@
return self; return self;
} }
- (NSString*)path - (VLCMedia *)media
{ {
return [_mediaLayer.url path]; return [_mediaLayer media];
} }
- (void)setPath:(NSString*)path - (void)setMedia:(VLCMedia *)media
{ {
_mediaLayer.url = [NSURL fileURLWithPath:path]; _mediaLayer.media = media;
} }
- (void)brEventAction:(BREvent*)event - (void)brEventAction:(BREvent*)event
......
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