[vlc-commits] macosx/player: add notification when a media's metadata changes
    Felix Paul Kühne 
    git at videolan.org
       
    Sat Apr 13 22:09:57 CEST 2019
    
    
  
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Apr 13 20:02:26 2019 +0200| [fcafd5031e178cae8b4f807a4dbdd883beaf448e] | committer: Felix Paul Kühne
macosx/player: add notification when a media's metadata changes
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fcafd5031e178cae8b4f807a4dbdd883beaf448e
---
 modules/gui/macosx/playlist/VLCPlayerController.h | 7 +++++++
 modules/gui/macosx/playlist/VLCPlayerController.m | 4 ++++
 2 files changed, 11 insertions(+)
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.h b/modules/gui/macosx/playlist/VLCPlayerController.h
index 27d0d47ed7..c0fc152547 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.h
+++ b/modules/gui/macosx/playlist/VLCPlayerController.h
@@ -36,6 +36,13 @@ NS_ASSUME_NONNULL_BEGIN
 extern NSString *VLCPlayerCurrentMediaItemChanged;
 
 /**
+ * Listen to VLCPlayerMetadataChangedForCurrentMedia to be notified if metadata such as title, artwork, etc change
+ * for the media item currently played
+ * @note the affected player object will be the object of the notification
+ */
+extern NSString *VLCPlayerMetadataChangedForCurrentMedia;
+
+/**
  * Listen to VLCPlayerStateChanged to be notified if the player's state changes
  * @note the affected player object will be the object of the notification
  */
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m
index 661c69c959..22e44f492b 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.m
+++ b/modules/gui/macosx/playlist/VLCPlayerController.m
@@ -33,6 +33,7 @@
 #import <MediaPlayer/MediaPlayer.h>
 
 NSString *VLCPlayerCurrentMediaItemChanged = @"VLCPlayerCurrentMediaItemChanged";
+NSString *VLCPlayerMetadataChangedForCurrentMedia = @"VLCPlayerMetadataChangedForCurrentMedia";
 NSString *VLCPlayerStateChanged = @"VLCPlayerStateChanged";
 NSString *VLCPlayerErrorChanged = @"VLCPlayerErrorChanged";
 NSString *VLCPlayerBufferFill = @"VLCPlayerBufferFill";
@@ -668,6 +669,9 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = {
     }
 
     input_item_Release(inputItem);
+
+    [_defaultNotificationCenter postNotificationName:VLCPlayerMetadataChangedForCurrentMedia
+                                              object:self];
 }
 
 - (void)nextVideoFrame
    
    
More information about the vlc-commits
mailing list