X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcontrol%2Fcore.c;h=745c85af64a27b39ec8986d25912684ba8a73cff;hb=57a4f916876060dc51583f40483522a0ad1de8bc;hp=54e2fd03807d322a675318c2d1f3d0e5bc77bcd0;hpb=cb435e2774e43702c7b23ce9fd5bd303e300212e;p=vlc diff --git a/src/control/core.c b/src/control/core.c index 54e2fd0380..745c85af64 100644 --- a/src/control/core.c +++ b/src/control/core.c @@ -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: @@ -127,6 +129,21 @@ void libvlc_wait( libvlc_instance_t *p_i ) 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; + char *str; + + var_SetString (p_libvlc, "user-agent", name); + if ((http != NULL) + && (asprintf (&str, "%s LibVLC/"PACKAGE_VERSION, http) != -1)) + { + var_SetString (p_libvlc, "http-user-agent", str); + free (str); + } +} + const char * libvlc_get_version(void) { return VLC_Version(); @@ -142,3 +159,8 @@ const char * libvlc_get_changeset(void) extern const char psz_vlc_changeset[]; return psz_vlc_changeset; } + +void libvlc_free( void *ptr ) +{ + free( ptr ); +}