vlc | branch: master | Felix Paul Kühne <[email protected]> | Sun Mar 10 19:23:15 2019 +0100| [8fc2c5b4c43fc8eb610faa346ca27ff958586540] | committer: Felix Paul Kühne
macosx/playlist controller: post notification when current item changes > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8fc2c5b4c43fc8eb610faa346ca27ff958586540 --- modules/gui/macosx/menus/VLCMainMenu.m | 3 --- modules/gui/macosx/playlist/VLCPlaylistController.h | 3 +++ modules/gui/macosx/playlist/VLCPlaylistController.m | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m index 9d2a1a613f..a92e4770eb 100644 --- a/modules/gui/macosx/menus/VLCMainMenu.m +++ b/modules/gui/macosx/menus/VLCMainMenu.m @@ -1578,9 +1578,6 @@ { BOOL enabled = YES; input_item_t *inputItem = _playlistController.currentlyPlayingInputItem; - if (inputItem) { - input_item_Hold(inputItem); - } if (mi == _stop || mi == _voutMenustop || mi == _dockMenustop) { if (!inputItem) diff --git a/modules/gui/macosx/playlist/VLCPlaylistController.h b/modules/gui/macosx/playlist/VLCPlaylistController.h index 37ccfcb541..3b878ddec6 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistController.h +++ b/modules/gui/macosx/playlist/VLCPlaylistController.h @@ -33,6 +33,7 @@ extern NSString *VLCPlaybackOrderChanged; extern NSString *VLCPlaybackRepeatChanged; extern NSString *VLCPlaybackHasPreviousChanged; extern NSString *VLCPlaybackHasNextChanged; +extern NSString *VLCPlaylistCurrentItemChanged; @interface VLCPlaylistController : NSObject @@ -71,6 +72,8 @@ extern NSString *VLCPlaybackHasNextChanged; /** * input of the currently playing item @return returns the input item for the currently playing playlist item + @note the receiver is responsible for releasing the input item + @note Subscribe to the VLCPlaylistCurrentItemChanged notification to be notified about changes */ @property (readonly, nullable) input_item_t *currentlyPlayingInputItem; diff --git a/modules/gui/macosx/playlist/VLCPlaylistController.m b/modules/gui/macosx/playlist/VLCPlaylistController.m index 503a93c369..faa2f323af 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistController.m +++ b/modules/gui/macosx/playlist/VLCPlaylistController.m @@ -36,6 +36,7 @@ NSString *VLCPlaybackOrderChanged = @"VLCPlaybackOrderChanged"; NSString *VLCPlaybackRepeatChanged = @"VLCPlaybackRepeatChanged"; NSString *VLCPlaybackHasPreviousChanged = @"VLCPlaybackHasPreviousChanged"; NSString *VLCPlaybackHasNextChanged = @"VLCPlaybackHasNextChanged"; +NSString *VLCPlaylistCurrentItemChanged = @"VLCPlaylistCurrentItemChanged"; @interface VLCPlaylistController () { @@ -277,6 +278,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = { { _currentPlaylistIndex = index; [_playlistDataSource playlistUpdated]; + [[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaylistCurrentItemChanged object:nil]; } - (void)playlistHasPreviousItem:(BOOL)hasPrevious @@ -449,6 +451,9 @@ static const struct vlc_playlist_callbacks playlist_callbacks = { vlc_player_t *player = vlc_playlist_GetPlayer(_p_playlist); vlc_player_Lock(player); input_item_t *inputItem = vlc_player_GetCurrentMedia(player); + if (inputItem) { + input_item_Hold(inputItem); + } vlc_player_Unlock(player); return inputItem; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
