Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
2f24e13c
Commit
2f24e13c
authored
Jun 12, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core playlist: refactor & fix #3737
parent
8030d220
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
31 deletions
+42
-31
src/playlist/item.c
src/playlist/item.c
+42
-31
No files found.
src/playlist/item.c
View file @
2f24e13c
...
@@ -90,21 +90,22 @@ static void input_item_add_subitem_tree ( const vlc_event_t * p_event,
...
@@ -90,21 +90,22 @@ static void input_item_add_subitem_tree ( const vlc_event_t * p_event,
}
}
p_up
=
p_up
->
p_parent
;
p_up
=
p_up
->
p_parent
;
}
}
if
(
b_flat
)
if
(
b_flat
)
{
playlist_DeleteItem
(
p_playlist
,
p_item
,
true
);
playlist_DeleteItem
(
p_playlist
,
p_item
,
true
);
p_item
=
playlist_InsertInputItemTree
(
p_playlist
,
p_parent
,
p_new_root
,
pos
,
true
);
p_item
=
playlist_InsertInputItemTree
(
p_playlist
,
}
b_flat
?
p_parent
:
p_item
,
else
p_new_root
,
p_item
=
playlist_InsertInputItemTree
(
p_playlist
,
p_item
,
b_flat
?
pos
:
PLAYLIST_END
,
p_new_root
,
PLAYLIST_END
,
false
);
b_flat
);
if
(
!
b_flat
)
var_SetAddress
(
p_playlist
,
"leaf-to-parent"
,
p_input
);
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
(
b_current
)
{
{
if
(
(
b_stop
&&
!
b_flat
)
||
!
b_autostart
)
if
(
!
p_item
||
(
b_stop
&&
!
b_flat
)
||
!
b_autostart
)
{
{
PL_UNLOCK
;
PL_UNLOCK
;
playlist_Stop
(
p_playlist
);
playlist_Stop
(
p_playlist
);
...
@@ -796,40 +797,50 @@ static int RecursiveAddIntoParent (
...
@@ -796,40 +797,50 @@ static int RecursiveAddIntoParent (
input_item_node_t
*
p_node
,
int
i_pos
,
bool
b_flat
,
input_item_node_t
*
p_node
,
int
i_pos
,
bool
b_flat
,
playlist_item_t
**
pp_first_leaf
)
playlist_item_t
**
pp_first_leaf
)
{
{
*
pp_first_leaf
=
NULL
;
if
(
p_parent
->
i_children
==
-
1
)
ChangeToNode
(
p_playlist
,
p_parent
);
if
(
p_parent
->
i_children
==
-
1
)
ChangeToNode
(
p_playlist
,
p_parent
);
if
(
i_pos
==
PLAYLIST_END
)
i_pos
=
p_parent
->
i_children
;
if
(
i_pos
==
PLAYLIST_END
)
i_pos
=
p_parent
->
i_children
;
for
(
int
i
=
0
;
i
<
p_node
->
i_children
;
i
++
)
for
(
int
i
=
0
;
i
<
p_node
->
i_children
;
i
++
)
{
{
playlist_item_t
*
p_child
=
NULL
;
input_item_node_t
*
p_child_node
=
p_node
->
pp_children
[
i
];
if
(
b_flat
?
p_node
->
pp_children
[
i
]
->
i_children
==
0
:
1
)
playlist_item_t
*
p_new_item
=
NULL
;
bool
b_children
=
p_child_node
->
i_children
>
0
;
//Create the playlist item represented by input node, if allowed.
if
(
!
(
b_flat
&&
b_children
)
)
{
{
p_child
=
playlist_NodeAddInput
(
p_playlist
,
p_new_item
=
playlist_NodeAddInput
(
p_playlist
,
p_node
->
pp_children
[
i
]
->
p_item
,
p_child_node
->
p_item
,
p_parent
,
p_parent
,
PLAYLIST_INSERT
,
i_pos
,
PLAYLIST_INSERT
,
i_pos
,
pl_Locked
);
pl_Locked
);
if
(
!
p_new_item
)
return
i_pos
;
i_pos
++
;
i_pos
++
;
//Swap parent for new item, if we will recurse
if
(
b_children
)
p_parent
=
p_new_item
;
}
}
if
(
p_node
->
pp_children
[
i
]
->
i_children
>
0
)
//Recurse if any children
if
(
b_children
)
{
{
if
(
b_flat
)
//Substitute p_new_item for first child leaf
{
//(If flat, continue counting from current position)
i_pos
=
RecursiveAddIntoParent
(
int
i_last_pos
=
RecursiveAddIntoParent
(
p_playlist
,
p_parent
,
p_playlist
,
p_parent
,
p_child_node
,
p_node
->
pp_children
[
i
],
i_pos
,
true
,
(
b_flat
?
i_pos
:
0
),
&
p_child
);
b_flat
,
}
&
p_new_item
);
else
//If flat, take position after recursion as current position
{
if
(
b_flat
)
i_pos
=
i_last_pos
;
RecursiveAddIntoParent
(
p_playlist
,
p_child
,
p_node
->
pp_children
[
i
],
0
,
false
,
&
p_child
);
}
}
}
assert
(
p_child
!=
NULL
);
if
(
i
==
0
)
*
pp_first_leaf
=
p_child
;
assert
(
p_new_item
!=
NULL
);
if
(
i
==
0
)
*
pp_first_leaf
=
p_new_item
;
}
}
return
i_pos
;
return
i_pos
;
}
}
...
...
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