Commit 933b9ff9 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework: Re-enable VLCMediaDiscoverer.

parent d006608b
......@@ -29,6 +29,7 @@
#import <VLC/VLCMediaLibrary.h>
#import <VLC/VLCMediaList.h>
#import <VLC/VLCMediaListAspect.h>
#import <VLC/VLCMediaDiscoverer.h>
#import <VLC/VLCTime.h>
#import <VLC/VLCVideoView.h>
......
......@@ -23,20 +23,21 @@
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import <VLC/VLCPlaylist.h>
#import <VLC/VLCMediaList.h>
@class VLCPlaylist;
@class VLCMediaList;
@interface VLCMediaDiscoverer : NSObject
{
NSString *localizedName;
VLCPlaylist * playlist;
VLCMediaList * discoveredMedia;
void * mdis;
}
+ (NSArray *)availableMediaDiscoverer;
- (id)initWithName:(NSString *)aServiceName;
- (VLCPlaylist *)playlist;
- (VLCMediaList *)discoveredMedia;
- (NSString *)localizedName;
@end
......@@ -23,13 +23,27 @@
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import <VLC/VLCMediaDiscoverer.h>
#import "VLCMediaDiscoverer.h"
#import "VLCLibrary.h"
#import "VLCLibVLCBridging.h"
#include <vlc/libvlc.h>
static NSArray * availableMediaDiscoverer = nil;
@implementation VLCMediaDiscoverer
+ (NSArray *)availableMediaDiscoverer
{
if( !availableMediaDiscoverer )
{
availableMediaDiscoverer = [[NSArray arrayWithObjects:
[[[VLCMediaDiscoverer alloc] initWithName:@"sap"] autorelease],
[[[VLCMediaDiscoverer alloc] initWithName:@"shoutcast"] autorelease],
[[[VLCMediaDiscoverer alloc] initWithName:@"shoutcasttv"] autorelease], nil] retain];
}
return availableMediaDiscoverer;
}
- (id)initWithName:(NSString *)aServiceName
{
if (self = [super init])
......@@ -37,7 +51,7 @@
libvlc_exception_t ex;
libvlc_exception_init( &ex );
localizedName = nil;
playlist = nil;
discoveredMedia = nil;
mdis = libvlc_media_discoverer_new_from_name( [VLCLibrary sharedInstance],
[aServiceName cString],
&ex );
......@@ -50,40 +64,31 @@
{
if( localizedName )
[localizedName release];
if( playlist )
[playlist release];
if( discoveredMedia )
[discoveredMedia release];
libvlc_media_discoverer_release( mdis );
[super dealloc];
}
- (VLCPlaylist *) playlist
- (VLCMediaList *) discoveredMedia
{
if( playlist )
return playlist;
if( discoveredMedia )
return discoveredMedia;
libvlc_media_list_t * p_mlist = libvlc_media_discoverer_media_list( mdis );
VLCPlaylist * ret = [VLCPlaylist playlistWithLibVLCMediaList: p_mlist];
VLCMediaList * ret = [VLCMediaList mediaListWithLibVLCMediaList: p_mlist];
libvlc_media_list_release( p_mlist );
/* Hack until this gets done properly upstream */
char * name = libvlc_media_discoverer_localized_name( mdis );
if( !name )
{
VLCMedia * media = [ret mediaAtIndex: 0];
ret = media ? (VLCPlaylist *)[media subitems] : nil;
}
free(name);
if( ret )
{
playlist = [ret retain];
discoveredMedia = [ret retain];
}
return ret;
return discoveredMedia;
}
- (NSString *)localizedName
{
NSString * ret = nil;
NSString * aString = nil;
char * name = libvlc_media_discoverer_localized_name( mdis );
if( localizedName )
......@@ -91,19 +96,12 @@
if (name)
{
ret = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
aString = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
free( name );
}
/* XXX: Hack until this gets done properly upstream. This is really slow. */
if (!ret)
{
libvlc_media_list_t * p_mlist = libvlc_media_discoverer_media_list( mdis );
ret = [[[[VLCPlaylist playlistWithLibVLCMediaList: p_mlist] mediaAtIndex:0] metaInformation] objectForKey: VLCMetaInformationTitle];
libvlc_media_list_release( p_mlist );
}
if( ret )
if( aString )
{
localizedName = [ret retain];
localizedName = [aString retain];
}
return localizedName;
}
......
......@@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */
6303C43A0CF45CAE0000ECC8 /* VLCMediaListAspect.m in Sources */ = {isa = PBXBuildFile; fileRef = 6303C4390CF45CAE0000ECC8 /* VLCMediaListAspect.m */; };
6303C43C0CF45CC30000ECC8 /* VLCMediaListAspect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6303C43B0CF45CC30000ECC8 /* VLCMediaListAspect.h */; settings = {ATTRIBUTES = (Public, ); }; };
637D5ABD0CF6F2650073EA45 /* VLCMediaDiscoverer.h in Headers */ = {isa = PBXBuildFile; fileRef = 637D5ABC0CF6F2650073EA45 /* VLCMediaDiscoverer.h */; settings = {ATTRIBUTES = (Public, ); }; };
637D5ADC0CF6F2720073EA45 /* VLCMediaDiscoverer.m in Sources */ = {isa = PBXBuildFile; fileRef = 637D5ADB0CF6F2720073EA45 /* VLCMediaDiscoverer.m */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
EF7311900CB5797B009473B4 /* VLCAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = EF73118E0CB5797B009473B4 /* VLCAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
EF7311910CB5797B009473B4 /* VLCAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = EF73118F0CB5797B009473B4 /* VLCAudio.m */; };
......@@ -40,6 +42,8 @@
63030CC70CCA652C0088ECD1 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = "<group>"; };
6303C4390CF45CAE0000ECC8 /* VLCMediaListAspect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCMediaListAspect.m; sourceTree = "<group>"; };
6303C43B0CF45CC30000ECC8 /* VLCMediaListAspect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaListAspect.h; path = Public/VLCMediaListAspect.h; sourceTree = "<group>"; };
637D5ABC0CF6F2650073EA45 /* VLCMediaDiscoverer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = VLCMediaDiscoverer.h; path = Public/VLCMediaDiscoverer.h; sourceTree = "<group>"; };
637D5ADB0CF6F2720073EA45 /* VLCMediaDiscoverer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VLCMediaDiscoverer.m; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* VLC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = VLC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
EF73118E0CB5797B009473B4 /* VLCAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCAudio.h; path = Public/VLCAudio.h; sourceTree = "<group>"; };
......@@ -125,6 +129,7 @@
EF78BD3C0CAEEFF600354E6E /* VLCEventManager.m */,
EF78BD3D0CAEEFF600354E6E /* VLCLibrary.m */,
EF78BD3E0CAEEFF600354E6E /* VLCMedia.m */,
637D5ADB0CF6F2720073EA45 /* VLCMediaDiscoverer.m */,
EF78BD410CAEEFF600354E6E /* VLCMediaList.m */,
6303C4390CF45CAE0000ECC8 /* VLCMediaListAspect.m */,
EF8BB8CF0CAFA8D80038A613 /* VLCMediaPlayer.m */,
......@@ -177,6 +182,7 @@
EF78BD0D0CAEEEC300354E6E /* VLCEventManager.h */,
EF78BD0E0CAEEEC300354E6E /* VLCLibrary.h */,
EF78BD130CAEEEE700354E6E /* VLCMedia.h */,
637D5ABC0CF6F2650073EA45 /* VLCMediaDiscoverer.h */,
EF78BD160CAEEEE700354E6E /* VLCMediaList.h */,
6303C43B0CF45CC30000ECC8 /* VLCMediaListAspect.h */,
EF8BB8CE0CAFA8D80038A613 /* VLCMediaPlayer.h */,
......@@ -207,6 +213,7 @@
EF7311900CB5797B009473B4 /* VLCAudio.h in Headers */,
EFD551DD0CC6DD720074CEE1 /* VLCLibVLCBridging.h in Headers */,
6303C43C0CF45CC30000ECC8 /* VLCMediaListAspect.h in Headers */,
637D5ABD0CF6F2650073EA45 /* VLCMediaDiscoverer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -293,6 +300,7 @@
EF8BB8D10CAFA8D80038A613 /* VLCMediaPlayer.m in Sources */,
EF7311910CB5797B009473B4 /* VLCAudio.m in Sources */,
6303C43A0CF45CAE0000ECC8 /* VLCMediaListAspect.m in Sources */,
637D5ADC0CF6F2720073EA45 /* VLCMediaDiscoverer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -3,12 +3,12 @@
archiveVersion = 1;
classes = {
};
objectVersion = 44;
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
630FBE2D0CF0B3940072CB10 /* VLC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630FBE2C0CF0B3930072CB10 /* VLC.framework */; };
630FBE3C0CF0B3D80072CB10 /* VLC.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 630FBE2C0CF0B3930072CB10 /* VLC.framework */; };
637D59B60CF5A5F90073EA45 /* VLC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630FBE2C0CF0B3930072CB10 /* VLC.framework */; };
63C5518D0C7F663500B202D3 /* VLCController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63C5518B0C7F663500B202D3 /* VLCController.m */; };
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
......@@ -50,8 +50,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
637D59B60CF5A5F90073EA45 /* VLC.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
630FBE2D0CF0B3940072CB10 /* VLC.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -233,10 +233,13 @@
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
"\"$(SRCROOT)/../Framework/build/Release\"",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../..\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../Framework\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\\\"$(SRCROOT)/../Framework/build/Release\\\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../Framework/build/Release\"";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
......@@ -257,10 +260,13 @@
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
"\"$(SRCROOT)/../Framework/build/Release\"",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../..\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../Framework\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\\\"$(SRCROOT)/../Framework/build/Release\\\"";
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_2 = "\"$(SRCROOT)/../Framework/build/Release\"";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = Info.plist;
......
......@@ -32,7 +32,7 @@
VLCMediaList * mediaList = [[VLCMediaList alloc] init];
[mediaList addMedia:[VLCMedia mediaWithURL:@"/dev/null"]];
NSArrayController * arrayController = [[NSArrayController alloc] init];
[arrayController bind:@"contentArray" toObject:mediaList withKeyPath:@"media" options:nil];
[arrayController bind:@"contentArray" toObject:[mediaList flatAspect] withKeyPath:@"media" options:nil];
NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
[bindingOptions setObject:@"No Title" forKey:NSDisplayNameBindingOption];
......
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