mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
gst/gstbin.c: use gst_object_has_ancestor().
Original commit message from CVS: * gst/gstbin.c: (bin_element_is_semi_sink), (gst_bin_change_state): use gst_object_has_ancestor(). * gst/gstobject.c: (gst_object_has_ancestor): * gst/gstobject.h: gst_object_has_ancestor() copied from gstbin.c as it is a usefull function. * tests/instantiate/create.c: (create_all_elements): * tests/lat.c: (handoff_src), (handoff_sink): * tests/sched/runxml.c: (main): * tests/seeking/seeking1.c: (main): * tests/threadstate/threadstate2.c: (bus_handler), (timeout_func), (main): Fix compilation of some tests.
This commit is contained in:
parent
f9a16f0ac7
commit
01085fa26a
9 changed files with 69 additions and 34 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2005-09-27 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstbin.c: (bin_element_is_semi_sink), (gst_bin_change_state):
|
||||
use gst_object_has_ancestor().
|
||||
|
||||
* gst/gstobject.c: (gst_object_has_ancestor):
|
||||
* gst/gstobject.h:
|
||||
gst_object_has_ancestor() copied from gstbin.c as it is a
|
||||
usefull function.
|
||||
|
||||
* tests/instantiate/create.c: (create_all_elements):
|
||||
* tests/lat.c: (handoff_src), (handoff_sink):
|
||||
* tests/sched/runxml.c: (main):
|
||||
* tests/seeking/seeking1.c: (main):
|
||||
* tests/threadstate/threadstate2.c: (bus_handler), (timeout_func),
|
||||
(main):
|
||||
Fix compilation of some tests.
|
||||
|
||||
2005-09-27 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/gsterror.h:
|
||||
|
|
26
gst/gstbin.c
26
gst/gstbin.c
|
@ -824,29 +824,6 @@ bin_element_is_sink (GstElement * child, GstBin * bin)
|
|||
return is_sink ? 0 : 1;
|
||||
}
|
||||
|
||||
/* check if object has the given ancestor somewhere up in
|
||||
* the hierarchy
|
||||
*/
|
||||
static gboolean
|
||||
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 = has_ancestor (parent, ancestor);
|
||||
if (parent)
|
||||
gst_object_unref (parent);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* returns 0 when TRUE because this is a GCompareFunc.
|
||||
* This function returns elements that have no connected srcpads and
|
||||
* are therefore not reachable from a real sink. */
|
||||
|
@ -879,7 +856,8 @@ bin_element_is_semi_sink (GstElement * child, GstBin * bin)
|
|||
GST_DEBUG ("looking at pad %p", pads->data);
|
||||
if ((peer = gst_pad_get_peer (GST_PAD_CAST (pads->data)))) {
|
||||
connected_src =
|
||||
has_ancestor (GST_OBJECT_CAST (peer), GST_OBJECT_CAST (bin));
|
||||
gst_object_has_ancestor (GST_OBJECT_CAST (peer),
|
||||
GST_OBJECT_CAST (bin));
|
||||
gst_object_unref (peer);
|
||||
if (connected_src) {
|
||||
break;
|
||||
|
|
|
@ -953,6 +953,38 @@ gst_object_unparent (GstObject * object)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_object_has_ancestor:
|
||||
* @object: GstObject to check
|
||||
* @ancestor: 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 the 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_object_check_uniqueness:
|
||||
* @list: a list of #GstObject to check through
|
||||
|
|
|
@ -237,6 +237,7 @@ gchar* gst_object_get_name_prefix (GstObject *object);
|
|||
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_ancestor (GstObject *object, GstObject *ancestor);
|
||||
|
||||
void gst_object_default_deep_notify (GObject *object, GstObject *orig,
|
||||
GParamSpec *pspec, gchar **excluded_props);
|
||||
|
|
|
@ -31,9 +31,13 @@ create_all_elements (void)
|
|||
const GList *elements;
|
||||
GstElementFactory *factory;
|
||||
GstElement *element;
|
||||
GstRegistry *registry;
|
||||
|
||||
registry = gst_registry_get_default ();
|
||||
|
||||
/* get list of elements */
|
||||
for (elements = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
|
||||
for (elements =
|
||||
gst_registry_get_feature_list (registry, GST_TYPE_ELEMENT_FACTORY);
|
||||
elements != NULL; elements = elements->next) {
|
||||
factory = (GstElementFactory *) elements->data;
|
||||
if ((element = gst_element_factory_create (factory, "test"))) {
|
||||
|
|
|
@ -13,7 +13,7 @@ static guint mhz = 0;
|
|||
void
|
||||
handoff_src (GstElement * src, GstBuffer * buf, gpointer user_data)
|
||||
{
|
||||
gst_trace_read_tsc (&GST_BUFFER_TIMESTAMP (buf));
|
||||
gst_trace_read_tsc ((gint64 *) & GST_BUFFER_TIMESTAMP (buf));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -22,7 +22,7 @@ handoff_sink (GstElement * sink, GstBuffer * buf, gpointer user_data)
|
|||
guint64 end, d, avg;
|
||||
guint avg_ns;
|
||||
|
||||
gst_trace_read_tsc (&end);
|
||||
gst_trace_read_tsc ((gint64 *) & end);
|
||||
d = end - GST_BUFFER_TIMESTAMP (buf);
|
||||
if (d > max)
|
||||
max = d;
|
||||
|
|
|
@ -44,7 +44,7 @@ main (int argc, char *argv[])
|
|||
g_print ("\n *** using testfile %s\n", argv[1]);
|
||||
|
||||
xml = gst_xml_new ();
|
||||
gst_xml_parse_file (xml, argv[1], NULL);
|
||||
gst_xml_parse_file (xml, (const guchar *) argv[1], NULL);
|
||||
|
||||
toplevelelements = gst_xml_get_topelements (xml);
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@ main (gint argc, gchar * argv[])
|
|||
g_print ("doing segment seek from 5 to 10\n");
|
||||
|
||||
gst_pad_send_event (pad,
|
||||
gst_event_new_segment_seek (GST_FORMAT_DEFAULT |
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 5, 10));
|
||||
gst_event_new_seek (1.0, GST_FORMAT_DEFAULT,
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT,
|
||||
GST_SEEK_TYPE_SET, 5, GST_SEEK_TYPE_SET, 10));
|
||||
|
||||
format = GST_FORMAT_DEFAULT;
|
||||
|
||||
|
@ -77,9 +78,10 @@ main (gint argc, gchar * argv[])
|
|||
("doing segment seek from 50 to 55 with looping (2 times), then 20 to 25 without looping\n");
|
||||
looping = 3;
|
||||
|
||||
event = gst_event_new_segment_seek (GST_FORMAT_DEFAULT |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP, 50, 55);
|
||||
event =
|
||||
gst_event_new_seek (1.0, GST_FORMAT_DEFAULT,
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT,
|
||||
GST_SEEK_TYPE_SET, 50, GST_SEEK_TYPE_SET, 55);
|
||||
gst_pad_send_event (pad, event);
|
||||
|
||||
g_signal_connect (G_OBJECT (gst_element_get_pad (fakesink, "sink")),
|
||||
|
|
|
@ -72,7 +72,7 @@ main (int argc, char *argv[])
|
|||
g_timeout_add (2 * 1000, (GSourceFunc) timeout_func, loop);
|
||||
|
||||
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||
gst_bus_add_watch (bus, (GstBusHandler) bus_handler, pipeline);
|
||||
gst_bus_add_watch (bus, GST_MESSAGE_ANY, (GstBusFunc) bus_handler, pipeline);
|
||||
|
||||
for (x = 0; x < 10; x++) {
|
||||
g_print ("playing %d\n", x);
|
||||
|
|
Loading…
Reference in a new issue