diff options
author | Bastien Nocera <hadess@hadess.net> | 2009-09-02 13:14:17 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2009-09-02 13:18:10 +0100 |
commit | d3180aafb8597a6244a9e98425c721b1a6b0a33c (patch) | |
tree | 21d5f81db7be76781eaf07758e5057ea8cb63974 | |
parent | 840d3f23845afbb030404c1ae116cf79f73d5b40 (diff) | |
download | totem-d3180aafb8597a6244a9e98425c721b1a6b0a33c.tar.gz |
Allow overriding the HTTP user-agent in the video widget
-rw-r--r-- | src/backend/bacon-video-widget-gst-0.10.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c index 31e646181..546c52973 100644 --- a/src/backend/bacon-video-widget-gst-0.10.c +++ b/src/backend/bacon-video-widget-gst-0.10.c @@ -2049,6 +2049,21 @@ bvw_set_device_on_element (BaconVideoWidget * bvw, GstElement * element) } static void +bvw_set_user_agent_on_element (BaconVideoWidget * bvw, GstElement * element) +{ + const char *ua; + + ua = g_getenv ("BACON_VIDEO_WIDGET_HTTP_USER_AGENT"); + if (ua == NULL) + return; + + if (g_object_class_find_property (G_OBJECT_GET_CLASS (element), "user-agent")) { + GST_DEBUG ("Setting HTTP user-agent to '%s'", ua); + g_object_set (element, "user-agent", ua, NULL); + } +} + +static void playbin_source_notify_cb (GObject *play, GParamSpec *p, BaconVideoWidget *bvw) { GObject *source = NULL; @@ -2072,6 +2087,7 @@ playbin_source_notify_cb (GObject *play, GParamSpec *p, BaconVideoWidget *bvw) if (source) { GST_DEBUG ("Got source of type %s", G_OBJECT_TYPE_NAME (source)); bvw_set_device_on_element (bvw, GST_ELEMENT (source)); + bvw_set_user_agent_on_element (bvw, GST_ELEMENT (source)); g_object_unref (source); } } |