diff --git a/modules/gui/macosx/VLCPlaylistController.h b/modules/gui/macosx/VLCPlaylistController.h index 3cda3a77b7d038aa988b9b8dc88efc948690b09c..13924daf8fada47b0c7ca9526213d9b6429a2ac2 100644 --- a/modules/gui/macosx/VLCPlaylistController.h +++ b/modules/gui/macosx/VLCPlaylistController.h @@ -73,13 +73,13 @@ extern NSString *VLCPlaybackHasNextChanged; * sets and gets the playback repeat mode according to the enum defined in the core * @note Subscribe to the VLCPlaybackRepeatChanged notification to be notified about changes */ -@property (readwrite) enum vlc_playlist_playback_repeat playbackRepeat; +@property (readwrite, nonatomic) enum vlc_playlist_playback_repeat playbackRepeat; /** * sets and gets the playback order according to the enum defined in the core * @note Subscribe to the VLCPlaybackOrderChanged notification to be notified about changes */ -@property (readwrite) enum vlc_playlist_playback_order playbackOrder; +@property (readwrite, nonatomic) enum vlc_playlist_playback_order playbackOrder; /** * Simplified version to add new items to the end of the current playlist diff --git a/modules/gui/macosx/VLCPlaylistController.m b/modules/gui/macosx/VLCPlaylistController.m index 525cc09bfd1b4170d83a76bb8ae66b5181f2bfe4..6f13637b19ae697f69507c48cdde304192863b7f 100644 --- a/modules/gui/macosx/VLCPlaylistController.m +++ b/modules/gui/macosx/VLCPlaylistController.m @@ -66,7 +66,7 @@ cb_playlist_items_reset(vlc_playlist_t *playlist, } dispatch_async(dispatch_get_main_queue(), ^{ VLCPlaylistController *playlistController = (__bridge VLCPlaylistController *)p_data; - [playlistController playlistResetWithItems:items count:numberOfItems]; + [playlistController playlistResetWithItems:array count:numberOfItems]; }); } @@ -185,11 +185,17 @@ static const struct vlc_playlist_callbacks playlist_callbacks = { self = [super init]; if (self) { intf_thread_t *p_intf = getIntf(); - _p_playlist = vlc_intf_GetMainPlaylist( p_intf ); + _p_playlist = vlc_intf_GetMainPlaylist(p_intf); + + /* set initial values, further updates through callbacks */ + vlc_playlist_Lock(_p_playlist); + _playbackOrder = vlc_playlist_GetPlaybackOrder(_p_playlist); + _playbackRepeat = vlc_playlist_GetPlaybackRepeat(_p_playlist); _playlistListenerID = vlc_playlist_AddListener(_p_playlist, &playlist_callbacks, (__bridge void *)self, YES); + vlc_playlist_Unlock(_p_playlist); _playlistModel = [[VLCPlaylistModel alloc] init]; _playlistModel.playlistController = self; } @@ -408,6 +414,20 @@ static const struct vlc_playlist_callbacks playlist_callbacks = { vlc_playlist_Unlock(_p_playlist); } +- (void)setPlaybackOrder:(enum vlc_playlist_playback_order)playbackOrder +{ + vlc_playlist_Lock(_p_playlist); + vlc_playlist_SetPlaybackOrder(_p_playlist, playbackOrder); + vlc_playlist_Unlock(_p_playlist); +} + +- (void)setPlaybackRepeat:(enum vlc_playlist_playback_repeat)playbackRepeat +{ + vlc_playlist_Lock(_p_playlist); + vlc_playlist_SetPlaybackRepeat(_p_playlist, playbackRepeat); + vlc_playlist_Unlock(_p_playlist); +} + #pragma mark - helper methods - (input_item_t *)createInputItemBasedOnMetadata:(NSDictionary *)itemToCreateDict