[vlc-commits] commit: Add a secret --user-agent option to pass the application name ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sat May 29 18:29:38 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 29 19:27:32 2010 +0300| [ae16ebf3524a76da5b2584451bcf0f0f9fc820a4] | committer: Rémi Denis-Courmont 

Add a secret --user-agent option to pass the application name

Currently, this is not used anywhere, but better have it for forward
compatibility. This is not as elegant as a dedicated libvlc function
call. But there is no other way to set a parameter before
libvlc_InternalInit() is called by libvlc_new(), short of changing the
libvlc_new() prototype (again). And that would probably be worse.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ae16ebf3524a76da5b2584451bcf0f0f9fc820a4
---

 bin/vlc.c           |    3 ++-
 src/libvlc-module.c |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/bin/vlc.c b/bin/vlc.c
index a771424..447b808 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -154,10 +154,11 @@ int main( int i_argc, const char *ppsz_argv[] )
     sigdelset (&set, SIGCHLD);
 
     /* Note that FromLocale() can be used before libvlc is initialized */
-    const char *argv[i_argc + 3];
+    const char *argv[i_argc + 4];
     int argc = 0;
 
     argv[argc++] = "--no-ignore-config";
+    argv[argc++] = "--user-agent=\"VLC media player\"";
 #ifdef TOP_BUILDDIR
     argv[argc++] = FromLocale ("--plugin-path="TOP_BUILDDIR"/modules");
 #endif
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index bfcc201..ee131ae 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -2052,6 +2052,10 @@ vlc_module_begin ()
                    DATA_PATH_LONGTEXT, true )
         change_need_restart ()
 
+    add_string( "user-agent", "(LibVLC "VERSION")", NULL, "", "", true )
+        change_safe ()
+        change_private ()
+
     set_section( N_("Performance options"), NULL )
     add_obsolete_bool( "minimize-threads" )
 



More information about the vlc-commits mailing list