Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
ecddc9b7
Commit
ecddc9b7
authored
Aug 08, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "playlist: refactor and fix #3932"
This reverts commit
2a4a8f9a
.
parent
8a497301
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
79 deletions
+28
-79
src/playlist/item.c
src/playlist/item.c
+27
-78
src/playlist/playlist_internal.h
src/playlist/playlist_internal.h
+1
-1
No files found.
src/playlist/item.c
View file @
ecddc9b7
...
...
@@ -28,7 +28,6 @@
#include <vlc_common.h>
#include <assert.h>
#include <vlc_playlist.h>
#include <vlc_rand.h>
#include "playlist_internal.h"
static
void
AddItem
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
,
...
...
@@ -62,110 +61,60 @@ static void input_item_add_subitem_tree ( const vlc_event_t * p_event,
playlist_ItemGetByInput
(
p_playlist
,
p_input
);
assert
(
p_item
!=
NULL
);
playlist_item_t
*
p_parent
=
p_item
->
p_parent
;
assert
(
p_parent
!=
NULL
);
bool
b_current
=
get_current_status_item
(
p_playlist
)
==
p_item
;
bool
b_autostart
=
var_CreateGetBool
(
p_playlist
,
"playlist-autostart"
);
bool
b_stop
=
p_item
->
i_flags
&
PLAYLIST_SUBITEM_STOP_FLAG
;
bool
b_flat
=
false
;
p_item
->
i_flags
&=
~
PLAYLIST_SUBITEM_STOP_FLAG
;
/* We will have to flatten the tree out if we are in "the playlist" node and
the user setting demands flat playlist */
if
(
!
pl_priv
(
p_playlist
)
->
b_tree
)
{
playlist_item_t
*
p_up
=
p_item
;
while
(
p_up
->
p_parent
)
int
pos
=
0
;
for
(
int
i
=
0
;
i
<
p_parent
->
i_children
;
i
++
)
{
if
(
p_parent
->
pp_children
[
i
]
==
p_item
)
{
if
(
p_up
->
p_parent
==
p_playlist
->
p_playing
)
{
b_flat
=
true
;
break
;
}
p_up
=
p_up
->
p_parent
;
pos
=
i
;
break
;
}
}
int
pos
=
0
;
/* If we have to flatten out, then take the item's position in the parent as
insertion point and delete the item */
if
(
b_flat
)
bool
b_flat
=
false
;
playlist_item_t
*
p_up
=
p_item
;
while
(
p_up
->
p_parent
)
{
playlist_item_t
*
p_parent
=
p_item
->
p_parent
;
assert
(
p_parent
!=
NULL
);
int
i
;
for
(
i
=
0
;
i
<
p_parent
->
i_children
;
i
++
)
if
(
p_up
->
p_parent
==
p_playlist
->
p_playing
)
{
if
(
p_parent
->
pp_children
[
i
]
==
p_item
)
{
pos
=
i
;
break
;
}
if
(
!
pl_priv
(
p_playlist
)
->
b_tree
)
b_flat
=
true
;
break
;
}
assert
(
i
<
p_parent
->
i_children
);
playlist_DeleteItem
(
p_playlist
,
p_item
,
true
);
p_item
=
p_parent
;
}
else
{
pos
=
p_item
->
i_children
>=
0
?
p_item
->
i_children
:
0
;
p_up
=
p_up
->
p_parent
;
}
/* At this point:
"p_item" is the node where sub-items should be inserted,
"pos" is the insertion position in that node */
if
(
b_flat
)
playlist_DeleteItem
(
p_playlist
,
p_item
,
true
);
int
last_pos
=
playlist_InsertInputItemTree
(
p_playlist
,
p_item
,
p_new_root
,
pos
,
b_flat
);
p_item
=
playlist_InsertInputItemTree
(
p_playlist
,
b_flat
?
p_parent
:
p_item
,
p_new_root
,
b_flat
?
pos
:
PLAYLIST_END
,
b_flat
);
if
(
!
b_flat
)
var_SetAddress
(
p_playlist
,
"leaf-to-parent"
,
p_input
);
//control playback only if it was the current playing item that got subitems
if
(
b_current
)
{
if
(
last_pos
==
pos
||
(
b_stop
&&
!
b_flat
)
||
!
b_autostart
)
if
(
!
p_item
||
(
b_stop
&&
!
b_flat
)
||
!
b_autostart
)
{
/* We stop, either because no sub-item was actually created, or some
flags/settings want us to do so at this point */
PL_UNLOCK
;
playlist_Stop
(
p_playlist
);
return
;
}
else
{
/* Continue to play, either random or the first new item */
playlist_item_t
*
p_play_item
;
if
(
var_GetBool
(
p_playlist
,
"random"
)
)
{
unsigned
rand_pos
=
((
unsigned
)
vlc_mrand48
())
%
(
last_pos
-
pos
);
rand_pos
+=
pos
;
p_play_item
=
p_item
->
pp_children
[
rand_pos
];
}
else
{
p_play_item
=
playlist_GetNextLeaf
(
p_playlist
,
p_item
,
NULL
,
true
,
false
);
char
*
psz_name
=
input_item_GetName
(
p_play_item
->
p_input
);
free
(
psz_name
);
}
playlist_Control
(
p_playlist
,
PLAYLIST_VIEWPLAY
,
pl_Locked
,
get_current_status_node
(
p_playlist
),
p_play_item
);
pl_Locked
,
get_current_status_node
(
p_playlist
),
p_item
);
}
}
...
...
@@ -559,13 +508,13 @@ int playlist_NodeAddCopy (
* \param b_flat TRUE if the new tree contents should be flattened into a list
* \return the first new leaf inserted (in playing order)
*/
int
playlist_InsertInputItemTree
(
playlist_item_t
*
playlist_InsertInputItemTree
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_parent
,
input_item_node_t
*
p_node
,
int
i_pos
,
bool
b_flat
)
{
playlist_item_t
*
p_first_leaf
=
NULL
;
int
i
=
RecursiveAddIntoParent
(
p_playlist
,
p_parent
,
p_node
,
i_pos
,
b_flat
,
&
p_first_leaf
);
return
i
;
RecursiveAddIntoParent
(
p_playlist
,
p_parent
,
p_node
,
i_pos
,
b_flat
,
&
p_first_leaf
);
return
p_first_leaf
;
}
...
...
src/playlist/playlist_internal.h
View file @
ecddc9b7
...
...
@@ -132,7 +132,7 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
playlist_item_t
*
playlist_NodeAddInput
(
playlist_t
*
,
input_item_t
*
,
playlist_item_t
*
,
int
,
int
,
bool
);
int
playlist_InsertInputItemTree
(
playlist_t
*
,
playlist_item_t
*
playlist_InsertInputItemTree
(
playlist_t
*
,
playlist_item_t
*
,
input_item_node_t
*
,
int
,
bool
);
/* Tree walking */
...
...
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