When true, the interface will automatically start playing the playlist when (and only when) it is ready. (particularly useful for embedded vouts).
* src/libvlc.c, src/vlc.c: new VLC_AddIntf() prototype.
* src/interface/interface.c: if the interface doesn't support "playing on start", do it ourselves.
* modules/gui/wxwindows/wxwindows.cpp: implement "play on start".
*/
int VLC_Get ( int, char const *, vlc_value_t * );
-int VLC_AddIntf ( int, char const *, vlc_bool_t );
+int VLC_AddIntf ( int, char const *, vlc_bool_t, vlc_bool_t );
int VLC_AddTarget ( int, char const *, const char **, int, int, int );
int VLC_Play ( int );
/* Thread properties and locks */
vlc_bool_t b_block;
+ vlc_bool_t b_play;
/* Specific interfaces */
intf_console_t * p_console; /** console */
p_intf->pf_show_dialog = NULL;
+ /* We support play on start */
+ p_intf->b_play = VLC_TRUE;
+
return VLC_SUCCESS;
}
/* OK, initialization is over */
vlc_thread_ready( p_intf );
+ /* Check if we need to start playing */
+ if( p_intf->b_play )
+ {
+ playlist_t *p_playlist =
+ (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ if( p_playlist )
+ {
+ playlist_Play( p_playlist );
+ vlc_object_release( p_playlist );
+ }
+ }
+
/* Return TRUE to tell program to continue (FALSE would terminate) */
return TRUE;
}
/* Give control to the interface */
p_intf->pf_run( p_intf );
+ /* Reset play on start status */
+ p_intf->b_play = VLC_FALSE;
+
/* Provide ability to switch the main interface on the fly */
while( p_intf->psz_switch_intf )
{
if( psz_temp )
{
sprintf( psz_temp, "%s,none", psz_module );
- VLC_AddIntf( 0, psz_temp, VLC_FALSE );
+ VLC_AddIntf( 0, psz_temp, VLC_FALSE, VLC_FALSE );
free( psz_temp );
}
}
/*
* Allways load the hotkeys interface if it exists
*/
- VLC_AddIntf( 0, "hotkeys,none", VLC_FALSE );
+ VLC_AddIntf( 0, "hotkeys,none", VLC_FALSE, VLC_FALSE );
/*
* FIXME: kludge to use a p_vlc-local variable for the Mozilla plugin
* This function opens an interface plugin and runs it. If b_block is set
* to 0, VLC_AddIntf will return immediately and let the interface run in a
* separate thread. If b_block is set to 1, VLC_AddIntf will continue until
- * user requests to quit.
+ * user requests to quit. If b_play is set to 1, VLC_AddIntf will start playing
+ * the playlist when it is completely initialised.
*****************************************************************************/
-int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block )
+int VLC_AddIntf( int i_object, char const *psz_module,
+ vlc_bool_t b_block, vlc_bool_t b_play )
{
int i_err;
intf_thread_t *p_intf;
return VLC_EGENERIC;
}
+ /* Interface doesn't handle play on start so do it ourselves */
+ if( !p_intf->b_play && b_play ) VLC_Play( i_object );
+
/* Try to run the interface */
+ p_intf->b_play = b_play;
p_intf->b_block = b_block;
i_err = intf_RunThread( p_intf );
if( i_err )
* vlc.c: the vlc player
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
- * $Id: vlc.c,v 1.21 2004/01/25 17:16:05 zorglub Exp $
+ * $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
return i_ret;
}
- /* Run libvlc, in non-blocking mode */
- i_ret = VLC_Play( 0 );
-
- /* Add a blocking interface and keep the return value */
- i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE );
+ /* Add a blocking interface, start playing, and keep the return value */
+ i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );
/* Finish the threads */
VLC_Stop( 0 );