From: Pierre d'Herbemont Date: Tue, 11 Dec 2007 13:06:19 +0000 (+0000) Subject: MacOSX/Framework/VLCMedia.m: Use mediaWithURL:(NSURL*) instead of mediaWithURL:(NSStr... X-Git-Tag: 0.9.0-test0~4189 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=4884ccb0b8057f520eff16f670de7e3b663e16bc;hp=fcb3edd603d9e26e8281a8d7b15ba25ba01d72b5;p=vlc MacOSX/Framework/VLCMedia.m: Use mediaWithURL:(NSURL*) instead of mediaWithURL:(NSString*). Add a mediaWithPath:(NSString*) constructor. --- diff --git a/extras/MacOSX/Framework/Headers/Public/VLCMedia.h b/extras/MacOSX/Framework/Headers/Public/VLCMedia.h index f490d0e07e..69e9c02e9f 100644 --- a/extras/MacOSX/Framework/Headers/Public/VLCMedia.h +++ b/extras/MacOSX/Framework/Headers/Public/VLCMedia.h @@ -120,17 +120,18 @@ extern NSString *VLCMediaMetaChanged; //< Notification message for when t * will be automatically released. * \see initWithMediaURL */ -+ (id)mediaWithURL:(NSString *)anURL; ++ (id)mediaWithURL:(NSURL *)anURL; ++ (id)mediaWithPath:(NSString *)aPath; /* Initializers */ /** * Initializes a new VLCMedia object to use the specified URL. Will return nil if * the specified URL references a directory that does not comply with DVD file * structure. - * \param anURL URL to media to be accessed. + * \param aPath URL to media to be accessed. * \return A new VLCMedia object, only if there were no errors. */ -- (id)initWithURL:(NSString *)anURL; +- (id)initWithPath:(NSString *)aPath; /** * Returns an NSComparisonResult value that indicates the lexical ordering of diff --git a/extras/MacOSX/Framework/Sources/VLCMedia.m b/extras/MacOSX/Framework/Sources/VLCMedia.m index 947fabc130..b73f21244c 100644 --- a/extras/MacOSX/Framework/Sources/VLCMedia.m +++ b/extras/MacOSX/Framework/Sources/VLCMedia.m @@ -113,17 +113,17 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) @end @implementation VLCMedia -+ (id)mediaWithURL:(NSString *)aURL; ++ (id)mediaWithPath:(NSString *)aPath; { - // For some unknown reason, compiler kept shooting me a warning saying: - // warning: passing argument 1 of 'initWithURL:' from distinct Objective-C type - // Research on the net shows that the error means that the argument passed - // is not compatible with the expected argument. Doesn't make sense, however - // the warning goes away when it is casted it with "id". - return [[[VLCMedia alloc] initWithURL:(id)aURL] autorelease]; + return [[[VLCMedia alloc] initWithPath:(id)aPath] autorelease]; } -- (id)initWithURL:(NSString *)aURL ++ (id)mediaWithURL:(NSURL *)aURL; +{ + return [[[VLCMedia alloc] initWithPath:(id)[aURL path] autorelease]; +} + +- (id)initWithPath:(NSString *)aPath { if (self = [super init]) { @@ -138,7 +138,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) url = [aURL copy]; delegate = nil; - metaDictionary = nil; + metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3]; // This value is set whenever the demuxer figures out what the length is. // TODO: Easy way to tell the length of the movie without having to instiate the demuxer. Maybe cached info?