Commit 12a4698c authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMedia: make the url property an NSURL.

parent e3bc1e0b
...@@ -108,7 +108,7 @@ typedef enum VLCMediaState ...@@ -108,7 +108,7 @@ typedef enum VLCMediaState
@interface VLCMedia : NSObject @interface VLCMedia : NSObject
{ {
void * p_md; //< Internal media descriptor instance void * p_md; //< Internal media descriptor instance
NSString * url; //< URL for this media resource NSURL * url; //< URL for this media resource
VLCMediaList * subitems; //< Sub list of items VLCMediaList * subitems; //< Sub list of items
VLCTime * length; //< Duration of the media VLCTime * length; //< Duration of the media
NSMutableDictionary * metaDictionary; //< Meta data storage NSMutableDictionary * metaDictionary; //< Meta data storage
...@@ -209,7 +209,7 @@ typedef enum VLCMediaState ...@@ -209,7 +209,7 @@ typedef enum VLCMediaState
/** /**
* The URL for the receiver's media resource. * The URL for the receiver's media resource.
*/ */
@property (readonly) NSString * url; @property (readonly) NSURL * url;
/** /**
* The receiver's sub list. * The receiver's sub list.
......
...@@ -175,7 +175,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -175,7 +175,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
&ex); &ex);
catch_exception(&ex); catch_exception(&ex);
url = [aPath copy];
delegate = nil; delegate = nil;
metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3]; metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3];
...@@ -199,8 +198,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -199,8 +198,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
[aName UTF8String], [aName UTF8String],
&ex); &ex);
catch_exception(&ex); catch_exception(&ex);
url = [aName copy];
delegate = nil; delegate = nil;
metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3]; metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3];
...@@ -251,7 +249,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -251,7 +249,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
- (NSString *)description - (NSString *)description
{ {
NSString * result = [metaDictionary objectForKey:VLCMetaInformationTitle]; NSString * result = [metaDictionary objectForKey:VLCMetaInformationTitle];
return [NSString stringWithFormat:@"<%@ %p> %@", [self className], self, (result ? result : url)]; return [NSString stringWithFormat:@"<%@ %p> %@", [self className], self, (result ? result : [url absoluteString])];
} }
- (NSComparisonResult)compare:(VLCMedia *)media - (NSComparisonResult)compare:(VLCMedia *)media
...@@ -261,7 +259,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -261,7 +259,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
else if (!media) else if (!media)
return NSOrderedDescending; return NSOrderedDescending;
else else
return [[self url] compare:[media url]]; return [[[self url] absoluteString] compare:[[media url] absoluteString]];
} }
@synthesize delegate; @synthesize delegate;
...@@ -329,14 +327,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -329,14 +327,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
char * p_url;
p_url = libvlc_media_descriptor_get_mrl( md, &ex );
catch_exception( &ex );
url = [[NSString stringWithUTF8String:p_url] retain];
free( p_url );
libvlc_media_descriptor_retain( md ); libvlc_media_descriptor_retain( md );
p_md = md; p_md = md;
...@@ -417,6 +408,14 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -417,6 +408,14 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
char * p_url = libvlc_media_descriptor_get_mrl( p_md, &ex );
catch_exception( &ex );
url = [[NSURL URLWithString:[NSString stringWithUTF8String:p_url]] retain];
if( !url ) /* Attempt to interpret as a file path then */
url = [[NSURL fileURLWithPath:[NSString stringWithUTF8String:p_url]] retain];
free( p_url );
libvlc_media_descriptor_set_user_data( p_md, (void*)self, &ex ); libvlc_media_descriptor_set_user_data( p_md, (void*)self, &ex );
catch_exception( &ex ); catch_exception( &ex );
......
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