[totem] Allow overriding the HTTP user-agent in the video widget



commit d3180aafb8597a6244a9e98425c721b1a6b0a33c
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 2 13:14:17 2009 +0100

    Allow overriding the HTTP user-agent in the video widget

 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 31e6461..546c529 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);
   }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]