瀏覽代碼

libvlc: rename libvlc_media_descriptor to libvlc_media and libvlc_media_instance to libvlc_media_player.

Pierre d'Herbemont 17 年之前
父節點
當前提交
886ad866c2
共有 4 個文件被更改,包括 54 次插入54 次删除
  1. 22 22
      Sources/VLCMedia.m
  2. 3 3
      Sources/VLCMediaList.m
  3. 3 3
      Sources/VLCMediaListAspect.m
  4. 26 26
      Sources/VLCMediaPlayer.m

+ 22 - 22
Sources/VLCMedia.m

@@ -104,8 +104,8 @@ static inline VLCMediaState LibVLCStateToMediaState( libvlc_state_t state )
  */
 static void HandleMediaMetaChanged(const libvlc_event_t * event, void * self)
 {
-    if( event->u.media_descriptor_meta_changed.meta_type == libvlc_meta_Publisher ||
-        event->u.media_descriptor_meta_changed.meta_type == libvlc_meta_NowPlaying )
+    if( event->u.media_meta_changed.meta_type == libvlc_meta_Publisher ||
+        event->u.media_meta_changed.meta_type == libvlc_meta_NowPlaying )
     {
         /* Skip those meta. We don't really care about them for now.
          * And they occure a lot */
@@ -114,7 +114,7 @@ static void HandleMediaMetaChanged(const libvlc_event_t * event, void * self)
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
     [[VLCEventManager sharedManager] callOnMainThreadObject:self
                                                  withMethod:@selector(metaChanged:)
-                                       withArgumentAsObject:[VLCMedia metaTypeToString:event->u.media_descriptor_meta_changed.meta_type]];
+                                       withArgumentAsObject:[VLCMedia metaTypeToString:event->u.media_meta_changed.meta_type]];
     [pool release];
 }
 
@@ -125,7 +125,7 @@ static void HandleMediaMetaChanged(const libvlc_event_t * event, void * self)
 //    [[VLCEventManager sharedManager] callOnMainThreadObject:self
 //                                                 withMethod:@selector(setLength:)
 //                                       withArgumentAsObject:[VLCTime timeWithNumber:
-//                                           [NSNumber numberWithLongLong:event->u.media_descriptor_duration_changed.new_duration]]];
+//                                           [NSNumber numberWithLongLong:event->u.media_duration_changed.new_duration]]];
 //    [pool release];
 //}
 
@@ -136,7 +136,7 @@ static void HandleMediaStateChanged(const libvlc_event_t * event, void * self)
     [[VLCEventManager sharedManager] callOnMainThreadObject:self
                                                  withMethod:@selector(setStateAsNumber:)
                                        withArgumentAsObject:[NSNumber numberWithInt:
-                                            LibVLCStateToMediaState(event->u.media_descriptor_state_changed.new_state)]];
+                                            LibVLCStateToMediaState(event->u.media_state_changed.new_state)]];
     [pool release];
 }
 
@@ -180,7 +180,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
         
