]> git.sesse.net Git - vlc/blobdiff - src/control/core.c
Add a proper API to set the user agent
[vlc] / src / control / core.c
index 8bc7fd12ad319aac6db94c7bfa3f87f136488a74..942212db77b72e65b65046bfdef25d03d74c95da 100644 (file)
@@ -69,6 +69,8 @@ libvlc_instance_t * libvlc_new( int argc, const char *const *argv )
     p_new->verbosity = 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:
@@ -114,12 +116,29 @@ int libvlc_add_intf( libvlc_instance_t *p_i, const char *name )
     return libvlc_InternalAddIntf( p_i->p_libvlc_int, name ) ? -1 : 0;
 }
 
+void libvlc_set_exit_handler( libvlc_instance_t *p_i, void (*cb) (void *),
+                              void *data )
+{
+    libvlc_int_t *p_libvlc = p_i->p_libvlc_int;
+    libvlc_SetExitHandler( p_libvlc, cb, data );
+}
+
 void libvlc_wait( libvlc_instance_t *p_i )
 {
     libvlc_int_t *p_libvlc = p_i->p_libvlc_int;
     libvlc_InternalWait( p_libvlc );
 }
 
+void libvlc_set_user_agent (libvlc_instance_t *p_i,
+                            const char *name, const char *http)
+{
+    libvlc_int_t *p_libvlc = p_i->p_libvlc_int;
+
+    var_SetString (p_libvlc, "user-agent", name);
+    if (http != NULL)
+        var_SetString (p_libvlc, "http-user-agent", http);
+}
+
 const char * libvlc_get_version(void)
 {
     return VLC_Version();
@@ -135,8 +154,3 @@ const char * libvlc_get_changeset(void)
     extern const char psz_vlc_changeset[];
     return psz_vlc_changeset;
 }
-
-void libvlc_free( void *ptr )
-{
-    free( ptr );
-}