Commit 4884ccb0 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMedia.m: Use mediaWithURL:(NSURL*) instead of...

MacOSX/Framework/VLCMedia.m: Use mediaWithURL:(NSURL*) instead of mediaWithURL:(NSString*). Add a mediaWithPath:(NSString*) constructor.
parent fcb3edd6
...@@ -120,17 +120,18 @@ extern NSString *VLCMediaMetaChanged; //< Notification message for when t ...@@ -120,17 +120,18 @@ extern NSString *VLCMediaMetaChanged; //< Notification message for when t
* will be automatically released. * will be automatically released.
* \see initWithMediaURL * \see initWithMediaURL
*/ */
+ (id)mediaWithURL:(NSString *)anURL; + (id)mediaWithURL:(NSURL *)anURL;
+ (id)mediaWithPath:(NSString *)aPath;
/* Initializers */ /* Initializers */
/** /**
* Initializes a new VLCMedia object to use the specified URL. Will return nil if * 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 * the specified URL references a directory that does not comply with DVD file
* structure. * 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. * \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 * Returns an NSComparisonResult value that indicates the lexical ordering of
......
...@@ -113,17 +113,17 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -113,17 +113,17 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
@end @end
@implementation VLCMedia @implementation VLCMedia
+ (id)mediaWithURL:(NSString *)aURL; + (id)mediaWithPath:(NSString *)aPath;
{ {
// For some unknown reason, compiler kept shooting me a warning saying: return [[[VLCMedia alloc] initWithPath:(id)aPath] autorelease];
// 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];
} }
- (id)initWithURL:(NSString *)aURL + (id)mediaWithURL:(NSURL *)aURL;
{
return [[[VLCMedia alloc] initWithPath:(id)[aURL path] autorelease];
}
- (id)initWithPath:(NSString *)aPath
{ {
if (self = [super init]) if (self = [super init])
{ {
...@@ -138,7 +138,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self) ...@@ -138,7 +138,7 @@ static void HandleMediaDurationChanged(const libvlc_event_t *event, void *self)
url = [aURL copy]; url = [aURL copy];
delegate = nil; delegate = nil;
metaDictionary = nil; metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3];
// This value is set whenever the demuxer figures out what the length is. // 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? // TODO: Easy way to tell the length of the movie without having to instiate the demuxer. Maybe cached info?
......
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