-        p_md = libvlc_media_descriptor_new([VLCLibrary sharedInstance],
+        p_md = libvlc_media_new([VLCLibrary sharedInstance],
                                            [aPath UTF8String],
                                            &ex);
         catch_exception(&ex);
@@ -204,7 +204,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
         libvlc_exception_t ex;
         libvlc_exception_init(&ex);
         
-        p_md = libvlc_media_descriptor_new_as_node([VLCLibrary sharedInstance],
+        p_md = libvlc_media_new_as_node([VLCLibrary sharedInstance],
                                                    [aName UTF8String],
                                                    &ex);
         catch_exception(&ex);
@@ -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 also may receive a -retain in some event callback that may occcur
              * Before libvlc_event_detach. So this can't happen in dealloc */
-            libvlc_event_manager_t * p_em = libvlc_media_descriptor_event_manager(p_md, NULL);
+            libvlc_event_manager_t * p_em = libvlc_media_event_manager(p_md, NULL);
             libvlc_event_detach(p_em, libvlc_MediaDescriptorMetaChanged,     HandleMediaMetaChanged,     self, NULL);
 //            libvlc_event_detach(p_em, libvlc_MediaDescriptorDurationChanged, HandleMediaDurationChanged, self, NULL);
             libvlc_event_detach(p_em, libvlc_MediaDescriptorStateChanged,    HandleMediaStateChanged,    self, NULL);
@@ -251,7 +251,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     [subitems release];
     [metaDictionary release];
 
-    libvlc_media_descriptor_release( p_md );
+    libvlc_media_release( p_md );
 
     [super dealloc];
 }
@@ -278,7 +278,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     if (!length) 
     {
         // Try figuring out what the length is
-        long long duration = libvlc_media_descriptor_get_duration( p_md, NULL );
+        long long duration = libvlc_media_get_duration( p_md, NULL );
         if (duration > -1) 
         {
             [self setLength:[VLCTime timeWithNumber:[NSNumber numberWithLongLong:duration]]];
@@ -311,7 +311,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
 - (BOOL)isPreparsed
 {
-    return libvlc_media_descriptor_is_preparsed( p_md, NULL );
+    return libvlc_media_is_preparsed( p_md, NULL );
 }
 
 @synthesize url;
@@ -338,7 +338,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
                 
-        libvlc_media_descriptor_retain( md );
+        libvlc_media_retain( md );
         p_md = md;
         
         metaDictionary = [[NSMutableDictionary alloc] initWithCapacity:3];
@@ -354,11 +354,11 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
 + (id)mediaWithMedia:(VLCMedia *)media andLibVLCOptions:(NSDictionary *)options
 {
-    libvlc_media_descriptor_t * p_md;
-    p_md = libvlc_media_descriptor_duplicate( [media libVLCMediaDescriptor] );
+    libvlc_media_t * p_md;
+    p_md = libvlc_media_duplicate( [media libVLCMediaDescriptor] );
     for( NSString * key in [options allKeys] )
     {
-        libvlc_media_descriptor_add_option(p_md, [[NSString stringWithFormat:@"%@=#%@", key, [options objectForKey:key]] UTF8String], NULL);
+        libvlc_media_add_option(p_md, [[NSString stringWithFormat:@"%@=#%@", key, [options objectForKey:key]] UTF8String], NULL);
     }
     return [VLCMedia mediaWithLibVLCMediaDescriptor:p_md];
 }
@@ -432,7 +432,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
     artFetched = NO;
 
-    char * p_url = libvlc_media_descriptor_get_mrl( p_md, &ex );
+    char * p_url = libvlc_media_get_mrl( p_md, &ex );
     catch_exception( &ex );
 
     url = [[NSURL URLWithString:[NSString stringWithUTF8String:p_url]] retain];
@@ -440,17 +440,17 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
         url = [[NSURL fileURLWithPath:[NSString stringWithUTF8String:p_url]] retain];
     free( p_url );
 
-    libvlc_media_descriptor_set_user_data( p_md, (void*)self, &ex );
+    libvlc_media_set_user_data( p_md, (void*)self, &ex );
     catch_exception( &ex );
 
-    libvlc_event_manager_t * p_em = libvlc_media_descriptor_event_manager( p_md, &ex );
+    libvlc_event_manager_t * p_em = libvlc_media_event_manager( p_md, &ex );
     libvlc_event_attach(p_em, libvlc_MediaDescriptorMetaChanged,     HandleMediaMetaChanged,     self, &ex);
 //    libvlc_event_attach(p_em, libvlc_MediaDescriptorDurationChanged, HandleMediaDurationChanged, self, &ex);
     libvlc_event_attach(p_em, libvlc_MediaDescriptorStateChanged,    HandleMediaStateChanged,    self, &ex);
     libvlc_event_attach(p_em, libvlc_MediaDescriptorSubItemAdded,    HandleMediaSubItemAdded,    self, &ex);
     catch_exception( &ex );
     
-    libvlc_media_list_t * p_mlist = libvlc_media_descriptor_subitems( p_md, NULL );
+    libvlc_media_list_t * p_mlist = libvlc_media_subitems( p_md, NULL );
 
     if (!p_mlist)
         subitems = nil;
@@ -460,7 +460,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
         libvlc_media_list_release( p_mlist );
     }
 
-    state = LibVLCStateToMediaState(libvlc_media_descriptor_get_state( p_md, NULL ));
+    state = LibVLCStateToMediaState(libvlc_media_get_state( p_md, NULL ));
 
     /* Force VLCMetaInformationTitle, that will trigger preparsing
      * And all the other meta will be added through the libvlc event system */
@@ -469,7 +469,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
 - (void)fetchMetaInformationFromLibVLCWithType:(NSString *)metaType
 {
-    char * psz_value = libvlc_media_descriptor_get_meta( p_md, [VLCMedia stringToMetaType:metaType], NULL);
+    char * psz_value = libvlc_media_get_meta( p_md, [VLCMedia stringToMetaType:metaType], NULL);
     NSString * newValue = psz_value ? [NSString stringWithUTF8String: psz_value] : nil;
     NSString * oldValue = [metaDictionary valueForKey:metaType];
     free(psz_value);
@@ -530,7 +530,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     if( subitems )
         return; /* Nothing to do */
 
-    libvlc_media_list_t * p_mlist = libvlc_media_descriptor_subitems( p_md, NULL );
+    libvlc_media_list_t * p_mlist = libvlc_media_subitems( p_md, NULL );
 
     NSAssert( p_mlist, @"The mlist shouldn't be nil, we are receiving a subItemAdded");
 

+ 3 - 3
Sources/VLCMediaList.m

@@ -155,7 +155,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
     // Add it to the libvlc's medialist
     libvlc_exception_t p_e;
     libvlc_exception_init( &p_e );
-    libvlc_media_list_insert_media_descriptor( p_mlist, [media libVLCMediaDescriptor], index, &p_e );
+    libvlc_media_list_insert_media( p_mlist, [media libVLCMediaDescriptor], index, &p_e );
     catch_exception( &p_e );
 }
 
@@ -267,9 +267,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
         int i, count = libvlc_media_list_count( p_mlist, NULL );
         for( i = 0; i < count; i++ )
         {
-            libvlc_media_descriptor_t * p_md = libvlc_media_list_item_at_index( p_mlist, i, NULL );
+            libvlc_media_t * p_md = libvlc_media_list_item_at_index( p_mlist, i, NULL );
             [cachedMedia addObject:[VLCMedia mediaWithLibVLCMediaDescriptor:p_md]];
-            libvlc_media_descriptor_release(p_md);
+            libvlc_media_release(p_md);
         }
         [self initInternalMediaList];
         libvlc_media_list_unlock(p_mlist);

+ 3 - 3
Sources/VLCMediaListAspect.m

@@ -157,7 +157,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
 {
     libvlc_exception_t p_e;
     libvlc_exception_init( &p_e );
-    libvlc_media_descriptor_t * p_md = libvlc_media_list_view_item_at_index( p_mlv, index, &p_e );
+    libvlc_media_t * p_md = libvlc_media_list_view_item_at_index( p_mlv, index, &p_e );
     catch_exception( &p_e );
     
     // Returns local object for media descriptor, searchs for user data first.  If not found it creates a 
@@ -248,7 +248,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
         int i, count = libvlc_media_list_view_count(p_mlv, NULL);
         for( i = 0; i < count; i++ )
         {
-            libvlc_media_descriptor_t * p_md = libvlc_media_list_view_item_at_index(p_mlv, i, NULL);
+            libvlc_media_t * p_md = libvlc_media_list_view_item_at_index(p_mlv, i, NULL);
             libvlc_media_list_view_t * p_sub_mlv = libvlc_media_list_view_children_at_index(p_mlv, i, NULL);
             VLCMediaListAspectNode * node = [[[VLCMediaListAspectNode alloc] init] autorelease];
             [node setMedia:[VLCMedia mediaWithLibVLCMediaDescriptor: p_md]];
@@ -256,7 +256,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
             if( p_sub_mlv ) NSAssert(![node isLeaf], @"Not leaf");
 
             [cachedNode addObject:node];
-            libvlc_media_descriptor_release(p_md);
+            libvlc_media_release(p_md);
             if( p_sub_mlv ) libvlc_media_list_view_release(p_sub_mlv);
         }
         [self initInternalMediaListView];

+ 26 - 26
Sources/VLCMediaPlayer.m

@@ -66,7 +66,7 @@ static void HandleMediaTimeChanged(const libvlc_event_t * event, void * self)
 
     [[VLCEventManager sharedManager] callOnMainThreadObject:self 
                                                  withMethod:@selector(mediaPlayerTimeChanged:) 
-                                       withArgumentAsObject:[NSNumber numberWithLongLong:event->u.media_instance_time_changed.new_time]];
+                                       withArgumentAsObject:[NSNumber numberWithLongLong:event->u.media_player_time_changed.new_time]];
 
     [[VLCEventManager sharedManager] callOnMainThreadDelegateOfObject:self
                                                    withDelegateMethod:@selector(mediaPlayerTimeChanged:)
@@ -80,7 +80,7 @@ static void HandleMediaPositionChanged(const libvlc_event_t * event, void * self
 
     [[VLCEventManager sharedManager] callOnMainThreadObject:self 
                                                  withMethod:@selector(mediaPlayerPositionChanged:) 
-                                       withArgumentAsObject:[NSNumber numberWithFloat:event->u.media_instance_position_changed.new_position]];
+                                       withArgumentAsObject:[NSNumber numberWithFloat:event->u.media_player_position_changed.new_position]];
     [pool release];
 }
 
@@ -190,7 +190,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     // TODO: Should we tell the delegate that we're shutting down?
     delegate = nil;
 
-    libvlc_media_instance_release((libvlc_media_instance_t *)instance);
+    libvlc_media_player_release((libvlc_media_player_t *)instance);
     
     // Get rid of everything else
     [media release];
@@ -224,7 +224,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     // Make sure that this instance has been associated with the drawing canvas.
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    libvlc_media_instance_set_drawable ((libvlc_media_instance_t *)instance, 
+    libvlc_media_player_set_drawable ((libvlc_media_player_t *)instance, 
                                         (libvlc_drawable_t)aDrawable, 
                                         &ex);
     catch_exception( &ex );
@@ -234,7 +234,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    libvlc_drawable_t ret = libvlc_media_instance_get_drawable ((libvlc_media_instance_t *)instance, 
+    libvlc_drawable_t ret = libvlc_media_player_get_drawable ((libvlc_media_player_t *)instance, 
                                         &ex);
     catch_exception( &ex );
     return (id)ret;
@@ -303,14 +303,14 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 
 - (void)setRate:(float)value
 {
-    libvlc_media_instance_set_rate( instance, value, NULL );
+    libvlc_media_player_set_rate( instance, value, NULL );
 }
 
 - (float)rate
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    float result = libvlc_media_instance_get_rate( instance, &ex );
+    float result = libvlc_media_player_get_rate( instance, &ex );
     catch_exception( &ex );
     return result;
 }
@@ -319,8 +319,8 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    NSSize result = NSMakeSize(libvlc_video_get_height((libvlc_media_instance_t *)instance, &ex),
-                               libvlc_video_get_width((libvlc_media_instance_t *)instance, &ex));
+    NSSize result = NSMakeSize(libvlc_video_get_height((libvlc_media_player_t *)instance, &ex),
+                               libvlc_video_get_width((libvlc_media_player_t *)instance, &ex));
     catch_exception( &ex );
     return result;    
 }
@@ -329,7 +329,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    BOOL result = libvlc_media_instance_has_vout((libvlc_media_instance_t *)instance, &ex);
+    BOOL result = libvlc_media_player_has_vout((libvlc_media_player_t *)instance, &ex);
     if (libvlc_exception_raised( &ex ))
     {
         libvlc_exception_clear( &ex );
@@ -343,7 +343,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    float result = libvlc_media_instance_get_fps( (libvlc_media_instance_t *)instance, &ex );
+    float result = libvlc_media_player_get_fps( (libvlc_media_player_t *)instance, &ex );
     catch_exception( &ex );
     return result;
 }
@@ -354,7 +354,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     libvlc_exception_init( &ex );
     // Time is managed in seconds, while duration is managed in microseconds
     // TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours
-    libvlc_media_instance_set_time( (libvlc_media_instance_t *)instance, 
+    libvlc_media_player_set_time( (libvlc_media_player_t *)instance, 
                                     (value ? [[value numberValue] longLongValue] / 1000 : 0),
                                     &ex );
     catch_exception( &ex );
@@ -367,14 +367,14 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 
 - (void)setChapter:(int)value;
 {
-    libvlc_media_instance_set_chapter( instance, value, NULL );
+    libvlc_media_player_set_chapter( instance, value, NULL );
 }
 
 - (int)chapter
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    int result = libvlc_media_instance_get_chapter( instance, &ex );
+    int result = libvlc_media_player_get_chapter( instance, &ex );
     catch_exception( &ex );
     return result;
 }
@@ -383,7 +383,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    int result = libvlc_media_instance_get_chapter_count( instance, &ex );
+    int result = libvlc_media_player_get_chapter_count( instance, &ex );
     catch_exception( &ex );
     return result;
 }
@@ -437,7 +437,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
-        libvlc_media_instance_set_media_descriptor( instance, [media libVLCMediaDescriptor], &ex );
+        libvlc_media_player_set_media( instance, [media libVLCMediaDescriptor], &ex );
         catch_exception( &ex );
     }
 }
