]> git.sesse.net Git - vlc/commitdiff
* add core option --vlm-conf
authorAntoine Cellerier <dionoea@videolan.org>
Tue, 23 Nov 2004 16:46:04 +0000 (16:46 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Tue, 23 Nov 2004 16:46:04 +0000 (16:46 +0000)
   specifies a vlm configuration file to load when vlm is launched

src/libvlc.h
src/misc/vlm.c

index ca7a023d509309a3a69fe2ee72b93c16c7c30de9..027b41f2dd8e6db9357310885e6245e7f041b0fe 100644 (file)
@@ -626,6 +626,11 @@ static char *ppsz_align_descriptions[] =
     "This option allows you to specify an additional path for VLC to look " \
     "for its modules.")
 
+#define VLM_CONF_TEXT N_("VLM configuration file")
+#define VLM_CONF_LONGTEXT N_( \
+    "This option allows you to specify a VLM configuration file that will " \
+    "be read when VLM is launched.")
+
 #define PLUGINS_CACHE_TEXT N_("Use a plugins cache")
 #define PLUGINS_CACHE_LONGTEXT N_( \
     "This option allows you to use a plugins cache which will greatly " \
@@ -1048,6 +1053,8 @@ vlc_module_begin();
               PLUGINS_CACHE_LONGTEXT, VLC_TRUE );
     add_directory( "plugin-path", NULL, NULL, PLUGIN_PATH_TEXT,
                    PLUGIN_PATH_LONGTEXT, VLC_TRUE );
+    add_string( "vlm-conf", NULL, NULL, VLM_CONF_TEXT,
+                    VLM_CONF_LONGTEXT, VLC_TRUE );
 
 #if !defined(WIN32)
     add_bool( "daemon", 0, NULL, DAEMON_TEXT, DAEMON_LONGTEXT, VLC_TRUE );
index 01b938a822d2b4c8b5656ff287b3f7d10bc1a15c..2b1b9da35f78fc4101d38aef8f3e7cba2f5d26dd 100644 (file)
@@ -116,7 +116,29 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
         return NULL;
     }
 
-    return p_vlm;
+    /* try loading the vlm conf file given by --vlm-conf */
+    char *psz_vlmconf =  config_GetPsz( p_vlm, "vlm-conf" );
+
+    if( psz_vlmconf && *psz_vlmconf )
+    {
+        vlm_message_t *p_message = NULL;
+        char *psz_buffer = NULL;
+
+        msg_Dbg( p_this, "loading vlm conf ..." );
+        asprintf(&psz_buffer, "load %s", psz_vlmconf );
+        if( psz_buffer )
+        {
+            msg_Dbg( p_this, psz_buffer);
+            if( vlm_ExecuteCommand( p_vlm, psz_buffer, &p_message ) ){
+                msg_Warn( p_this, "error while loading the vlm conf file" );
+            }
+            free(p_message);
+            free(psz_buffer);
+        }
+   }
+   free(psz_vlmconf);
+
+   return p_vlm;
 }
 
 /*****************************************************************************