Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
450
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
42348d77
Commit
42348d77
authored
6 years ago
by
Felix Paul Kühne
Browse files
Options
Downloads
Patches
Plain Diff
macosx/playlist controller: implement playback controls
parent
e619a9f9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/gui/macosx/VLCPlaylistController.h
+78
-9
78 additions, 9 deletions
modules/gui/macosx/VLCPlaylistController.h
modules/gui/macosx/VLCPlaylistController.m
+59
-6
59 additions, 6 deletions
modules/gui/macosx/VLCPlaylistController.m
with
137 additions
and
15 deletions
modules/gui/macosx/VLCPlaylistController.h
+
78
−
9
View file @
42348d77
...
...
@@ -30,31 +30,100 @@ NS_ASSUME_NONNULL_BEGIN
@interface
VLCPlaylistController
:
NSObject
/**
* The vlc core playlist controlled by the instance of this class
* @note You DO SOMETHING WRONG if you need to access this!
*/
@property
(
readonly
)
vlc_playlist_t
*
p_playlist
;
/**
* The playlist model caching the contents of the playlist controlled by
* the instance of this class.
*/
@property
(
readonly
)
VLCPlaylistModel
*
playlistModel
;
/**
* The datasource instance used to actually display the playlist.
*/
@property
(
readwrite
,
assign
)
VLCPlaylistDataSource
*
playlistDataSource
;
/**
* Simplified version to add new items at the end of the current playlist
* indicates whether there is a previous item in the list the user could go back to
*/
@property
(
readonly
)
BOOL
hasPreviousPlaylistItem
;
/**
* indicates whether there is a next item in the list the user could move on to
*/
@property
(
readonly
)
BOOL
hasNextPlaylistItem
;
/**
* Simplified version to add new items to the end of the current playlist
* @param array array of items. Each item is a Dictionary with meta info.
*/
-
(
void
)
addPlaylistItems
:(
NSArray
*
)
array
;
/**
* Adds new items to the playlist, at specified parent node and index.
* @param o_array array of items. Each item is a Dictionary with meta info.
* @param i_plItemId parent playlist node id, -1 for default playlist
* @param i_position index for new items, -1 for appending at end
* @param b_start starts playback of first item if true
* Add new items to the playlist, at specified index.
* @param itemArray array of items. Each item is a Dictionary with meta info.
* @param insertionIndex index for new items, -1 for appending at end
* @param startPlayback starts playback of first item if true
*/
-
(
void
)
addPlaylistItems
:(
NSArray
*
)
itemArray
atPosition
:(
size_t
)
insertionIndex
startPlayback
:(
BOOL
)
b_start
;
-
(
void
)
playItemAtIndex
:(
size_t
)
index
;
startPlayback
:(
BOOL
)
startPlayback
;
/**
* Remove the item at the given index (if any)
* @param index the index to remove
*/
-
(
void
)
removeItemAtIndex
:(
size_t
)
index
;
/**
* Clear the entire playlist
*/
-
(
void
)
clearPlaylist
;
/**
* Start the playlist
* @return Returns VLC_SUCCESS on success.
*/
-
(
int
)
startPlaylist
;
/**
* Play the previous item in the list (if any)
* @return Returns VLC_SUCCESS on success.
*/
-
(
int
)
playPreviousItem
;
/**
* Play the item at the given index (if any)
* @param index the index to play
* @return Returns VLC_SUCCESS on success.
*/
-
(
int
)
playItemAtIndex
:(
size_t
)
index
;
/**
* Play the previous item in the list (if any)
* @return Returns VLC_SUCCESS on success.
*/
-
(
int
)
playNextItem
;
/**
* Stop playback of the playlist and destroy all facilities
*/
-
(
void
)
stopPlayback
;
/**
* Pause playback of the playlist while keeping all facilities
*/
-
(
void
)
pausePlayback
;
/**
* Resume playback of the playlist if it was paused
*/
-
(
void
)
resumePlayback
;
@end
NS_ASSUME_NONNULL_END
This diff is collapsed.
Click to expand it.
modules/gui/macosx/VLCPlaylistController.m
+
59
−
6
View file @
42348d77
...
...
@@ -250,20 +250,73 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
}
}
-
(
void
)
play
ItemAtIndex
:(
size_t
)
index
-
(
void
)
remove
ItemAtIndex
:(
size_t
)
index
{
/* note: we don't remove the cached data from the model here
* because this will be done asynchronously through the callback */
vlc_playlist_Lock
(
_p_playlist
);
vlc_playlist_
PlayAt
(
_p_playlist
,
index
);
vlc_playlist_
Remove
(
_p_playlist
,
index
,
1
);
vlc_playlist_Unlock
(
_p_playlist
);
}
-
(
void
)
removeItemAtIndex
:(
size_t
)
index
-
(
void
)
clearPlaylist
{
/* note: we don't remove the cached data from the model here
* because this will be done asynchronously through the callback */
vlc_playlist_Lock
(
_p_playlist
);
vlc_playlist_Clear
(
_p_playlist
);
vlc_playlist_Unlock
(
_p_playlist
);
}
-
(
int
)
startPlaylist
{
vlc_playlist_Lock
(
_p_playlist
);
vlc_playlist_Remove
(
_p_playlist
,
index
,
1
);
int
ret
=
vlc_playlist_Start
(
_p_playlist
);
vlc_playlist_Unlock
(
_p_playlist
);
return
ret
;
}
-
(
int
)
playPreviousItem
{
vlc_playlist_Lock
(
_p_playlist
);
int
ret
=
vlc_playlist_Prev
(
_p_playlist
);
vlc_playlist_Unlock
(
_p_playlist
);
return
ret
;
}
-
(
int
)
playItemAtIndex
:(
size_t
)
index
{
vlc_playlist_Lock
(
_p_playlist
);
int
ret
=
vlc_playlist_PlayAt
(
_p_playlist
,
index
);
vlc_playlist_Unlock
(
_p_playlist
);
return
ret
;
}
-
(
int
)
playNextItem
{
vlc_playlist_Lock
(
_p_playlist
);
int
ret
=
vlc_playlist_Next
(
_p_playlist
);
vlc_playlist_Unlock
(
_p_playlist
);
return
ret
;
}
-
(
void
)
stopPlayback
{
vlc_playlist_Lock
(
_p_playlist
);
vlc_playlist_Stop
(
_p_playlist
);
vlc_playlist_Unlock
(
_p_playlist
);
}
-
(
void
)
pausePlayback
{
vlc_playlist_Lock
(
_p_playlist
);
vlc_playlist_Pause
(
_p_playlist
);
vlc_playlist_Unlock
(
_p_playlist
);
}
-
(
void
)
resumePlayback
{
vlc_playlist_Lock
(
_p_playlist
);
vlc_playlist_Resume
(
_p_playlist
);
vlc_playlist_Unlock
(
_p_playlist
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment