Commit 390f573e authored by Felix Paul Kühne's avatar Felix Paul Kühne

framework: updated to current libvlc API

parent ba423412
...@@ -230,7 +230,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -230,7 +230,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
/* We must make sure we won't receive new event after an upcoming dealloc /* We must make sure we won't receive new event after an upcoming dealloc
* We also may receive a -retain in some event callback that may occcur * We also may receive a -retain in some event callback that may occcur
* Before libvlc_event_detach. So this can't happen in dealloc */ * Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t * p_em = libvlc_media_event_manager(p_md, NULL); libvlc_event_manager_t * p_em = libvlc_media_event_manager(p_md);
libvlc_event_detach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self, NULL); libvlc_event_detach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self, NULL);
// libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self, NULL); // libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self, NULL); libvlc_event_detach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self, NULL);
...@@ -311,7 +311,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -311,7 +311,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
- (BOOL)isPreparsed - (BOOL)isPreparsed
{ {
return libvlc_media_is_preparsed( p_md, NULL ); return libvlc_media_is_preparsed( p_md );
} }
@synthesize url; @synthesize url;
...@@ -335,9 +335,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -335,9 +335,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
{ {
if (self = [super init]) if (self = [super init])
{ {
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_media_retain( md ); libvlc_media_retain( md );
p_md = md; p_md = md;
...@@ -432,25 +429,22 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -432,25 +429,22 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
artFetched = NO; artFetched = NO;
char * p_url = libvlc_media_get_mrl( p_md, &ex ); char * p_url = libvlc_media_get_mrl( p_md );
catch_exception( &ex );
url = [[NSURL URLWithString:[NSString stringWithUTF8String:p_url]] retain]; url = [[NSURL URLWithString:[NSString stringWithUTF8String:p_url]] retain];
if( !url ) /* Attempt to interpret as a file path then */ if( !url ) /* Attempt to interpret as a file path then */
url = [[NSURL fileURLWithPath:[NSString stringWithUTF8String:p_url]] retain]; url = [[NSURL fileURLWithPath:[NSString stringWithUTF8String:p_url]] retain];
free( p_url ); free( p_url );
libvlc_media_set_user_data( p_md, (void*)self, &ex ); libvlc_media_set_user_data( p_md, (void*)self );
catch_exception( &ex );
libvlc_event_manager_t * p_em = libvlc_media_event_manager( p_md, &ex ); libvlc_event_manager_t * p_em = libvlc_media_event_manager( p_md );
libvlc_event_attach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self, &ex); libvlc_event_attach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self, &ex);
// libvlc_event_attach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self, &ex); // libvlc_event_attach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self, &ex); libvlc_event_attach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaSubItemAdded, HandleMediaSubItemAdded, self, &ex); libvlc_event_attach(p_em, libvlc_MediaSubItemAdded, HandleMediaSubItemAdded, self, &ex);
catch_exception( &ex );
libvlc_media_list_t * p_mlist = libvlc_media_subitems( p_md, NULL ); libvlc_media_list_t * p_mlist = libvlc_media_subitems( p_md );
if (!p_mlist) if (!p_mlist)
subitems = nil; subitems = nil;
...@@ -460,7 +454,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -460,7 +454,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
libvlc_media_list_release( p_mlist ); libvlc_media_list_release( p_mlist );
} }
state = LibVLCStateToMediaState(libvlc_media_get_state( p_md, NULL )); state = LibVLCStateToMediaState(libvlc_media_get_state( p_md ));
/* Force VLCMetaInformationTitle, that will trigger preparsing /* Force VLCMetaInformationTitle, that will trigger preparsing
* And all the other meta will be added through the libvlc event system */ * And all the other meta will be added through the libvlc event system */
...@@ -469,7 +463,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -469,7 +463,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
- (void)fetchMetaInformationFromLibVLCWithType:(NSString *)metaType - (void)fetchMetaInformationFromLibVLCWithType:(NSString *)metaType
{ {
char * psz_value = libvlc_media_get_meta( p_md, [VLCMedia stringToMetaType:metaType], NULL); char * psz_value = libvlc_media_get_meta( p_md, [VLCMedia stringToMetaType:metaType] );
NSString * newValue = psz_value ? [NSString stringWithUTF8String: psz_value] : nil; NSString * newValue = psz_value ? [NSString stringWithUTF8String: psz_value] : nil;
NSString * oldValue = [metaDictionary valueForKey:metaType]; NSString * oldValue = [metaDictionary valueForKey:metaType];
free(psz_value); free(psz_value);
...@@ -530,7 +524,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -530,7 +524,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
if( subitems ) if( subitems )
return; /* Nothing to do */ return; /* Nothing to do */
libvlc_media_list_t * p_mlist = libvlc_media_subitems( p_md, NULL ); libvlc_media_list_t * p_mlist = libvlc_media_subitems( p_md );
NSAssert( p_mlist, @"The mlist shouldn't be nil, we are receiving a subItemAdded"); NSAssert( p_mlist, @"The mlist shouldn't be nil, we are receiving a subItemAdded");
......
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