@@ -451,7 +451,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 {    
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    libvlc_media_instance_play( (libvlc_media_instance_t *)instance, &ex );
+    libvlc_media_player_play( (libvlc_media_player_t *)instance, &ex );
     catch_exception( &ex );
     return YES;
 }
@@ -481,7 +481,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     // Pause the stream
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    libvlc_media_instance_pause( (libvlc_media_instance_t *)instance, &ex );
+    libvlc_media_player_pause( (libvlc_media_player_t *)instance, &ex );
     catch_exception( &ex );
     
     // TODO: Should we record the time in case the media instance is destroyed
@@ -507,7 +507,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    libvlc_media_instance_stop((libvlc_media_instance_t *)instance, &ex);
+    libvlc_media_player_stop((libvlc_media_player_t *)instance, &ex);
     catch_exception( &ex );
 }
 
@@ -547,7 +547,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    BOOL ret = libvlc_media_instance_will_play( (libvlc_media_instance_t *)instance, &ex );
+    BOOL ret = libvlc_media_player_will_play( (libvlc_media_player_t *)instance, &ex );
     if (libvlc_exception_raised(&ex))
     {
         libvlc_exception_clear(&ex);
@@ -582,7 +582,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    libvlc_media_instance_set_position( instance, newPosition, &ex );
+    libvlc_media_player_set_position( instance, newPosition, &ex );
     catch_exception( &ex );
 }
 
