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
@interface VLCMedia : NSObject
{
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
VLCTime * length; //< Duration of the media
NSMutableDictionary * metaDictionary; //< Meta data storage
......@@ -209,7 +209,7 @@ typedef enum VLCMediaState
/**
* The URL for the receiver's media resource.
*/
@property (readonly) NSString * url;
@property (readonly) NSURL * url;
/**
* The receiver's sub list.
......
......@@ -175,7 +175,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
&ex);
catch_exception(&ex);
url = [aPath copy];
delegate = nil;
metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3];
......@@ -200,7 +199,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
&ex);
catch_exception(&ex);
url = [aName copy];
delegate = nil;
metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3];
......@@ -251,7 +249,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
- (NSString *)description
{
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
......@@ -261,7 +259,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
else if (!media)
return NSOrderedDescending;
else
return [[self url] compare:[media url]];
return [[[self url] absoluteString] compare:[[media url] absoluteString]];
}
@synthesize delegate;
......@@ -329,13 +327,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
{
libvlc_exception_t 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 );
p_md = md;
......@@ -417,6 +408,14 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
libvlc_exception_t 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 );
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