From: Stefan Sauer Date: Fri, 15 May 2015 11:43:12 +0000 (+0200) Subject: gstobject: add gst_object_has_as_ancestor and deprecate previous function X-Git-Tag: 1.6.1~331 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8c6ebd0f2a3457f97a64835ec939fbec7bb26e0;p=platform%2Fupstream%2Fgstreamer.git gstobject: add gst_object_has_as_ancestor and deprecate previous function The old gst_object_has_ancestor will call the new code. This establishes the symetry with the new gst_object_has_as_parent. API: gst_object_has_as_ancestor() --- diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 403c72f..dba70f5 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -1712,6 +1712,7 @@ gst_object_unparent gst_object_default_deep_notify gst_object_default_error gst_object_check_uniqueness +gst_object_has_as_ancestor gst_object_has_ancestor gst_object_ref gst_object_unref diff --git a/gst/gstobject.c b/gst/gstobject.c index c24e435..1f58c8d 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -807,7 +807,7 @@ gst_object_has_as_parent (GstObject * object, GstObject * parent) } /** - * gst_object_has_ancestor: + * gst_object_has_as_ancestor: * @object: a #GstObject to check * @ancestor: a #GstObject to check as ancestor * @@ -819,7 +819,7 @@ gst_object_has_as_parent (GstObject * object, GstObject * parent) * MT safe. Grabs and releases @object's locks. */ gboolean -gst_object_has_ancestor (GstObject * object, GstObject * ancestor) +gst_object_has_as_ancestor (GstObject * object, GstObject * ancestor) { GstObject *parent, *tmp; @@ -842,6 +842,32 @@ gst_object_has_ancestor (GstObject * object, GstObject * ancestor) } /** + * 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. One can e.g. check if a #GstElement is inside a #GstPipeline. + * + * Returns: %TRUE if @ancestor is an ancestor of @object. + * + * Deprecated: Use gst_object_has_as_ancestor() instead. + * + * MT safe. Grabs and releases @object's locks. + */ +/* FIXME 2.0: remove */ +#ifndef GST_REMOVE_DEPRECATED +#ifdef GST_DISABLE_DEPRECATED +gboolean gst_object_has_ancestor (GstObject * object, GstObject * ancestor); +#endif +gboolean +gst_object_has_ancestor (GstObject * object, GstObject * ancestor) +{ + return gst_object_has_as_ancestor (object, ancestor); +} +#endif + +/** * gst_object_check_uniqueness: * @list: (transfer none) (element-type Gst.Object): a list of #GstObject to * check through diff --git a/gst/gstobject.h b/gst/gstobject.h index 6c41a69..b478f3b 100644 --- a/gst/gstobject.h +++ b/gst/gstobject.h @@ -213,7 +213,10 @@ gboolean gst_object_set_parent (GstObject *object, GstObject *parent); GstObject* gst_object_get_parent (GstObject *object); void gst_object_unparent (GstObject *object); gboolean gst_object_has_as_parent (GstObject *object, GstObject *parent); +gboolean gst_object_has_as_ancestor (GstObject *object, GstObject *ancestor); +#ifndef GST_DISABLE_DEPRECATED gboolean gst_object_has_ancestor (GstObject *object, GstObject *ancestor); +#endif void gst_object_default_deep_notify (GObject *object, GstObject *orig, GParamSpec *pspec, gchar **excluded_props); diff --git a/tests/check/gst/gstobject.c b/tests/check/gst/gstobject.c index e405566..f88579d 100644 --- a/tests/check/gst/gstobject.c +++ b/tests/check/gst/gstobject.c @@ -456,7 +456,7 @@ GST_START_TEST (test_fake_object_parentage_dispose) GST_END_TEST; -GST_START_TEST (test_fake_object_has_ancestor) +GST_START_TEST (test_fake_object_has_as_ancestor) { GstObject *object1, *object2, *object3, *object4; gboolean result; @@ -490,40 +490,40 @@ GST_START_TEST (test_fake_object_has_ancestor) /* An object isn't its own parent, but it is its own ancestor */ fail_if (gst_object_has_as_parent (object1, object1)); - fail_unless (gst_object_has_ancestor (object1, object1)); + fail_unless (gst_object_has_as_ancestor (object1, object1)); fail_if (gst_object_has_as_parent (object4, object4)); - fail_unless (gst_object_has_ancestor (object4, object4)); + fail_unless (gst_object_has_as_ancestor (object4, object4)); /* direct parents */ fail_unless (gst_object_has_as_parent (object1, object3)); - fail_unless (gst_object_has_ancestor (object1, object3)); + fail_unless (gst_object_has_as_ancestor (object1, object3)); fail_unless (gst_object_has_as_parent (object2, object3)); - fail_unless (gst_object_has_ancestor (object2, object3)); + fail_unless (gst_object_has_as_ancestor (object2, object3)); fail_unless (gst_object_has_as_parent (object3, object4)); - fail_unless (gst_object_has_ancestor (object3, object4)); + fail_unless (gst_object_has_as_ancestor (object3, object4)); /* grandparents */ fail_if (gst_object_has_as_parent (object1, object4)); - fail_unless (gst_object_has_ancestor (object1, object4)); + fail_unless (gst_object_has_as_ancestor (object1, object4)); fail_if (gst_object_has_as_parent (object2, object4)); - fail_unless (gst_object_has_ancestor (object2, object4)); + fail_unless (gst_object_has_as_ancestor (object2, object4)); /* not ancestors */ fail_if (gst_object_has_as_parent (object1, object2)); - fail_if (gst_object_has_ancestor (object1, object2)); + fail_if (gst_object_has_as_ancestor (object1, object2)); fail_if (gst_object_has_as_parent (object3, object1)); - fail_if (gst_object_has_ancestor (object3, object1)); + fail_if (gst_object_has_as_ancestor (object3, object1)); fail_if (gst_object_has_as_parent (object4, object1)); - fail_if (gst_object_has_ancestor (object4, object1)); + fail_if (gst_object_has_as_ancestor (object4, object1)); fail_if (gst_object_has_as_parent (object4, object3)); - fail_if (gst_object_has_ancestor (object4, object3)); + fail_if (gst_object_has_as_ancestor (object4, object3)); /* unparent everything */ gst_object_unparent (object3); @@ -558,7 +558,7 @@ gst_object_suite (void) tcase_add_test (tc_chain, test_fake_object_parentage); tcase_add_test (tc_chain, test_fake_object_parentage_dispose); - tcase_add_test (tc_chain, test_fake_object_has_ancestor); + tcase_add_test (tc_chain, test_fake_object_has_as_ancestor); //tcase_add_checked_fixture (tc_chain, setup, teardown); return s; diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index fbccec0..04df312 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -781,6 +781,7 @@ EXPORTS gst_object_get_value_array gst_object_has_active_control_bindings gst_object_has_ancestor + gst_object_has_as_ancestor gst_object_has_as_parent gst_object_ref gst_object_ref_sink