@@ -590,7 +590,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    BOOL ret = libvlc_media_instance_is_seekable( instance, &ex );
+    BOOL ret = libvlc_media_player_is_seekable( instance, &ex );
     catch_exception( &ex );
     return ret;
 }
@@ -599,7 +599,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
 {
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
-    BOOL ret = libvlc_media_instance_can_pause( instance, &ex );
+    BOOL ret = libvlc_media_player_can_pause( instance, &ex );
     catch_exception( &ex );
     return ret;
 }
@@ -623,7 +623,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
         // instance
         libvlc_exception_t ex;
         libvlc_exception_init( &ex );
-        instance = (void *)libvlc_media_instance_new([VLCLibrary sharedInstance], &ex);
+        instance = (void *)libvlc_media_player_new([VLCLibrary sharedInstance], &ex);
         catch_exception( &ex );
         
         [self registerObservers];
@@ -639,7 +639,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
     libvlc_exception_init( &ex );
 
     // Attach event observers into the media instance
-    libvlc_event_manager_t * p_em = libvlc_media_instance_event_manager( instance, &ex );
+    libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, &ex );
     libvlc_event_attach( p_em, libvlc_MediaInstancePlayed,          HandleMediaInstanceStateChanged, self, &ex );
     libvlc_event_attach( p_em, libvlc_MediaInstancePaused,          HandleMediaInstanceStateChanged, self, &ex );
     libvlc_event_attach( p_em, libvlc_MediaInstanceReachedEnd,      HandleMediaInstanceStateChanged, self, &ex );
@@ -651,7 +651,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
 
 - (void)unregisterObservers
 {
-    libvlc_event_manager_t * p_em = libvlc_media_instance_event_manager( instance, NULL );
+    libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, NULL );
     libvlc_event_detach( p_em, libvlc_MediaInstancePlayed,          HandleMediaInstanceStateChanged, self, NULL );
     libvlc_event_detach( p_em, libvlc_MediaInstancePaused,          HandleMediaInstanceStateChanged, self, NULL );
     libvlc_event_detach( p_em, libvlc_MediaInstanceReachedEnd,      HandleMediaInstanceStateChanged, self, NULL );