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
f2b9c723
Commit
f2b9c723
authored
Nov 26, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: create the playlist when needed (refs #5460)
parent
d629c7df
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
44 deletions
+25
-44
src/libvlc.c
src/libvlc.c
+9
-15
src/libvlc.h
src/libvlc.h
+0
-2
src/playlist/engine.c
src/playlist/engine.c
+14
-8
src/playlist/playlist_internal.h
src/playlist/playlist_internal.h
+0
-3
src/playlist/thread.c
src/playlist/thread.c
+2
-16
No files found.
src/libvlc.c
View file @
f2b9c723
...
...
@@ -145,7 +145,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
char
*
psz_modules
=
NULL
;
char
*
psz_parser
=
NULL
;
char
*
psz_control
=
NULL
;
playlist_t
*
p_playlist
=
NULL
;
char
*
psz_val
;
/* System specific initialization code */
...
...
@@ -433,15 +432,6 @@ dbus_out:
var_Create
(
p_libvlc
,
"user-agent"
,
VLC_VAR_STRING
);
var_SetString
(
p_libvlc
,
"user-agent"
,
"(LibVLC "
VERSION
")"
);
/* Initialize playlist and get commandline files */
p_playlist
=
playlist_Create
(
VLC_OBJECT
(
p_libvlc
)
);
if
(
!
p_playlist
)
{
msg_Err
(
p_libvlc
,
"playlist initialization failed"
);
module_EndBank
(
true
);
return
VLC_EGENERIC
;
}
/* System specific configuration */
system_Configure
(
p_libvlc
,
i_argc
-
vlc_optind
,
ppsz_argv
+
vlc_optind
);
...
...
@@ -468,7 +458,7 @@ dbus_out:
{
char
*
p
=
psz_modules
,
*
m
;
while
(
(
m
=
strsep
(
&
p
,
" :,"
)
)
!=
NULL
)
playlist_ServicesDiscoveryAdd
(
p
_playlist
,
m
);
playlist_ServicesDiscoveryAdd
(
p
l_Get
(
p_libvlc
)
,
m
);
free
(
psz_modules
);
}
...
...
@@ -582,7 +572,7 @@ dbus_out:
psz_val
=
var_InheritString
(
p_libvlc
,
"open"
);
if
(
psz_val
!=
NULL
)
{
playlist_AddExt
(
p
_playlist
,
psz_val
,
NULL
,
PLAYLIST_INSERT
,
0
,
playlist_AddExt
(
p
l_Get
(
p_libvlc
)
,
psz_val
,
NULL
,
PLAYLIST_INSERT
,
0
,
-
1
,
0
,
NULL
,
0
,
true
,
pl_Unlocked
);
free
(
psz_val
);
}
...
...
@@ -600,8 +590,11 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
playlist_t
*
p_playlist
=
libvlc_priv
(
p_libvlc
)
->
p_playlist
;
/* Remove all services discovery */
msg_Dbg
(
p_libvlc
,
"removing all services discovery tasks"
);
playlist_ServicesDiscoveryKillAll
(
p_playlist
);
if
(
p_playlist
!=
NULL
)
{
msg_Dbg
(
p_libvlc
,
"removing all services discovery tasks"
);
playlist_ServicesDiscoveryKillAll
(
p_playlist
);
}
/* Ask the interfaces to stop and destroy them */
msg_Dbg
(
p_libvlc
,
"removing all interfaces"
);
...
...
@@ -627,7 +620,8 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
#endif
/* Free playlist now, all threads are gone */
playlist_Destroy
(
p_playlist
);
if
(
p_playlist
!=
NULL
)
playlist_Destroy
(
p_playlist
);
msg_Dbg
(
p_libvlc
,
"removing stats"
);
...
...
src/libvlc.h
View file @
f2b9c723
...
...
@@ -141,8 +141,6 @@ typedef struct libvlc_priv_t
{
libvlc_int_t
public_data
;
bool
playlist_active
;
/* Messages */
signed
char
i_verbose
;
///< info messages
bool
b_color
;
///< color messages?
...
...
src/playlist/engine.c
View file @
f2b9c723
...
...
@@ -195,7 +195,7 @@ static int VideoSplitterCallback( vlc_object_t *p_this, char const *psz_cmd,
* \param p_parent the vlc object that is to be the parent of this playlist
* \return a pointer to the created playlist, or NULL on error
*/
playlist_t
*
playlist_Create
(
vlc_object_t
*
p_parent
)
static
playlist_t
*
playlist_Create
(
vlc_object_t
*
p_parent
)
{
playlist_t
*
p_playlist
;
playlist_private_t
*
p
;
...
...
@@ -209,8 +209,6 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
p_playlist
=
&
p
->
public_data
;
TAB_INIT
(
pl_priv
(
p_playlist
)
->
i_sds
,
pl_priv
(
p_playlist
)
->
pp_sds
);
libvlc_priv
(
p_parent
->
p_libvlc
)
->
p_playlist
=
p_playlist
;
VariablesInit
(
p_playlist
);
vlc_mutex_init
(
&
p
->
lock
);
vlc_cond_init
(
&
p
->
signal
);
...
...
@@ -298,6 +296,14 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
pl_priv
(
p_playlist
)
->
b_auto_preparse
=
b_auto_preparse
;
}
/* Input resources */
p
->
p_input_resource
=
input_resource_New
(
VLC_OBJECT
(
p_playlist
)
);
if
(
unlikely
(
p
->
p_input_resource
==
NULL
)
)
abort
();
/* Thread */
playlist_Activate
(
p_playlist
);
return
p_playlist
;
}
...
...
@@ -366,12 +372,12 @@ playlist_t *pl_Get (vlc_object_t *obj)
vlc_mutex_lock
(
&
lock
);
pl
=
libvlc_priv
(
p_libvlc
)
->
p_playlist
;
assert
(
pl
!=
NULL
);
if
(
!
libvlc_priv
(
p_libvlc
)
->
playlist_active
)
if
(
unlikely
(
pl
==
NULL
))
{
playlist_Activate
(
pl
);
libvlc_priv
(
p_libvlc
)
->
playlist_active
=
true
;
pl
=
playlist_Create
(
VLC_OBJECT
(
p_libvlc
));
if
(
unlikely
(
pl
==
NULL
))
abort
();
libvlc_priv
(
p_libvlc
)
->
p_playlist
=
pl
;
}
vlc_mutex_unlock
(
&
lock
);
return
pl
;
...
...
src/playlist/playlist_internal.h
View file @
f2b9c723
...
...
@@ -99,10 +99,7 @@ typedef struct playlist_private_t
*****************************************************************************/
/* Creation/Deletion */
playlist_t
*
playlist_Create
(
vlc_object_t
*
);
void
playlist_Destroy
(
playlist_t
*
);
/* */
void
playlist_Activate
(
playlist_t
*
);
/* */
...
...
src/playlist/thread.c
View file @
f2b9c723
...
...
@@ -46,29 +46,18 @@ static void *Thread ( void * );
*****************************************************************************/
/**
* Create the main playlist threads.
* Additionally to the playlist, this thread controls :
* - Statistics
* - VLM
* \param p_parent
* \return an object with a started thread
* Creates the main playlist thread.
*/
void
playlist_Activate
(
playlist_t
*
p_playlist
)
{
/* */
playlist_private_t
*
p_sys
=
pl_priv
(
p_playlist
);
p_sys
->
p_input_resource
=
input_resource_New
(
VLC_OBJECT
(
p_playlist
)
);
if
(
unlikely
(
p_sys
->
p_input_resource
==
NULL
)
)
abort
();
/* Start the playlist thread */
if
(
vlc_clone
(
&
p_sys
->
thread
,
Thread
,
p_playlist
,
VLC_THREAD_PRIORITY_LOW
)
)
{
msg_Err
(
p_playlist
,
"cannot spawn playlist thread"
);
abort
();
}
msg_Dbg
(
p_playlist
,
"playlist threads correctly activated"
);
}
/**
...
...
@@ -80,9 +69,6 @@ void playlist_Deactivate( playlist_t *p_playlist )
{
playlist_private_t
*
p_sys
=
pl_priv
(
p_playlist
);
if
(
p_sys
->
p_input_resource
==
NULL
)
return
;
/* playlist was never activated... */
PL_LOCK
;
/* WARNING: There is a latent bug. It is assumed that only one thread will
* be waiting for playlist deactivation at a time. So far, that works
...
...
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