1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-18 23:45:06 +02:00

macosx/playlist controller: post notification when current item changes

This commit is contained in:
Felix Paul Kühne 2019-03-10 19:23:15 +01:00
parent 2d86e202c4
commit 8fc2c5b4c4
3 changed files with 8 additions and 3 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;
}