Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
678c0546
Commit
678c0546
authored
Nov 22, 2004
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Recursive sort
parent
7f7a8e2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
9 deletions
+38
-9
include/vlc_playlist.h
include/vlc_playlist.h
+1
-0
modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/playlist.cpp
+5
-2
src/playlist/sort.c
src/playlist/sort.c
+32
-7
No files found.
include/vlc_playlist.h
View file @
678c0546
...
@@ -333,6 +333,7 @@ VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int, int) );
...
@@ -333,6 +333,7 @@ VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int, int) );
VLC_EXPORT
(
int
,
playlist_Move
,
(
playlist_t
*
,
int
,
int
)
);
VLC_EXPORT
(
int
,
playlist_Move
,
(
playlist_t
*
,
int
,
int
)
);
VLC_EXPORT
(
int
,
playlist_NodeGroup
,
(
playlist_t
*
,
int
,
playlist_item_t
*
,
playlist_item_t
**
,
int
,
int
,
int
)
);
VLC_EXPORT
(
int
,
playlist_NodeGroup
,
(
playlist_t
*
,
int
,
playlist_item_t
*
,
playlist_item_t
**
,
int
,
int
,
int
)
);
VLC_EXPORT
(
int
,
playlist_NodeSort
,
(
playlist_t
*
,
playlist_item_t
*
,
int
,
int
)
);
VLC_EXPORT
(
int
,
playlist_NodeSort
,
(
playlist_t
*
,
playlist_item_t
*
,
int
,
int
)
);
VLC_EXPORT
(
int
,
playlist_RecursiveNodeSort
,
(
playlist_t
*
,
playlist_item_t
*
,
int
,
int
)
);
/* Load/Save */
/* Load/Save */
VLC_EXPORT
(
int
,
playlist_Import
,
(
playlist_t
*
,
const
char
*
)
);
VLC_EXPORT
(
int
,
playlist_Import
,
(
playlist_t
*
,
const
char
*
)
);
...
...
modules/gui/wxwindows/playlist.cpp
View file @
678c0546
...
@@ -1503,8 +1503,11 @@ void Playlist::OnPopupSort( wxMenuEvent& event )
...
@@ -1503,8 +1503,11 @@ void Playlist::OnPopupSort( wxMenuEvent& event )
if
(
p_playlist
)
if
(
p_playlist
)
{
{
playlist_NodeSort
(
p_playlist
,
p_wxitem
->
p_item
,
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
SORT_TITLE_NODES_FIRST
,
ORDER_NORMAL
);
playlist_RecursiveNodeSort
(
p_playlist
,
p_wxitem
->
p_item
,
SORT_TITLE_NODES_FIRST
,
ORDER_NORMAL
);
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
b_need_update
=
VLC_TRUE
;
vlc_object_release
(
p_playlist
);
vlc_object_release
(
p_playlist
);
}
}
}
}
...
...
src/playlist/sort.c
View file @
678c0546
...
@@ -81,6 +81,9 @@ int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type )
...
@@ -81,6 +81,9 @@ int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type )
/**
/**
* Sort a node.
* Sort a node.
*
* This function must be entered with the playlist lock !
*
* \param p_playlist the playlist
* \param p_playlist the playlist
* \param p_node the node to sort
* \param p_node the node to sort
* \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_RANDOM
* \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_RANDOM
...
@@ -90,22 +93,44 @@ int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type )
...
@@ -90,22 +93,44 @@ int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type )
int
playlist_NodeSort
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_node
,
int
playlist_NodeSort
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_node
,
int
i_mode
,
int
i_type
)
int
i_mode
,
int
i_type
)
{
{
vlc_value_t
val
;
val
.
b_bool
=
VLC_TRUE
;
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
playlist_ItemArraySort
(
p_playlist
,
p_node
->
i_children
,
playlist_ItemArraySort
(
p_playlist
,
p_node
->
i_children
,
p_node
->
pp_children
,
i_mode
,
i_type
);
p_node
->
pp_children
,
i_mode
,
i_type
);
p_node
->
i_serial
++
;
p_node
->
i_serial
++
;
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
return
VLC_SUCCESS
;
}
/* Notify the interfaces */
/**
var_Set
(
p_playlist
,
"intf-change"
,
val
);
*
* Sort a node recursively.
*
* This function must be entered with the playlist lock !
*
* \param p_playlist the playlist
* \param p_node the node to sort
* \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_RANDOM
* \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order)
* \return VLC_SUCCESS on success
*/
int
playlist_RecursiveNodeSort
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_node
,
int
i_mode
,
int
i_type
)
{
int
i
;
playlist_NodeSort
(
p_playlist
,
p_node
,
i_mode
,
i_type
);
for
(
i
=
0
;
i
<
p_node
->
i_children
;
i
++
)
{
if
(
p_node
->
pp_children
[
i
]
->
i_children
!=
-
1
)
{
playlist_RecursiveNodeSort
(
p_playlist
,
p_node
->
pp_children
[
i
],
i_mode
,
i_type
);
}
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment