]> git.sesse.net Git - vlc/commitdiff
lib: fix wrong user-agent and http-user-agent values at start
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 16 Jun 2013 08:29:22 +0000 (11:29 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 16 Jun 2013 08:33:31 +0000 (11:33 +0300)
VLC main() initializes the values too late for interfaces and playlist.

lib/core.c
src/libvlc.c

index 411bdc5749345c932e49b333742e68d053676403..6539f11415eed7db73f6df29f137e15fa6c4f4ea 100644 (file)
@@ -69,8 +69,6 @@ libvlc_instance_t * libvlc_new( int argc, const char *const *argv )
     p_new->ref_count = 1;
     p_new->p_callback_list = NULL;
     vlc_mutex_init(&p_new->instance_lock);
-    var_Create( p_libvlc_int, "http-user-agent",
-                VLC_VAR_STRING|VLC_VAR_DOINHERIT );
     return p_new;
 
 error:
index 88f1562661fe9dde4c8293e413f468a6a37273a9..06c69a77d57a72eea36275ac21e1519b66aeb97a 100644 (file)
@@ -385,8 +385,16 @@ dbus_out:
 
     /* some default internal settings */
     var_Create( p_libvlc, "window", VLC_VAR_STRING );
+    /* NOTE: Because the playlist and interfaces start before this function
+     * returns control to the application (DESIGN BUG!), all these variables
+     * must be created (in place of libvlc_new()) and set to VLC defaults
+     * (in place of VLC main()) *here*. */
     var_Create( p_libvlc, "user-agent", VLC_VAR_STRING );
-    var_SetString( p_libvlc, "user-agent", "(LibVLC "VERSION")" );
+    var_SetString( p_libvlc, "user-agent",
+                   "VLC media player (LibVLC "VERSION")" );
+    var_Create( p_libvlc, "http-user-agent", VLC_VAR_STRING );
+    var_SetString( p_libvlc, "http-user-agent",
+                   "VLC/"PACKAGE_VERSION" LibVLC/"PACKAGE_VERSION );
 
     /* System specific configuration */
     system_Configure( p_libvlc, i_argc - vlc_optind, ppsz_argv + vlc_optind );