Commit c39376d3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

lib: add helper for playlist startup

Also remove a useless and unsynchronized test.
parent 93e4bf12
...@@ -49,6 +49,7 @@ VLC_API void libvlc_InternalCleanup( libvlc_int_t * ); ...@@ -49,6 +49,7 @@ VLC_API void libvlc_InternalCleanup( libvlc_int_t * );
VLC_API void libvlc_InternalDestroy( libvlc_int_t * ); VLC_API void libvlc_InternalDestroy( libvlc_int_t * );
VLC_API int libvlc_InternalAddIntf( libvlc_int_t *, const char * ); VLC_API int libvlc_InternalAddIntf( libvlc_int_t *, const char * );
VLC_API void libvlc_InternalPlay( libvlc_int_t * );
VLC_API void libvlc_InternalWait( libvlc_int_t * ); VLC_API void libvlc_InternalWait( libvlc_int_t * );
VLC_API void libvlc_SetExitHandler( libvlc_int_t *, void (*) (void *), void * ); VLC_API void libvlc_SetExitHandler( libvlc_int_t *, void (*) (void *), void * );
......
...@@ -41,14 +41,8 @@ ...@@ -41,14 +41,8 @@
void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id, void libvlc_playlist_play( libvlc_instance_t *p_instance, int i_id,
int i_options, char **ppsz_options ) int i_options, char **ppsz_options )
{ {
playlist_t *pl = pl_Get (p_instance->p_libvlc_int); libvlc_InternalPlay( p_instance->p_libvlc_int );
VLC_UNUSED(i_id); VLC_UNUSED(i_options); VLC_UNUSED(ppsz_options); VLC_UNUSED(i_id); VLC_UNUSED(i_options); VLC_UNUSED(ppsz_options);
assert( pl );
if( !var_GetBool( pl, "playlist-autostart" )
|| pl->items.i_size == 0 )
return;
playlist_Control( pl, PLAYLIST_PLAY, false );
} }
int libvlc_add_intf( libvlc_instance_t *p_instance, const char *name ) int libvlc_add_intf( libvlc_instance_t *p_instance, const char *name )
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include "libvlc.h" #include "libvlc.h"
#include "playlist/playlist_internal.h" #include "playlist/playlist_internal.h"
#include "../lib/libvlc_internal.h"
static int AddIntfCallback( vlc_object_t *, char const *, static int AddIntfCallback( vlc_object_t *, char const *,
vlc_value_t , vlc_value_t , void * ); vlc_value_t , vlc_value_t , void * );
...@@ -174,6 +175,18 @@ void intf_InsertItem(libvlc_int_t *libvlc, const char *mrl, unsigned optc, ...@@ -174,6 +175,18 @@ void intf_InsertItem(libvlc_int_t *libvlc, const char *mrl, unsigned optc,
0, -1, optc, optv, flags, true, pl_Unlocked); 0, -1, optc, optv, flags, true, pl_Unlocked);
} }
void libvlc_InternalPlay(libvlc_int_t *libvlc)
{
playlist_t *pl;
vlc_mutex_lock(&lock);
pl = libvlc_priv(libvlc)->playlist;
vlc_mutex_unlock(&lock);
if (pl != NULL && var_GetBool(pl, "playlist-autostart"))
playlist_Control(pl, PLAYLIST_PLAY, false);
}
/** /**
* Stops and destroys all interfaces * Stops and destroys all interfaces
* @param p_libvlc the LibVLC instance * @param p_libvlc the LibVLC instance
......
...@@ -224,6 +224,7 @@ input_Close ...@@ -224,6 +224,7 @@ input_Close
intf_Create intf_Create
IsUTF8 IsUTF8
libvlc_InternalAddIntf libvlc_InternalAddIntf
libvlc_InternalPlay
libvlc_InternalCleanup libvlc_InternalCleanup
libvlc_InternalCreate libvlc_InternalCreate
libvlc_InternalDestroy libvlc_InternalDestroy
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment