[vlc-commits] macosx: add setters for play order and repeat
Felix Paul Kühne
git at videolan.org
Fri Feb 1 15:54:17 CET 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Fri Feb 1 15:53:54 2019 +0100| [d01c27c986a7b80e8b0877bbb4d5f8fdbc9d4f7a] | committer: Felix Paul Kühne
macosx: add setters for play order and repeat
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d01c27c986a7b80e8b0877bbb4d5f8fdbc9d4f7a
---
modules/gui/macosx/VLCPlaylistController.h | 4 ++--
modules/gui/macosx/VLCPlaylistController.m | 24 ++++++++++++++++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/modules/gui/macosx/VLCPlaylistController.h b/modules/gui/macosx/VLCPlaylistController.h
index 3cda3a77b7..13924daf8f 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
*/
- at property (readwrite) enum vlc_playlist_playback_repeat playbackRepeat;
+ at 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
*/
- at property (readwrite) enum vlc_playlist_playback_order playbackOrder;
+ at 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 525cc09bfd..6f13637b19 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
More information about the vlc-commits
mailing list