fix bug when requesting pads by name
authorAndy Wingo <wingo@pobox.com>
Wed, 6 Mar 2002 16:14:34 +0000 (16:14 +0000)
committerAndy Wingo <wingo@pobox.com>
Wed, 6 Mar 2002 16:14:34 +0000 (16:14 +0000)
Original commit message from CVS:
* fix bug when requesting pads by name
* added api: gst_element_get_managing_bin ()

gst/gstelement.c
gst/gstelement.h

index 2490076..a973e1b 100644 (file)
@@ -735,7 +735,7 @@ gst_element_request_pad_by_name (GstElement *element, const gchar *name)
       }
   }
   
-  if (templ == NULL)
+  if (!templ_found)
       return NULL;
   
   pad = gst_element_request_pad (element, templ, req_name);
@@ -1908,3 +1908,18 @@ gst_element_install_std_props (GstElementClass * klass, const char *first_name,
 
   va_end (args);
 }
+
+GstBin*
+gst_element_get_managing_bin (GstElement *element)
+{
+  GstBin *bin;
+
+  g_return_val_if_fail (element != NULL, NULL);
+
+  bin = GST_BIN (gst_object_get_parent (GST_OBJECT_CAST (element)));
+
+  while (bin && !GST_FLAG_IS_SET (GST_OBJECT_CAST (bin), GST_BIN_FLAG_MANAGER))
+    bin = GST_BIN (gst_object_get_parent (GST_OBJECT_CAST (bin)));
+  
+  return bin;
+}
index 4a25e13..2cb26d5 100644 (file)
@@ -246,6 +246,8 @@ GstElementFactory*  gst_element_get_factory         (GstElement *element);
 void                    gst_element_install_std_props   (GstElementClass *klass,
                                                         const char      *first_name, ...);
 
+GstBin*                        gst_element_get_managing_bin    (GstElement *element);
+
 
 /*
  *