Handle multiple ways of setting an URI
authorMikko Rasa <mikko.rasa@movial.fi>
Wed, 22 Oct 2008 06:58:42 +0000 (09:58 +0300)
committerMikko Rasa <mikko.rasa@movial.fi>
Wed, 22 Oct 2008 06:58:42 +0000 (09:58 +0300)
src/octopus-backend-gst.c

index 4558014..cd3f9d1 100644 (file)
@@ -320,7 +320,23 @@ configure_endpoint(GstElement            *elem,
 {
   if(endpoint->uri) {
     g_debug("Setting URI '%s'", endpoint->uri);
-    g_object_set(G_OBJECT(elem), "location", endpoint->uri, NULL);
+    if(GST_IS_URI_HANDLER(elem)) {
+      GstURIHandler *uri_handler;
+
+      uri_handler = GST_URI_HANDLER(elem);
+      gst_uri_handler_set_uri(uri_handler, endpoint->uri);
+    } else {
+      gchar *loc;
+      
+      loc=gst_uri_get_location(endpoint->uri);
+      
+      if(g_object_class_find_property(G_OBJECT_GET_CLASS(elem), "location"))
+        g_object_set(G_OBJECT(elem), "location", loc, NULL);
+      else if(g_object_class_find_property(G_OBJECT_GET_CLASS(elem), "file-name"))
+        g_object_set(G_OBJECT(elem), "file-name", loc, NULL);
+      else
+        g_warning("Don't know how to set URI");
+    }
   }
 
   if(endpoint->window) {