Example #1
0
/**
 * gst_object_has_ancestor:
 * @object: a #GstObject to check
 * @ancestor: a #GstObject to check as ancestor
 *
 * Check if @object has an ancestor @ancestor somewhere up in
 * the hierarchy.
 *
 * Returns: TRUE if @ancestor is an ancestor of @object.
 *
 * MT safe. Grabs and releases @object's locks.
 */
gboolean
gst_object_has_ancestor (GstObject * object, GstObject * ancestor)
{
  GstObject *parent;
  gboolean result = FALSE;

  if (object == NULL)
    return FALSE;

  if (object == ancestor)
    return TRUE;

  parent = gst_object_get_parent (object);
  result = gst_object_has_ancestor (parent, ancestor);
  if (parent)
    gst_object_unref (parent);

  return result;
}
static gboolean
in_same_pipeline (GstElement * a, GstElement * b)
{
  GstObject *root = NULL, *tmp;
  gboolean ret = FALSE;

  tmp = gst_object_get_parent (GST_OBJECT_CAST (a));
  while (tmp != NULL) {
    if (root)
      gst_object_unref (root);
    root = tmp;
    tmp = gst_object_get_parent (root);
  }

  ret = root && gst_object_has_ancestor (GST_OBJECT_CAST (b), root);

  if (root)
    gst_object_unref (root);

  return ret;
}
Example #3
0
bool Object::isAncestorOf(const ObjectPtr & obj) const
{
    return gst_object_has_ancestor(obj, object<GstObject>());
}