Index: src/control/vlm.c =================================================================== --- src/control/vlm.c (revision 20410) +++ src/control/vlm.c (working copy) @@ -149,6 +151,38 @@ vlm_media_Clean( &m ); } +void libvlc_vlm_add_vod( libvlc_instance_t *p_instance, char *psz_name, + char *psz_input, char *psz_output, + int i_options, char **ppsz_options, + int b_enabled, int b_loop, + libvlc_exception_t *p_exception ) +{ + vlm_t *p_vlm; + vlm_media_t m; + int n; + + VLM(p_vlm); + + vlm_media_Init( &m ); + m.psz_name = strdup( psz_name ); + m.b_enabled = b_enabled; + m.b_vod = VLC_TRUE; + m.broadcast.b_loop = b_loop; + if( psz_input ) + TAB_APPEND( m.i_input, m.ppsz_input, strdup(psz_input) ); + if( psz_output ) + m.psz_output = strdup( psz_output ); + for( n = 0; n < i_options; n++ ) + TAB_APPEND( m.i_option, m.ppsz_option, strdup(ppsz_options[n]) ); + + if( vlm_Control( p_vlm, VLM_ADD_MEDIA, &m, NULL ) ) + { + vlm_media_Clean( &m ); + libvlc_exception_raise( p_exception, "Media %s creation failed", psz_name ); + } + vlm_media_Clean( &m ); +} + void libvlc_vlm_del_media( libvlc_instance_t *p_instance, char *psz_name, libvlc_exception_t *p_exception ) { Index: src/libvlc-common.c =================================================================== --- src/libvlc-common.c (revision 20410) +++ src/libvlc-common.c (working copy) @@ -253,7 +253,7 @@ system_Init( p_libvlc, &i_argc, ppsz_argv ); /* Get the executable name (similar to the basename command) */ - if( i_argc > 0 ) + if( i_argc > 0 && ppsz_argv ) { p_libvlc->psz_object_name = p_tmp = ppsz_argv[ 0 ]; while( *p_tmp ) Index: bindings/python/vlc_instance.c =================================================================== --- bindings/python/vlc_instance.c (revision 20410) +++ bindings/python/vlc_instance.c (working copy) @@ -499,6 +499,46 @@ return Py_None; } +/******************************************************************************* + * VOD support + ******************************************************************************/ +static PyObject * +vlcInstance_vlm_add_vod( PyObject* self, PyObject *args, PyObject *kwds ) +{ + libvlc_exception_t ex; + static char *kwlist[] = { "name", "input", "output", + "options", "enable", "loop", NULL}; + char* psz_name = NULL; + char* psz_input = NULL; + char* psz_output = NULL; + PyObject* py_options = NULL; + int i_enable = 1; + int i_loop = 0; + int i_size = 0; + char** ppsz_args = NULL; + + if( !PyArg_ParseTupleAndKeywords( args, kwds, "sss|Oii", kwlist, + &psz_name, + &psz_input, &psz_output, + &py_options, &i_enable, &i_loop ) ) + return NULL; + + if( py_options ) + { + i_size = pyoptions_to_args( py_options, &ppsz_args ); + } + + LIBVLC_TRY; + libvlc_vlm_add_vod( LIBVLC_INSTANCE->p_instance, + psz_name, psz_input, psz_output, + i_size, ppsz_args, i_enable, i_loop, &ex); + free_args( i_size, ppsz_args ); + LIBVLC_EXCEPT; + Py_INCREF( Py_None ); + return Py_None; +} + + static PyObject * vlcInstance_vlm_del_media( PyObject *self, PyObject *args ) { @@ -751,6 +791,8 @@ "audio_set_channel(int) Set current audio channel" }, { "vlm_add_broadcast", vlcInstance_vlm_add_broadcast, METH_VARARGS | METH_KEYWORDS, "vlm_add_broadcast(name=str, input=str, output=str, options=list, enable=int, loop=int) Add a new broadcast" }, + { "vlm_add_vod", vlcInstance_vlm_add_vod, METH_VARARGS | METH_KEYWORDS, + "vlm_add_vod(name=str, input=str, output=str, options=list, enable=int, loop=int) Add a new vod" }, { "vlm_del_media", vlcInstance_vlm_del_media, METH_VARARGS, "vlm_del_media(name=str) Delete a media" }, { "vlm_set_enabled", vlcInstance_vlm_set_enabled, METH_VARARGS, Index: include/vlc/libvlc.h =================================================================== --- include/vlc/libvlc.h (revision 20410) +++ include/vlc/libvlc.h (working copy) @@ -569,6 +569,21 @@ int, char **, int, int, libvlc_exception_t * ); /** + * Add a vod, with one input + * \param p_instance the instance + * \param psz_name the name of the new vod + * \param psz_input the input MRL + * \param psz_output the output MRL (the parameter to the "sout" variable) + * \param i_options number of additional options + * \param ppsz_options additional options + * \param b_enabled boolean for enabling the new vod + * \param b_loop Should this broadcast be played in loop ? + * \param p_exception an initialized exception + */ +VLC_PUBLIC_API void libvlc_vlm_add_vod( libvlc_instance_t *, char *, char *, char* , + int, char **, int, int, libvlc_exception_t * ); + +/** * Delete a media (vod or broadcast) * \param p_instance the instance * \param psz_name the media to delete