From: Andy Wingo Date: Fri, 20 Feb 2004 13:18:32 +0000 (+0000) Subject: gst/: Debugging tweaks. X-Git-Tag: BRANCH-RELEASE-0_7_5-ROOT~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cded585aa2203555e18e1c128f27539a0313c7e0;p=platform%2Fupstream%2Fgstreamer.git gst/: Debugging tweaks. Original commit message from CVS: 2004-02-20 Andy Wingo * gst/gstbin.c: * gst/gstbuffer.c: * gst/gstplugin.c: * gst/registries/gstxmlregistry.c: * gst/schedulers/gstoptimalscheduler.c: Debugging tweaks. * gst/gstelement.c (gst_element_set_scheduler): Debugging fixes. (gst_element_add_pad): DEBUG->INFO, some fixes. (gst_element_get_compatible_pad_template): Just see if the templates' caps intersect, not if one is a strict subset of the other. This conforms more to what gst_pad_link_intersect() does. (gst_element_class_add_pad_template): Don't memcpy the pad template, just ref it. (gst_element_get_compatible_pad_filtered): Clean up debug messages * gst/gstpad.c (gst_pad_can_link_filtered): Debug a true result. (gst_pad_link_filtered): Debug changes. (gst_pad_link_prepare): New function, consolidated from can_link_filtered and link_filtered. * gst/parse/grammar.y (gst_parse_perform_link): Made INFO output look more like that of the functions in gstelement.c * gst/gstinfo.c (gst_debug_print_object): Put a space before the object, and return the empty string if object is NULL. * gst/parse/parse.l: Remove trailing newlines when calling PRINT. * gst/parse/grammar.y (YYFPRINTF): Log bison debugging info via LOG, not DEBUG. We still get flex info on debug. * gst/registries/gstxmlregistry.c (gst_xml_registry_load): Make debug string more verbose. (plugin_times_older_than): DEBUG->LOG. --- diff --git a/ChangeLog b/ChangeLog index b49f109..3c28608 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +2004-02-20 Andy Wingo + + * gst/gstbin.c: + * gst/gstbuffer.c: + * gst/gstplugin.c: + * gst/registries/gstxmlregistry.c: + * gst/schedulers/gstoptimalscheduler.c: Debugging tweaks. + + * gst/gstelement.c (gst_element_set_scheduler): Debugging fixes. + (gst_element_add_pad): DEBUG->INFO, some fixes. + (gst_element_get_compatible_pad_template): Just see if the + templates' caps intersect, not if one is a strict subset of the + other. This conforms more to what gst_pad_link_intersect() does. + (gst_element_class_add_pad_template): Don't memcpy the pad + template, just ref it. + (gst_element_get_compatible_pad_filtered): Clean up debug messages + + * gst/gstpad.c (gst_pad_can_link_filtered): Debug a true result. + (gst_pad_link_filtered): Debug changes. + (gst_pad_link_prepare): New function, consolidated from + can_link_filtered and link_filtered. + + * gst/parse/grammar.y (gst_parse_perform_link): Made INFO output + look more like that of the functions in gstelement.c + + * gst/gstinfo.c (gst_debug_print_object): Put a space before the + object, and return the empty string if object is NULL. + + * gst/parse/parse.l: Remove trailing newlines when calling PRINT. + * gst/parse/grammar.y (YYFPRINTF): Log bison debugging info via + LOG, not DEBUG. We still get flex info on debug. + + * gst/registries/gstxmlregistry.c (gst_xml_registry_load): Make + debug string more verbose. + (plugin_times_older_than): DEBUG->LOG. + 2004-02-20 Julien MOUTTE * gst/gsttag.h: Adding video-codec and audio-codec for demuxers which @@ -280,6 +316,7 @@ require gettext 0.11.5 so ulonglong.m4 gets checked out and copied by autopoint (fixes #132996) +>>>>>>> 1.260 2004-02-10 Andy Wingo * gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky @@ -739,7 +776,6 @@ * gst/gstelement.c: (gst_element_default_error): suffix error messages with period ->>>>>>> 1.206 2004-01-31 Thomas Vander Stichele * gst/elements/gstfilesrc.c: (gst_filesrc_open_file): diff --git a/gst/gstbin.c b/gst/gstbin.c index 0dd559d..690cd82 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -283,19 +283,21 @@ gst_bin_set_index (GstElement *element, GstIndex *index) static void gst_bin_set_element_sched (GstElement *element, GstScheduler *sched) { - GST_CAT_INFO (GST_CAT_SCHEDULING, "setting element \"%s\" sched to %p", GST_ELEMENT_NAME (element), - sched); + GST_CAT_LOG (GST_CAT_SCHEDULING, "setting element \"%s\" sched to %p", + GST_ELEMENT_NAME (element), sched); /* if it's actually a Bin */ if (GST_IS_BIN (element)) { if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) { - GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: child is already a manager, not resetting", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element, + "child is already a manager, not resetting sched"); if (GST_ELEMENT_SCHED (element)) gst_scheduler_add_scheduler (sched, GST_ELEMENT_SCHED (element)); return; } - GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: setting children's schedule to parent's", GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element, + "setting child bin's scheduler to be the same as the parent's"); gst_scheduler_add_element (sched, element); /* set the children's schedule */ @@ -322,8 +324,8 @@ gst_bin_set_element_sched (GstElement *element, GstScheduler *sched) /* if the peer element exists and is a candidate */ if (GST_PAD_PEER (pad)) { if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) { - GST_CAT_INFO (GST_CAT_SCHEDULING, - "peer is in same scheduler, telling scheduler"); + GST_CAT_LOG (GST_CAT_SCHEDULING, + "peer is in same scheduler, telling scheduler"); if (GST_PAD_IS_SRC (pad)) gst_scheduler_pad_link (sched, pad, GST_PAD_PEER (pad)); @@ -340,20 +342,20 @@ static void gst_bin_unset_element_sched (GstElement *element, GstScheduler *sched) { if (GST_ELEMENT_SCHED (element) == NULL) { - GST_CAT_INFO (GST_CAT_SCHEDULING, "element \"%s\" has no scheduler", + GST_CAT_DEBUG (GST_CAT_SCHEDULING, "element \"%s\" has no scheduler", GST_ELEMENT_NAME (element)); return; } - GST_CAT_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from its sched %p", - GST_ELEMENT_NAME (element), GST_ELEMENT_SCHED (element)); + GST_CAT_DEBUG (GST_CAT_SCHEDULING, "removing element \"%s\" from its sched %p", + GST_ELEMENT_NAME (element), GST_ELEMENT_SCHED (element)); /* if it's actually a Bin */ if (GST_IS_BIN (element)) { if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) { - GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: child is already a manager, not unsetting sched", - GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element, + "child is already a manager, not unsetting sched"); if (sched) { gst_scheduler_remove_scheduler (sched, GST_ELEMENT_SCHED (element)); } @@ -383,7 +385,7 @@ gst_bin_unset_element_sched (GstElement *element, GstScheduler *sched) /* if the peer element exists and is a candidate */ if (GST_PAD_PEER (pad)) { if (gst_pad_get_scheduler (GST_PAD_PEER (pad)) == sched) { - GST_CAT_INFO (GST_CAT_SCHEDULING, "peer is in same scheduler, telling scheduler"); + GST_CAT_LOG (GST_CAT_SCHEDULING, "peer is in same scheduler, telling scheduler"); if (GST_PAD_IS_SRC (pad)) gst_scheduler_pad_unlink (sched, pad, GST_PAD_PEER (pad)); @@ -462,8 +464,8 @@ gst_bin_add_func (GstBin *bin, GstElement *element) gst_bin_set_element_sched (element, sched); } - GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: added child \"%s\"", - GST_ELEMENT_NAME (bin), GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, bin, "added element \"%s\"", + GST_OBJECT_NAME (element)); g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_ADDED], 0, element); } @@ -484,8 +486,8 @@ gst_bin_add (GstBin *bin, GstElement *element) g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (GST_IS_ELEMENT (element)); - GST_CAT_DEBUG (GST_CAT_PARENTAGE, "adding element \"%s\" to bin \"%s\"", - GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin)); + GST_CAT_INFO_OBJECT (GST_CAT_PARENTAGE, bin, "adding element \"%s\"", + GST_OBJECT_NAME (element)); bclass = GST_BIN_GET_CLASS (bin); @@ -525,8 +527,8 @@ gst_bin_remove_func (GstBin *bin, GstElement *element) while (state >>= 1) state_idx++; bin->child_states[state_idx]--; - GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: removed child %s", - GST_ELEMENT_NAME (bin), GST_ELEMENT_NAME (element)); + GST_CAT_INFO_OBJECT (GST_CAT_PARENTAGE, bin, "removed child \"%s\"", + GST_OBJECT_NAME (element)); /* ref as we're going to emit a signal */ gst_object_ref (GST_OBJECT (element)); @@ -621,9 +623,10 @@ gst_bin_child_state_change (GstBin *bin, GstElementState oldstate, g_return_if_fail (GST_IS_BIN (bin)); g_return_if_fail (GST_IS_ELEMENT (child)); - GST_CAT_INFO (GST_CAT_STATES, "child %s changed state in bin %s from %s to %s", - GST_ELEMENT_NAME (child), GST_ELEMENT_NAME (bin), - gst_element_state_get_name (oldstate), gst_element_state_get_name (newstate)); + GST_CAT_LOG (GST_CAT_STATES, "child %s changed state in bin %s from %s to %s", + GST_ELEMENT_NAME (child), GST_ELEMENT_NAME (bin), + gst_element_state_get_name (oldstate), + gst_element_state_get_name (newstate)); bclass = GST_BIN_GET_CLASS (bin); @@ -653,15 +656,16 @@ gst_bin_child_state_change_func (GstBin *bin, GstElementState oldstate, if (bin->child_states[i] != 0) { gint state = (1 << i); if (GST_STATE (bin) != state) { - GST_CAT_INFO (GST_CAT_STATES, "bin %s need state change to %s", - GST_ELEMENT_NAME (bin), gst_element_state_get_name (state)); + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin, + "highest child state is %s, changing bin state accordingly", + gst_element_state_get_name (state)); GST_STATE_PENDING (bin) = state; GST_UNLOCK (bin); gst_bin_change_state_norecurse (bin); if (state != GST_STATE (bin)) { - g_warning ("%s: state change in cllback %d %d", - GST_ELEMENT_NAME (bin), - state, GST_STATE (bin)); + g_warning ("%s: state change in callback %d %d", + GST_ELEMENT_NAME (bin), + state, GST_STATE (bin)); } return; } @@ -690,17 +694,18 @@ gst_bin_change_state (GstElement * element) pending = GST_STATE_PENDING (element); transition = GST_STATE_TRANSITION (element); - GST_CAT_INFO (GST_CAT_STATES, "[%s]: changing childrens' state from %s to %s", - GST_ELEMENT_NAME (element), - gst_element_state_get_name (old_state), gst_element_state_get_name (pending)); + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "changing childrens' state from %s to %s", + gst_element_state_get_name (old_state), + gst_element_state_get_name (pending)); if (pending == GST_STATE_VOID_PENDING) return GST_STATE_SUCCESS; if (old_state == pending) { - GST_CAT_INFO (GST_CAT_STATES, "[%s]: old and pending state are both %s, returning", - GST_ELEMENT_NAME (element), gst_element_state_get_name (pending)); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, + "old and pending state are both %s, returning", + gst_element_state_get_name (pending)); return GST_STATE_SUCCESS; } @@ -719,8 +724,10 @@ gst_bin_change_state (GstElement * element) switch (gst_element_set_state (child, pending)) { case GST_STATE_FAILURE: - GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' failed to go to state %d(%s)", - GST_ELEMENT_NAME (child), pending, gst_element_state_get_name (pending)); + GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, + "child '%s' failed to go to state %d(%s)", + GST_ELEMENT_NAME (child), + pending, gst_element_state_get_name (pending)); gst_element_set_state (child, old_child_state); /* There was a check for elements being in the same scheduling group @@ -732,8 +739,9 @@ gst_bin_change_state (GstElement * element) return GST_STATE_FAILURE; break; case GST_STATE_ASYNC: - GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' is changing state asynchronously", - GST_ELEMENT_NAME (child)); + GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, + "child '%s' is changing state asynchronously", + GST_ELEMENT_NAME (child)); have_async = TRUE; break; case GST_STATE_SUCCESS: @@ -743,11 +751,11 @@ gst_bin_change_state (GstElement * element) } } - GST_CAT_INFO (GST_CAT_STATES, "[%s]: done changing bin's state from %s to %s, now in %s", - GST_ELEMENT_NAME (element), - gst_element_state_get_name (old_state), - gst_element_state_get_name (pending), - gst_element_state_get_name (GST_STATE (element))); + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, + "done changing bin's state from %s to %s, now in %s", + gst_element_state_get_name (old_state), + gst_element_state_get_name (pending), + gst_element_state_get_name (GST_STATE (element))); if (have_async) ret = GST_STATE_ASYNC; @@ -768,7 +776,7 @@ gst_bin_change_state_norecurse (GstBin * bin) GstElementStateReturn ret; if (parent_class->change_state) { - GST_CAT_DEBUG (GST_CAT_STATES, "[%s]: setting bin's own state", GST_ELEMENT_NAME (bin)); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, bin, "setting bin's own state"); ret = parent_class->change_state (GST_ELEMENT (bin)); return ret; diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 626b2b5..698da47 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -53,7 +53,7 @@ _gst_buffer_initialize (void) chunk = gst_mem_chunk_new ("GstBufferChunk", sizeof (GstBuffer), sizeof (GstBuffer) * 200, 0); - GST_CAT_INFO (GST_CAT_BUFFER, "Buffers are initialized now"); + GST_CAT_LOG (GST_CAT_BUFFER, "Buffers are initialized now"); } GType @@ -268,7 +268,7 @@ gst_buffer_create_sub (GstBuffer *parent, guint offset, guint size) gst_alloc_trace_new (_gst_buffer_trace, buffer); #endif - GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p", buffer); + GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p (parent %p)", buffer, parent); /* make sure nobody overwrites data in the new buffer * by setting the READONLY flag */ diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 4e473c1..c6e4262 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -22,7 +22,6 @@ #endif #include -#include #include #define CAPS_POISON(caps) G_STMT_START{ \ diff --git a/gst/gstdata.c b/gst/gstdata.c index 3e8de86..0e6fe64 100644 --- a/gst/gstdata.c +++ b/gst/gstdata.c @@ -187,8 +187,8 @@ gst_data_ref (GstData *data) g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (GST_DATA_REFCOUNT_VALUE(data) > 0, NULL); - GST_CAT_LOG (GST_CAT_BUFFER, "ref data %p, count before ref is %d", - data, GST_DATA_REFCOUNT_VALUE (data)); + GST_CAT_LOG (GST_CAT_BUFFER, "%p %d->%d", data, + GST_DATA_REFCOUNT_VALUE (data), GST_DATA_REFCOUNT_VALUE (data) + 1); gst_atomic_int_inc (&data->refcount); @@ -211,6 +211,9 @@ gst_data_ref_by_count (GstData *data, gint count) g_return_val_if_fail (count >= 0, NULL); g_return_val_if_fail (GST_DATA_REFCOUNT_VALUE(data) > 0, NULL); + GST_CAT_LOG (GST_CAT_BUFFER, "%p %d->%d", data, + GST_DATA_REFCOUNT_VALUE (data), GST_DATA_REFCOUNT_VALUE (data) + count); + gst_atomic_int_add (&data->refcount, count); return data; @@ -234,8 +237,8 @@ gst_data_unref (GstData *data) g_return_if_fail (data != NULL); - GST_CAT_LOG (GST_CAT_BUFFER, "unref data %p, count before unref is %d", - data, GST_DATA_REFCOUNT_VALUE (data)); + GST_CAT_LOG (GST_CAT_BUFFER, "%p %d->%d", data, + GST_DATA_REFCOUNT_VALUE (data), GST_DATA_REFCOUNT_VALUE (data) - 1); g_return_if_fail (GST_DATA_REFCOUNT_VALUE (data) > 0); zero = gst_atomic_int_dec_and_test (&data->refcount); diff --git a/gst/gstelement.c b/gst/gstelement.c index 9db24a2..5999cb8 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -1066,9 +1066,10 @@ gst_element_add_pad (GstElement *element, GstPad *pad) /* then check to see if there's already a pad by that name here */ g_return_if_fail (gst_object_check_uniqueness (element->pads, GST_PAD_NAME(pad)) == TRUE); + GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "adding pad '%s'", + GST_STR_NULL (GST_OBJECT_NAME (pad))); + /* set the pad's parent */ - GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,"setting parent of pad '%s' to '%s'", - GST_PAD_NAME (pad), GST_STR_NULL (GST_ELEMENT_NAME (element))); gst_object_set_parent (GST_OBJECT (pad), GST_OBJECT (element)); /* add it to the list */ @@ -1358,18 +1359,14 @@ void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ) { - GstPadTemplate *templ_copy; - - g_return_if_fail (klass != NULL); g_return_if_fail (GST_IS_ELEMENT_CLASS (klass)); - g_return_if_fail (templ != NULL); g_return_if_fail (GST_IS_PAD_TEMPLATE (templ)); + /* avoid registering pad templates with the same name */ g_return_if_fail (gst_element_class_get_pad_template (klass, templ->name_template) == NULL); - templ_copy = g_memdup(templ, sizeof(GstPadTemplate)); - - klass->padtemplates = g_list_append (klass->padtemplates, templ_copy); + klass->padtemplates = g_list_append (klass->padtemplates, + gst_object_ref (GST_OBJECT (templ))); klass->numpadtemplates++; } @@ -1500,37 +1497,37 @@ gst_element_get_compatible_pad_template (GstElement *element, GstPadTemplate *newtempl = NULL; GList *padlist; - GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "gst_element_get_compatible_pad_template()"); - g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (compattempl != NULL, NULL); padlist = gst_element_get_pad_template_list (element); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "Looking for a suitable pad template..."); + while (padlist) { GstPadTemplate *padtempl = (GstPadTemplate*) padlist->data; - gboolean comp = FALSE; + GstCaps *intersection; /* Ignore name * Ignore presence * Check direction (must be opposite) * Check caps */ - GST_CAT_DEBUG (GST_CAT_CAPS, "checking direction and caps"); if (padtempl->direction != compattempl->direction) { - GST_CAT_DEBUG (GST_CAT_CAPS, "compatible direction: found %s pad template", - padtempl->direction == GST_PAD_SRC ? "src" : "sink"); + GST_CAT_DEBUG (GST_CAT_CAPS, "compatible direction: found %s pad template \"%s\"", + padtempl->direction == GST_PAD_SRC ? "src" : "sink", + padtempl->name_template); - comp = gst_caps_is_always_compatible (GST_PAD_TEMPLATE_CAPS (compattempl), - GST_PAD_TEMPLATE_CAPS (padtempl)); + intersection = gst_caps_intersect (GST_PAD_TEMPLATE_CAPS (compattempl), + GST_PAD_TEMPLATE_CAPS (padtempl)); - GST_CAT_DEBUG (GST_CAT_CAPS, "caps are %scompatible", (comp ? "" : "not ")); + GST_CAT_DEBUG (GST_CAT_CAPS, "caps are %scompatible", (intersection ? "" : "not ")); - if (comp) { + if (intersection) newtempl = padtempl; - break; - } + gst_caps_free (intersection); + if (newtempl) break; } padlist = g_list_next (padlist); @@ -1636,8 +1633,8 @@ gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad, g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (GST_IS_PAD (pad), NULL); - GST_DEBUG ("finding pad in %s compatible with %s:%s", - GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad)); + GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "finding pad in %s compatible with %s:%s", + GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad)); /* let's use the real pad */ pad = (GstPad *) GST_PAD_REALIZE (pad); @@ -1685,8 +1682,9 @@ gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad, if (foundpad) return foundpad; //} - GST_DEBUG_OBJECT (element, "Could not find a compatible pad to link to %s:%s", - GST_DEBUG_PAD_NAME (pad)); + GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, + "Could not find a compatible pad to link to %s:%s", + GST_DEBUG_PAD_NAME (pad)); return NULL; } @@ -2636,9 +2634,9 @@ gst_element_set_state (GstElement *element, GstElementState state) return (GST_STATE_SUCCESS); } - GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "setting state from %s to %s", - gst_element_state_get_name (curpending), - gst_element_state_get_name (state)); + GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "setting state from %s to %s", + gst_element_state_get_name (curpending), + gst_element_state_get_name (state)); /* loop until the final requested state is set */ while (GST_STATE (element) != state @@ -2655,9 +2653,9 @@ gst_element_set_state (GstElement *element, GstElementState state) if (curpending != state) { GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, - "intermediate: setting state from %s to %s", - gst_element_state_get_name (GST_STATE (element)), - gst_element_state_get_name (curpending)); + "intermediate: setting state from %s to %s", + gst_element_state_get_name (GST_STATE (element)), + gst_element_state_get_name (curpending)); } /* call the state change function so it can set the state */ @@ -2667,12 +2665,12 @@ gst_element_set_state (GstElement *element, GstElementState state) switch (return_val) { case GST_STATE_FAILURE: - GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, - "have failed change_state return"); + GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, + "have failed change_state return"); goto exit; case GST_STATE_ASYNC: - GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, - "element will change state async"); + GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, + "element will change state async"); goto exit; case GST_STATE_SUCCESS: /* Last thing we do is verify that a successful state change really @@ -2818,17 +2816,17 @@ gst_element_change_state (GstElement *element) if (old_pending == GST_STATE_VOID_PENDING || old_state == GST_STATE_PENDING (element)) { - GST_CAT_INFO (GST_CAT_STATES, - "no state change needed for element %s (VOID_PENDING)", - GST_ELEMENT_NAME (element)); + GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, + "element is already in the %s state", + gst_element_state_get_name (old_state)); return GST_STATE_SUCCESS; } - GST_CAT_INFO (GST_CAT_STATES, "%s default handler sets state from %s to %s %04x", - GST_ELEMENT_NAME (element), - gst_element_state_get_name (old_state), - gst_element_state_get_name (old_pending), - old_transition); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, + "default handler sets state from %s to %s %04x", + gst_element_state_get_name (old_state), + gst_element_state_get_name (old_pending), + old_transition); /* we set the state change early for the negotiation functions */ GST_STATE (element) = old_pending; @@ -2872,17 +2870,17 @@ gst_element_change_state (GstElement *element) parent = GST_ELEMENT_PARENT (element); - GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, - "signaling state change from %s to %s", - gst_element_state_get_name (old_state), - gst_element_state_get_name (GST_STATE (element))); + GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, + "signaling state change from %s to %s", + gst_element_state_get_name (old_state), + gst_element_state_get_name (GST_STATE (element))); /* tell the scheduler if we have one */ if (element->sched) { if (gst_scheduler_state_transition (element->sched, element, old_transition) != GST_STATE_SUCCESS) { - GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, - "scheduler could not change state"); + GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, + "scheduler could not change state"); goto failure; } } @@ -3161,7 +3159,7 @@ gst_element_set_scheduler (GstElement *element, { g_return_if_fail (GST_IS_ELEMENT (element)); - GST_CAT_INFO_OBJECT (GST_CAT_PARENTAGE, element, "setting scheduler to %p", sched); + GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element, "setting scheduler to %p", sched); gst_object_replace ((GstObject **)&GST_ELEMENT_SCHED (element), GST_OBJECT (sched)); } diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 71b0be5..c085676 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -110,8 +110,9 @@ gst_element_factory_find (const gchar *name) if (feature) return GST_ELEMENT_FACTORY (feature); - /* this should be an ERROR */ - GST_DEBUG ("no such elementfactory \"%s\"", name); + /* this isn't an error, for instance when you query if an element factory is + * present */ + GST_LOG ("no such element factory \"%s\"", name); return NULL; } @@ -261,8 +262,11 @@ gst_element_factory_create (GstElementFactory *factory, return NULL; } - GST_LOG_OBJECT (factory, "creating element (name \"%s\", type %d)", - GST_STR_NULL (name), (gint) factory->type); + if (name) + GST_INFO ("creating \"%s\" named \"%s\"", GST_PLUGIN_FEATURE_NAME (factory), + GST_STR_NULL (name)); + else + GST_INFO ("creating \"%s\"", GST_PLUGIN_FEATURE_NAME (factory)); if (factory->type == 0) { g_critical ("Factory for `%s' has no type", @@ -271,10 +275,8 @@ gst_element_factory_create (GstElementFactory *factory, } oclass = GST_ELEMENT_CLASS (g_type_class_ref (factory->type)); - if (oclass->elementfactory == NULL) { - GST_DEBUG ("class %s", GST_PLUGIN_FEATURE_NAME (factory)); + if (oclass->elementfactory == NULL) oclass->elementfactory = factory; - } /* create an instance of the element */ element = GST_ELEMENT (g_object_new (factory->type, NULL)); diff --git a/gst/gstinfo.c b/gst/gstinfo.c index cbb451d..5704bf0 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -365,7 +365,7 @@ gst_debug_print_object (gpointer ptr) /* nicely printed object */ if (object == NULL) { - return g_strdup ("NULL"); + return g_strdup ("(NULL)"); } if (*(GType *)ptr == GST_TYPE_CAPS) { return gst_caps_to_string ((GstCaps *)ptr); @@ -472,9 +472,9 @@ gst_debug_log_default (GstDebugCategory *category, GstDebugLevel level, pidcolor = g_strdup (""); } - obj = gst_debug_print_object (object); + obj = object ? gst_debug_print_object (object) : g_strdup (""); - g_printerr ("%s %s%15s%s(%s%5d%s) %s%s(%d):%s: %s%s %s\n", + g_printerr ("%s %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n", gst_debug_level_get_name (level), color, gst_debug_category_get_name (category), clear, pidcolor, pid, clear, diff --git a/gst/gstpad.c b/gst/gstpad.c index 275d2eb..d7fce21 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -193,8 +193,6 @@ gst_real_pad_class_init (GstRealPadClass *klass) gst_marshal_BOXED__BOXED, GST_TYPE_CAPS, 1, GST_TYPE_CAPS | G_SIGNAL_TYPE_STATIC_SCOPE); -/* gtk_object_add_arg_type ("GstRealPad::active", G_TYPE_BOOLEAN, */ -/* GTK_ARG_READWRITE, REAL_ARG_ACTIVE); */ g_object_class_install_property (G_OBJECT_CLASS (klass), REAL_ARG_ACTIVE, g_param_spec_boolean ("active", "Active", "Whether the pad is active.", TRUE, G_PARAM_READWRITE)); @@ -558,7 +556,7 @@ gst_pad_set_event_mask_function (GstPad *pad, GST_RPAD_EVENTMASKFUNC (pad) = mask_func; - GST_CAT_DEBUG (GST_CAT_PADS, "eventmaskfunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "eventmaskfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (mask_func)); } @@ -633,7 +631,7 @@ gst_pad_set_convert_function (GstPad *pad, GST_RPAD_CONVERTFUNC (pad) = convert; - GST_CAT_DEBUG (GST_CAT_PADS, "convertfunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "convertfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (convert)); } @@ -652,7 +650,7 @@ gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query) GST_RPAD_QUERYFUNC (pad) = query; - GST_CAT_DEBUG (GST_CAT_PADS, "queryfunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "queryfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (query)); } @@ -671,7 +669,7 @@ gst_pad_set_query_type_function (GstPad *pad, GstPadQueryTypeFunction type_func) GST_RPAD_QUERYTYPEFUNC (pad) = type_func; - GST_CAT_DEBUG (GST_CAT_PADS, "querytypefunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "querytypefunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (type_func)); } @@ -746,7 +744,7 @@ gst_pad_set_internal_link_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_INTLINKFUNC (pad) = intlink; - GST_CAT_DEBUG (GST_CAT_PADS, "internal link for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "internal link for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (intlink)); } @@ -764,7 +762,7 @@ gst_pad_set_formats_function (GstPad *pad, GstPadFormatsFunction formats) g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_FORMATSFUNC (pad) = formats; - GST_CAT_DEBUG (GST_CAT_PADS, "formats function for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "formats function for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (formats)); } @@ -803,7 +801,7 @@ gst_pad_set_link_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_LINKFUNC (pad) = link; - GST_CAT_DEBUG (GST_CAT_PADS, "linkfunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "linkfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (link)); } @@ -823,7 +821,7 @@ gst_pad_set_unlink_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_UNLINKFUNC (pad) = unlink; - GST_CAT_DEBUG (GST_CAT_PADS, "unlinkfunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "unlinkfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (unlink)); } @@ -849,7 +847,7 @@ gst_pad_set_fixate_function (GstPad *pad, GstPadFixateFunction fixate) g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_FIXATEFUNC (pad) = fixate; - GST_CAT_DEBUG (GST_CAT_PADS, "fixatefunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "fixatefunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (fixate)); } @@ -886,7 +884,7 @@ gst_pad_set_getcaps_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_GETCAPSFUNC (pad) = getcaps; - GST_CAT_DEBUG (GST_CAT_PADS, "getcapsfunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "getcapsfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (getcaps)); } @@ -907,7 +905,7 @@ gst_pad_set_bufferalloc_function (GstPad *pad, g_return_if_fail (GST_PAD_IS_SINK (pad)); GST_RPAD_BUFFERALLOCFUNC (pad) = bufalloc; - GST_CAT_DEBUG (GST_CAT_PADS, "bufferallocfunc for %s:%s set to %s", + GST_CAT_LOG (GST_CAT_PADS, "bufferallocfunc for %s:%s set to %s", GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME (bufalloc)); } @@ -991,8 +989,8 @@ gst_pad_unlink (GstPad *srcpad, g_signal_emit (G_OBJECT (realsink), gst_real_pad_signals[REAL_UNLINKED], 0, realsrc); - GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "unlinked %s:%s and %s:%s", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); + GST_CAT_LOG (GST_CAT_ELEMENT_PADS, "unlinked %s:%s and %s:%s", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); gst_object_unref (GST_OBJECT (realsrc)); gst_object_unref (GST_OBJECT (realsink)); @@ -1529,76 +1527,42 @@ gst_pad_try_set_caps_nonfixed (GstPad *pad, const GstCaps *caps) return ret; } -/** - * gst_pad_can_link_filtered: - * @srcpad: the source #GstPad to link. - * @sinkpad: the sink #GstPad to link. - * @filtercaps: the filter #GstCaps. - * - * Checks if the source pad and the sink pad can be linked when constrained - * by the given filter caps. Both @srcpad and @sinkpad must be unlinked. - * - * Returns: TRUE if the pads can be linked, FALSE otherwise. - */ -gboolean -gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, - const GstCaps *filtercaps) +/* returning NULL indicates that the arguments are invalid */ +static GstPadLink* +gst_pad_link_prepare (GstPad *srcpad, GstPad *sinkpad, + const GstCaps *filtercaps) { GstRealPad *realsrc, *realsink; GstPadLink *link; - /* FIXME This function is gross. It's almost a direct copy of - * gst_pad_link_filtered(). Any decent programmer would attempt - * to merge the two functions, which I will do some day. --ds - */ + g_return_val_if_fail (GST_IS_PAD (srcpad), NULL); + g_return_val_if_fail (GST_IS_PAD (sinkpad), NULL); - /* generic checks */ - g_return_val_if_fail (srcpad != NULL, FALSE); - g_return_val_if_fail (GST_IS_PAD (srcpad), FALSE); - g_return_val_if_fail (sinkpad != NULL, FALSE); - g_return_val_if_fail (GST_IS_PAD (sinkpad), FALSE); - - GST_CAT_INFO (GST_CAT_PADS, "trying to link %s:%s and %s:%s", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); - - /* now we need to deal with the real/ghost stuff */ realsrc = GST_PAD_REALIZE (srcpad); realsink = GST_PAD_REALIZE (sinkpad); if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) { - GST_CAT_INFO (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s", - GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); - } - /* FIXME: shouldn't we convert this to g_return_val_if_fail? */ - if (GST_RPAD_PEER (realsrc) != NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real source pad %s:%s has a peer, failed", - GST_DEBUG_PAD_NAME (realsrc)); - return FALSE; - } - if (GST_RPAD_PEER (realsink) != NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has a peer, failed", - GST_DEBUG_PAD_NAME (realsink)); - return FALSE; - } - if (GST_PAD_PARENT (realsrc) == NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s has no parent, failed", - GST_DEBUG_PAD_NAME (realsrc)); - return FALSE; - } - if (GST_PAD_PARENT (realsink) == NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has no parent, failed", - GST_DEBUG_PAD_NAME (realsrc)); - return FALSE; + GST_CAT_DEBUG (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s", + GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); } + g_return_val_if_fail (GST_RPAD_PEER (realsrc) == NULL, NULL); + g_return_val_if_fail (GST_RPAD_PEER (realsink) == NULL, NULL); + g_return_val_if_fail (GST_PAD_PARENT (realsrc) != NULL, NULL); + g_return_val_if_fail (GST_PAD_PARENT (realsink) != NULL, NULL); + if (!gst_pad_check_schedulers (realsrc, realsink)) { g_warning ("linking pads with different scheds requires " "exactly one decoupled element (such as queue)"); - return FALSE; + return NULL; } - g_return_val_if_fail (realsrc != NULL, GST_PAD_LINK_REFUSED); - g_return_val_if_fail (realsink != NULL, GST_PAD_LINK_REFUSED); + if (GST_RPAD_DIRECTION (realsrc) == GST_RPAD_DIRECTION (realsink)) { + g_warning ("%s:%s and %s:%s are both %s pads, failed", + GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink), + GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC ? "src" : "sink"); + return NULL; + } link = gst_pad_link_new (); @@ -1610,29 +1574,48 @@ gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, link->sinkpad = GST_PAD (realsrc); } - if (GST_RPAD_DIRECTION (link->srcpad) != GST_PAD_SRC) { - GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s is not a source pad, failed", - GST_DEBUG_PAD_NAME (link->srcpad)); - gst_pad_link_free (link); - return FALSE; - } - if (GST_RPAD_DIRECTION (link->sinkpad) != GST_PAD_SINK) { - GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s is not a sink pad, failed", - GST_DEBUG_PAD_NAME (link->sinkpad)); - gst_pad_link_free (link); - return FALSE; - } - link->srccaps = gst_pad_get_caps (link->srcpad); link->sinkcaps = gst_pad_get_caps (link->sinkpad); if (filtercaps) link->filtercaps = gst_caps_copy (filtercaps); + return link; +} + +/** + * gst_pad_can_link_filtered: + * @srcpad: the source #GstPad to link. + * @sinkpad: the sink #GstPad to link. + * @filtercaps: the filter #GstCaps. + * + * Checks if the source pad and the sink pad can be linked when constrained + * by the given filter caps. Both @srcpad and @sinkpad must be unlinked. + * + * Returns: TRUE if the pads can be linked, FALSE otherwise. + */ +gboolean +gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, + const GstCaps *filtercaps) +{ + GstPadLink *link; + + GST_CAT_INFO (GST_CAT_PADS, "checking if %s:%s and %s:%s can link", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); + + link = gst_pad_link_prepare (srcpad, sinkpad, filtercaps); + + if (!link) return FALSE; + gst_pad_link_intersect (link); if (gst_caps_is_empty (link->caps)) { + GST_CAT_INFO (GST_CAT_PADS, "%s:%s and %s:%s %sdo not have compatible capabilities, failed", + GST_DEBUG_PAD_NAME (link->sinkpad), GST_DEBUG_PAD_NAME (link->srcpad), + link->filtercaps ? "and the filtercaps " : ""); gst_pad_link_free (link); return FALSE; } + GST_CAT_DEBUG (GST_CAT_PADS, "yes, pads %s:%s and %s:%s can link", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); gst_pad_link_free (link); return TRUE; } @@ -1667,87 +1650,22 @@ gboolean gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps) { - GstRealPad *realsrc, *realsink; - GstScheduler *src_sched, *sink_sched; GstPadLink *link; - - /* generic checks */ - g_return_val_if_fail (srcpad != NULL, FALSE); - g_return_val_if_fail (GST_IS_PAD (srcpad), FALSE); - g_return_val_if_fail (sinkpad != NULL, FALSE); - g_return_val_if_fail (GST_IS_PAD (sinkpad), FALSE); + GstScheduler *src_sched, *sink_sched; GST_CAT_INFO (GST_CAT_PADS, "trying to link %s:%s and %s:%s", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); - - /* now we need to deal with the real/ghost stuff */ - realsrc = GST_PAD_REALIZE (srcpad); - realsink = GST_PAD_REALIZE (sinkpad); + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); - if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) { - GST_CAT_INFO (GST_CAT_PADS, "*actually* linking %s:%s and %s:%s", - GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink)); - } - /* FIXME: shouldn't we convert this to g_return_val_if_fail? */ - if (GST_RPAD_PEER (realsrc) != NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real source pad %s:%s has a peer, failed", - GST_DEBUG_PAD_NAME (realsrc)); - return FALSE; - } - if (GST_RPAD_PEER (realsink) != NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has a peer, failed", - GST_DEBUG_PAD_NAME (realsink)); - return FALSE; - } - if (GST_PAD_PARENT (realsrc) == NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s has no parent, failed", - GST_DEBUG_PAD_NAME (realsrc)); - return FALSE; - } - if (GST_PAD_PARENT (realsink) == NULL) { - GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s has no parent, failed", - GST_DEBUG_PAD_NAME (realsrc)); - return FALSE; - } - - if (!gst_pad_check_schedulers (realsrc, realsink)) { - g_warning ("linking pads with different scheds requires " - "exactly one decoupled element (such as queue)"); - return FALSE; - } + link = gst_pad_link_prepare (srcpad, sinkpad, filtercaps); - g_return_val_if_fail (realsrc != NULL, GST_PAD_LINK_REFUSED); - g_return_val_if_fail (realsink != NULL, GST_PAD_LINK_REFUSED); - - link = gst_pad_link_new (); - - if (GST_RPAD_DIRECTION (realsrc) == GST_PAD_SRC) { - link->srcpad = GST_PAD (realsrc); - link->sinkpad = GST_PAD (realsink); - } else { - link->srcpad = GST_PAD (realsink); - link->sinkpad = GST_PAD (realsrc); - } + if (!link) return FALSE; - if (GST_RPAD_DIRECTION (link->srcpad) != GST_PAD_SRC) { - GST_CAT_INFO (GST_CAT_PADS, "Real src pad %s:%s is not a source pad, failed", - GST_DEBUG_PAD_NAME (link->srcpad)); - gst_pad_link_free (link); - return FALSE; - } - if (GST_RPAD_DIRECTION (link->sinkpad) != GST_PAD_SINK) { - GST_CAT_INFO (GST_CAT_PADS, "Real sink pad %s:%s is not a sink pad, failed", - GST_DEBUG_PAD_NAME (link->sinkpad)); - gst_pad_link_free (link); + if (gst_pad_link_try (link) == GST_PAD_LINK_REFUSED) { + GST_CAT_INFO (GST_CAT_PADS, "could not link %s:%s to %s:%s", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); return FALSE; } - link->srccaps = gst_pad_get_caps (link->srcpad); - link->sinkcaps = gst_pad_get_caps (link->sinkpad); - if (filtercaps) link->filtercaps = gst_caps_copy (filtercaps); - if (gst_pad_link_try (link) == GST_PAD_LINK_REFUSED) - return FALSE; - /* fire off a signal to each of the pads telling them * that they've been linked */ g_signal_emit (G_OBJECT (link->srcpad), gst_real_pad_signals[REAL_LINKED], @@ -1764,15 +1682,14 @@ gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, GST_PAD (link->srcpad), GST_PAD (link->sinkpad)); } else { - GST_CAT_INFO (GST_CAT_PADS, "not telling link to scheduler %s:%s and %s:%s, %p %p", - GST_DEBUG_PAD_NAME (link->srcpad), - GST_DEBUG_PAD_NAME (link->sinkpad), - src_sched, sink_sched); + GST_CAT_LOG (GST_CAT_PADS, "not telling link to scheduler %s:%s and %s:%s, %p %p", + GST_DEBUG_PAD_NAME (link->srcpad), GST_DEBUG_PAD_NAME (link->sinkpad), + src_sched, sink_sched); } - GST_CAT_INFO (GST_CAT_PADS, "linked %s:%s and %s:%s, successful", - GST_DEBUG_PAD_NAME (link->srcpad), - GST_DEBUG_PAD_NAME (link->sinkpad)); + GST_CAT_INFO (GST_CAT_PADS, "sucessfully linked %s:%s and %s:%s", + GST_DEBUG_PAD_NAME (link->srcpad), + GST_DEBUG_PAD_NAME (link->sinkpad)); return TRUE; } diff --git a/gst/gstplugin.c b/gst/gstplugin.c index fcbda6c..5cf5682 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -200,7 +200,7 @@ gst_plugin_register_func (GstPlugin *plugin, GModule *module, GstPluginDesc *des return FALSE; } - if (GST_CAT_DEFAULT) GST_DEBUG ("plugin \"%s\" initialised", GST_STR_NULL (plugin->filename)); + if (GST_CAT_DEFAULT) GST_LOG ("plugin \"%s\" initialised", GST_STR_NULL (plugin->filename)); return plugin; } diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index 2e67fed..f4cf717 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -113,7 +113,7 @@ typedef struct { */ # define YYFPRINTF(a, ...) G_STMT_START{ \ gchar *temp = g_strdup_printf (__VA_ARGS__); \ - GST_CAT_DEBUG (GST_CAT_PIPELINE, temp); \ + GST_CAT_LOG (GST_CAT_PIPELINE, temp); \ g_free (temp); \ }G_STMT_END #endif @@ -138,7 +138,7 @@ typedef struct { */ # define YYFPRINTF(a, args...) G_STMT_START{ \ gchar *temp = g_strdup_printf ( args ); \ - GST_CAT_DEBUG (GST_CAT_PIPELINE, temp); \ + GST_CAT_LOG (GST_CAT_PIPELINE, temp); \ g_free (temp); \ }G_STMT_END #endif @@ -462,9 +462,10 @@ gst_parse_perform_link (link_t *link, graph_t *graph) g_assert (GST_IS_ELEMENT (src)); g_assert (GST_IS_ELEMENT (sink)); - GST_CAT_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u with caps \"%" GST_PTR_FORMAT "\"", - GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs), - GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks), + GST_CAT_INFO (GST_CAT_PIPELINE, "linking %s:%s to %s:%s (%u/%u) with caps \"%" GST_PTR_FORMAT "\"", + GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "(any)", + GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "(any)", + g_slist_length (srcs), g_slist_length (sinks), link->caps); if (!srcs || !sinks) { @@ -791,7 +792,7 @@ static int yyerror (const char *s) { /* FIXME: This should go into the GError somehow, but how? */ - g_warning ("error: %s\n", s); + g_warning ("error: %s", s); return -1; } @@ -830,7 +831,7 @@ _gst_parse_launch (const gchar *str, GError **error) } g_free (dstr); - GST_CAT_INFO (GST_CAT_PIPELINE, "got %u elements and %u links", g.chain ? g_slist_length (g.chain->elements) : 0, g_slist_length (g.links)); + GST_CAT_DEBUG (GST_CAT_PIPELINE, "got %u elements and %u links", g.chain ? g_slist_length (g.chain->elements) : 0, g_slist_length (g.links)); if (!g.chain) { ret = NULL; diff --git a/gst/parse/parse.l b/gst/parse/parse.l index f160d6c..0b9e24a 100644 --- a/gst/parse/parse.l +++ b/gst/parse/parse.l @@ -55,7 +55,7 @@ _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"! {_assignment} { /* "=" */ - PRINT ("ASSIGNMENT: %s\n", yytext); + PRINT ("ASSIGNMENT: %s", yytext); lvalp->s = gst_parse_strdup (yytext); BEGIN (INITIAL); return ASSIGNMENT; @@ -63,14 +63,14 @@ _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"! {_padref} { yytext++; - PRINT ("PADREF: %s\n", yytext); + PRINT ("PADREF: %s", yytext); lvalp->s = gst_parse_strdup (yytext); BEGIN (INITIAL); return PADREF; } {_ref} { - PRINT ("REF: %s\n", yytext); + PRINT ("REF: %s", yytext); lvalp->s = gst_parse_strdup (yytext); BEGIN (INITIAL); return REF; @@ -80,14 +80,14 @@ _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"! gchar *pos = yytext; while (!g_ascii_isspace (*pos) && (*pos != '.')) pos++; *pos = '\0'; - PRINT ("BINREF: %s\n", yytext); + PRINT ("BINREF: %s", yytext); lvalp->s = gst_parse_strdup (yytext); BEGIN (INITIAL); return BINREF; } {_identifier} { - PRINT ("IDENTIFIER: %s\n", yytext); + PRINT ("IDENTIFIER: %s", yytext); lvalp->s = gst_parse_strdup (yytext); BEGIN (INITIAL); return IDENTIFIER; @@ -95,7 +95,7 @@ _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"! {_link} { gchar *c = yytext; - PRINT ("LINK: %s\n", yytext); + PRINT ("LINK: %s", yytext); c++; if (*c) { while (g_ascii_isspace (*c)) c++; @@ -111,7 +111,7 @@ _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"! return LINK; } {_url} { - PRINT ("URL: %s\n", yytext); + PRINT ("URL: %s", yytext); if (gst_uri_is_valid (yytext)) { lvalp->s = g_strdup (yytext); } else { @@ -122,9 +122,9 @@ _link ("!"[[:space:]]*{_caps}([[:space:]]*";"[[:space:]]*{_caps})*[[:space:]]*"! return PARSE_URL; } -{_operator} { PRINT ("OPERATOR: [%s]\n", yytext); return *yytext; } +{_operator} { PRINT ("OPERATOR: [%s]", yytext); return *yytext; } -[[:space:]]+ { PRINT ("SPACE: [%s]\n", yytext); } +[[:space:]]+ { PRINT ("SPACE: [%s]", yytext); } . { printf ("???: %s\n", yytext); diff --git a/gst/registries/gstxmlregistry.c b/gst/registries/gstxmlregistry.c index 6af8441..f7fb670 100644 --- a/gst/registries/gstxmlregistry.c +++ b/gst/registries/gstxmlregistry.c @@ -461,9 +461,9 @@ plugin_times_older_than(GList *paths, time_t regtime) */ while (paths) { - GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, - "comparing plugin times from %s with %ld\n", - (gchar *)paths->data, (long) regtime); + GST_CAT_LOG (GST_CAT_PLUGIN_LOADING, + "comparing plugin times from %s with %ld", + (gchar *)paths->data, (long) regtime); if(!plugin_times_older_than_recurse(paths->data, regtime)) return FALSE; paths = g_list_next(paths); @@ -619,8 +619,8 @@ gst_xml_registry_load (GstRegistry *registry) seconds = g_timer_elapsed (timer, NULL); g_timer_destroy (timer); - GST_INFO ( "registry: loaded %s in %f seconds\n (%s)", - registry->name, seconds, xmlregistry->location); + GST_INFO ("loaded %s in %f seconds (%s)", + registry->name, seconds, xmlregistry->location); CLASS (xmlregistry)->close_func (xmlregistry); diff --git a/gst/schedulers/gstoptimalscheduler.c b/gst/schedulers/gstoptimalscheduler.c index 374890a..187d3cc 100644 --- a/gst/schedulers/gstoptimalscheduler.c +++ b/gst/schedulers/gstoptimalscheduler.c @@ -384,7 +384,7 @@ destroy_chain (GstOptSchedulerChain *chain) { GstOptScheduler *osched; - GST_INFO ( "destroy chain %p", chain); + GST_LOG ( "destroy chain %p", chain); g_assert (chain->num_groups == 0); g_assert (chain->groups == NULL); @@ -410,7 +410,7 @@ create_chain (GstOptScheduler *osched) gst_object_ref (GST_OBJECT (osched)); osched->chains = g_slist_prepend (osched->chains, chain); - GST_INFO ( "new chain %p", chain); + GST_LOG ( "new chain %p", chain); return chain; } @@ -442,7 +442,7 @@ unref_chain (GstOptSchedulerChain *chain) static GstOptSchedulerChain* add_to_chain (GstOptSchedulerChain *chain, GstOptSchedulerGroup *group) { - GST_INFO ( "adding group %p to chain %p", group, chain); + GST_LOG ( "adding group %p to chain %p", group, chain); g_assert (group->chain == NULL); @@ -462,7 +462,7 @@ add_to_chain (GstOptSchedulerChain *chain, GstOptSchedulerGroup *group) static GstOptSchedulerChain* remove_from_chain (GstOptSchedulerChain *chain, GstOptSchedulerGroup *group) { - GST_INFO ( "removing group %p from chain %p", group, chain); + GST_LOG ( "removing group %p from chain %p", group, chain); if (!chain) return NULL; @@ -489,7 +489,7 @@ merge_chains (GstOptSchedulerChain *chain1, GstOptSchedulerChain *chain2) g_assert (chain1 != NULL); - GST_INFO ( "merging chain %p and %p", chain1, chain2); + GST_LOG ("merging chain %p and %p", chain1, chain2); if (chain1 == chain2 || chain2 == NULL) return chain1; @@ -500,8 +500,8 @@ merge_chains (GstOptSchedulerChain *chain1, GstOptSchedulerChain *chain2) GstOptSchedulerGroup *group = (GstOptSchedulerGroup *) walk->data; walk = g_slist_next (walk); - GST_INFO ( "reparenting group %p from chain %p to %p", - group, chain2, chain1); + GST_LOG ("reparenting group %p from chain %p to %p", + group, chain2, chain1); group->chain = NULL; chain2->num_groups--; @@ -524,8 +524,8 @@ chain_group_set_enabled (GstOptSchedulerChain *chain, GstOptSchedulerGroup *grou g_assert (chain != NULL); g_assert (group != NULL); - GST_INFO ( "request to %d group %p in chain %p, have %d groups enabled out of %d", - enabled, group, chain, chain->num_enabled, chain->num_groups); + GST_LOG ("request to %d group %p in chain %p, have %d groups enabled out of %d", + enabled, group, chain, chain->num_enabled, chain->num_groups); if (enabled) GST_OPT_SCHEDULER_GROUP_ENABLE (group); @@ -536,11 +536,11 @@ chain_group_set_enabled (GstOptSchedulerChain *chain, GstOptSchedulerGroup *grou if (chain->num_enabled < chain->num_groups) chain->num_enabled++; - GST_INFO ( "enable group %p in chain %p, now %d groups enabled out of %d", group, chain, - chain->num_enabled, chain->num_groups); + GST_DEBUG ("enable group %p in chain %p, now %d groups enabled out of %d", group, chain, + chain->num_enabled, chain->num_groups); if (chain->num_enabled == chain->num_groups) { - GST_INFO ( "enable chain %p", chain); + GST_DEBUG ("enable chain %p", chain); GST_OPT_SCHEDULER_CHAIN_ENABLE (chain); } } @@ -548,11 +548,11 @@ chain_group_set_enabled (GstOptSchedulerChain *chain, GstOptSchedulerGroup *grou if (chain->num_enabled > 0) chain->num_enabled--; - GST_INFO ( "disable group %p in chain %p, now %d groups enabled out of %d", group, chain, - chain->num_enabled, chain->num_groups); + GST_DEBUG ("disable group %p in chain %p, now %d groups enabled out of %d", group, chain, + chain->num_enabled, chain->num_groups); if (chain->num_enabled == 0) { - GST_INFO ( "disable chain %p", chain); + GST_DEBUG ("disable chain %p", chain); GST_OPT_SCHEDULER_CHAIN_DISABLE (chain); } } @@ -629,11 +629,11 @@ add_to_group (GstOptSchedulerGroup *group, GstElement *element) g_assert (group != NULL); g_assert (element != NULL); - GST_INFO ( "adding element \"%s\" to group %p", GST_ELEMENT_NAME (element), group); + GST_DEBUG ("adding element \"%s\" to group %p", GST_ELEMENT_NAME (element), group); if (GST_ELEMENT_IS_DECOUPLED (element)) { - GST_INFO ( "element \"%s\" is decoupled, not adding to group %p", - GST_ELEMENT_NAME (element), group); + GST_DEBUG ("element \"%s\" is decoupled, not adding to group %p", + GST_ELEMENT_NAME (element), group); return group; } @@ -661,7 +661,7 @@ create_group (GstOptSchedulerChain *chain, GstElement *element) GstOptSchedulerGroup *group; group = g_new0 (GstOptSchedulerGroup, 1); - GST_INFO ( "new group %p", group); + GST_LOG ("new group %p", group); group->refcount = 1; group->flags = GST_OPT_SCHEDULER_GROUP_DISABLED; @@ -696,7 +696,7 @@ destroy_group_scheduler (GstOptSchedulerGroup *group) static void destroy_group (GstOptSchedulerGroup *group) { - GST_INFO ( "destroy group %p", group); + GST_LOG ("destroy group %p", group); g_assert (group != NULL); g_assert (group->elements == NULL); @@ -712,7 +712,7 @@ destroy_group (GstOptSchedulerGroup *group) static GstOptSchedulerGroup* remove_from_group (GstOptSchedulerGroup *group, GstElement *element) { - GST_INFO ( "removing element \"%s\" from group %p", GST_ELEMENT_NAME (element), group); + GST_DEBUG ("removing element \"%s\" from group %p", GST_ELEMENT_NAME (element), group); g_assert (group != NULL); g_assert (element != NULL); @@ -743,7 +743,7 @@ merge_groups (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) { g_assert (group1 != NULL); - GST_INFO ( "merging groups %p and %p", group1, group2); + GST_DEBUG ("merging groups %p and %p", group1, group2); if (group1 == group2 || group2 == NULL) return group1; @@ -761,7 +761,7 @@ merge_groups (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) static void group_error_handler (GstOptSchedulerGroup *group) { - GST_INFO ( "group %p has errored", group); + GST_DEBUG ("group %p has errored", group); chain_group_set_enabled (group->chain, group, FALSE); group->chain->sched->state = GST_OPT_SCHEDULER_STATE_ERROR; @@ -776,18 +776,18 @@ group_element_set_enabled (GstOptSchedulerGroup *group, GstElement *element, gbo g_assert (group != NULL); g_assert (element != NULL); - GST_INFO ( "request to %d element %s in group %p, have %d elements enabled out of %d", - enabled, GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); + GST_LOG ("request to %d element %s in group %p, have %d elements enabled out of %d", + enabled, GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); if (enabled) { if (group->num_enabled < group->num_elements) group->num_enabled++; - GST_INFO ( "enable element %s in group %p, now %d elements enabled out of %d", - GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); + GST_DEBUG ("enable element %s in group %p, now %d elements enabled out of %d", + GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); if (group->num_enabled == group->num_elements) { - GST_INFO ( "enable group %p", group); + GST_LOG ("enable group %p", group); chain_group_set_enabled (group->chain, group, TRUE); } } @@ -795,11 +795,11 @@ group_element_set_enabled (GstOptSchedulerGroup *group, GstElement *element, gbo if (group->num_enabled > 0) group->num_enabled--; - GST_INFO ( "disable element %s in group %p, now %d elements enabled out of %d", - GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); + GST_DEBUG ("disable element %s in group %p, now %d elements enabled out of %d", + GST_ELEMENT_NAME (element), group, group->num_enabled, group->num_elements); if (group->num_enabled == 0) { - GST_INFO ( "disable group %p", group); + GST_LOG ("disable group %p", group); chain_group_set_enabled (group->chain, group, FALSE); } } @@ -813,7 +813,7 @@ static gboolean schedule_group (GstOptSchedulerGroup *group) { if (!group->entry) { - GST_INFO ( "not scheduling group %p without entry", group); + GST_INFO ("not scheduling group %p without entry", group); return FALSE; } @@ -827,8 +827,7 @@ schedule_group (GstOptSchedulerGroup *group) /* cothreads automatically call the pre- and post-run functions for us; * without cothreads we need to call them manually */ if (group->schedulefunc == NULL) { - GST_INFO ( "not scheduling group %p without schedulefunc", - group); + GST_INFO ("not scheduling group %p without schedulefunc", group); return FALSE; } else { GSList *l; @@ -959,8 +958,8 @@ get_group_schedule_function (int argc, char *argv[]) if (!GST_PAD_IS_SRC (pad) || !GST_IS_REAL_PAD (pad)) continue; - GST_LOG ("doing get and push on pad \"%s:%s\" in group %p", - GST_DEBUG_PAD_NAME (pad), group); + GST_DEBUG ("doing get and push on pad \"%s:%s\" in group %p", + GST_DEBUG_PAD_NAME (pad), group); data = GST_RPAD_GETFUNC (pad) (pad); if (data) { @@ -991,8 +990,8 @@ loop_group_schedule_function (int argc, char *argv[]) group->flags |= GST_OPT_SCHEDULER_GROUP_RUNNING; - GST_LOG ("calling loopfunc of element %s in group %p", - GST_ELEMENT_NAME (entry), group); + GST_DEBUG ("calling loopfunc of element %s in group %p", + GST_ELEMENT_NAME (entry), group); entry->loopfunc (entry); @@ -1124,7 +1123,7 @@ gst_opt_scheduler_get_wrapper (GstPad *srcpad) /* if the scheduler interrupted, make sure we send an INTERRUPTED event to the * loop based element */ if (osched->state == GST_OPT_SCHEDULER_STATE_INTERRUPTED) { - GST_INFO ( "scheduler interrupted, return interrupt event"); + GST_INFO ("scheduler interrupted, return interrupt event"); data = GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); } else { @@ -1171,7 +1170,7 @@ pad_clear_queued (GstPad *srcpad, gpointer user_data) GList *buflist = GST_PAD_BUFLIST (srcpad); if (buflist) { - GST_INFO ( "need to clear some buffers"); + GST_LOG ("need to clear some buffers"); g_list_foreach (buflist, (GFunc) clear_queued, NULL); g_list_free (buflist); GST_PAD_BUFLIST (srcpad) = NULL; @@ -1183,8 +1182,8 @@ gst_opt_scheduler_event_wrapper (GstPad *srcpad, GstEvent *event) { gboolean flush; - GST_LOG ("intercepting event %d on pad %s:%s", - GST_EVENT_TYPE (event), GST_DEBUG_PAD_NAME (srcpad)); + GST_DEBUG ("intercepting event %d on pad %s:%s", + GST_EVENT_TYPE (event), GST_DEBUG_PAD_NAME (srcpad)); /* figure out if this is a flush event */ switch (GST_EVENT_TYPE (event)) { @@ -1249,24 +1248,24 @@ gst_opt_scheduler_state_transition (GstScheduler *sched, GstElement *element, gi GstOptSchedulerGroup *group; GstElementStateReturn res = GST_STATE_SUCCESS; - GST_INFO ( "element \"%s\" state change %d", GST_ELEMENT_NAME (element), transition); + GST_DEBUG ("element \"%s\" state change %d", GST_ELEMENT_NAME (element), transition); /* we check the state of the managing pipeline here */ if (GST_IS_BIN (element)) { if (GST_SCHEDULER_PARENT (sched) == element) { - GST_INFO ( "parent \"%s\" changed state", GST_ELEMENT_NAME (element)); + GST_LOG ("parent \"%s\" changed state", GST_ELEMENT_NAME (element)); switch (transition) { case GST_STATE_PLAYING_TO_PAUSED: - GST_INFO ( "setting scheduler state to stopped"); + GST_INFO ("setting scheduler state to stopped"); GST_SCHEDULER_STATE (sched) = GST_SCHEDULER_STATE_STOPPED; break; case GST_STATE_PAUSED_TO_PLAYING: - GST_INFO ( "setting scheduler state to running"); + GST_INFO ("setting scheduler state to running"); GST_SCHEDULER_STATE (sched) = GST_SCHEDULER_STATE_RUNNING; break; default: - GST_INFO ( "no interesting state change, doing nothing"); + GST_LOG ("no interesting state change, doing nothing"); } } return res; @@ -1284,7 +1283,7 @@ gst_opt_scheduler_state_transition (GstScheduler *sched, GstElement *element, gi /* an element withut a group has to be an unlinked src, sink * filter element */ if (!group) { - GST_INFO ( "element \"%s\" has no group", GST_ELEMENT_NAME (element)); + GST_INFO ("element \"%s\" has no group", GST_ELEMENT_NAME (element)); res = GST_STATE_FAILURE; } /* else construct the scheduling context of this group and enable it */ @@ -1353,8 +1352,8 @@ group_elements (GstOptScheduler *osched, GstElement *element1, GstElement *eleme if (!group1 && !group2) { GstOptSchedulerChain *chain; - GST_INFO ( "creating new group to hold \"%s\" and \"%s\"", - GST_ELEMENT_NAME (element1), GST_ELEMENT_NAME (element2)); + GST_DEBUG ("creating new group to hold \"%s\" and \"%s\"", + GST_ELEMENT_NAME (element1), GST_ELEMENT_NAME (element2)); chain = create_chain (osched); group = create_group (chain, element1); @@ -1362,8 +1361,8 @@ group_elements (GstOptScheduler *osched, GstElement *element1, GstElement *eleme } /* the first element has a group */ else if (group1) { - GST_INFO ( "adding \"%s\" to \"%s\"'s group", - GST_ELEMENT_NAME (element2), GST_ELEMENT_NAME (element1)); + GST_DEBUG ("adding \"%s\" to \"%s\"'s group", + GST_ELEMENT_NAME (element2), GST_ELEMENT_NAME (element1)); /* the second element also has a group, merge */ if (group2) @@ -1378,8 +1377,8 @@ group_elements (GstOptScheduler *osched, GstElement *element1, GstElement *eleme /* element1 has no group, element2 does. Add element1 to the * group of element2 */ else { - GST_INFO ( "adding \"%s\" to \"%s\"'s group", - GST_ELEMENT_NAME (element1), GST_ELEMENT_NAME (element2)); + GST_DEBUG ("adding \"%s\" to \"%s\"'s group", + GST_ELEMENT_NAME (element1), GST_ELEMENT_NAME (element2)); add_to_group (group2, element1); group = group2; } @@ -1404,8 +1403,8 @@ group_inc_link (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) if (IS_GROUP_LINK (link, group1, group2)) { /* we found a link to this group, increment the link count */ link->count++; - GST_INFO ( "incremented group link count between %p and %p to %d", - group1, group2, link->count); + GST_LOG ("incremented group link count between %p and %p to %d", + group1, group2, link->count); done = TRUE; } } @@ -1420,8 +1419,8 @@ group_inc_link (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) group1->group_links = g_slist_prepend (group1->group_links, link); group2->group_links = g_slist_prepend (group2->group_links, link); - GST_INFO ( "added group link count between %p and %p", - group1, group2); + GST_DEBUG ("added group link between %p and %p", + group1, group2); } } @@ -1441,14 +1440,14 @@ group_dec_link (GstOptSchedulerGroup *group1, GstOptSchedulerGroup *group2) if (IS_GROUP_LINK (link, group1, group2)) { link->count--; - GST_INFO ( "link count between %p and %p is now %d", - group1, group2, link->count); + GST_LOG ("link count between %p and %p is now %d", + group1, group2, link->count); if (link->count == 0) { group1->group_links = g_slist_remove (group1->group_links, link); group2->group_links = g_slist_remove (group2->group_links, link); g_free (link); - GST_INFO ( "removed group link between %p and %p", - group1, group2); + GST_DEBUG ("removed group link between %p and %p", + group1, group2); res = TRUE; } break; @@ -1479,7 +1478,7 @@ gst_opt_scheduler_setup (GstScheduler *sched) /* first create thread context */ if (osched->context == NULL) { - GST_DEBUG ( "initializing cothread context"); + GST_DEBUG ("initializing cothread context"); osched->context = do_cothread_context_init (); } #endif @@ -1518,7 +1517,7 @@ gst_opt_scheduler_add_element (GstScheduler *sched, GstElement *element) GstOptSchedulerCtx *ctx; const GList *pads; - GST_INFO ( "adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element)); + GST_DEBUG_OBJECT (sched, "adding element \"%s\"", GST_OBJECT_NAME (element)); /* decoupled elements are not added to the scheduler lists */ if (GST_ELEMENT_IS_DECOUPLED (element)) @@ -1553,7 +1552,7 @@ gst_opt_scheduler_add_element (GstScheduler *sched, GstElement *element) group->entry = element; group->type = GST_OPT_SCHEDULER_GROUP_LOOP; - GST_INFO ( "added element \"%s\" as loop based entry", GST_ELEMENT_NAME (element)); + GST_LOG ("added element \"%s\" as loop based entry", GST_ELEMENT_NAME (element)); } } @@ -1562,7 +1561,7 @@ gst_opt_scheduler_remove_element (GstScheduler *sched, GstElement *element) { GstOptSchedulerGroup *group; - GST_INFO ( "removing element \"%s\" from scheduler", GST_ELEMENT_NAME (element)); + GST_DEBUG_OBJECT (sched, "removing element \"%s\"", GST_OBJECT_NAME (element)); /* decoupled elements are not added to the scheduler lists and should therefore * no be removed */ @@ -1615,8 +1614,8 @@ gst_opt_scheduler_yield (GstScheduler *sched, GstElement *element) static gboolean gst_opt_scheduler_interrupt (GstScheduler *sched, GstElement *element) { - GST_INFO ( "interrupt from \"%s\"", - GST_ELEMENT_NAME (element)); + GST_INFO ("interrupt from \"%s\"", + GST_OBJECT_NAME (element)); #ifdef USE_COTHREADS do_cothread_switch (do_cothread_get_main (((GstOptScheduler*)sched)->context)); @@ -1625,7 +1624,7 @@ gst_opt_scheduler_interrupt (GstScheduler *sched, GstElement *element) { GstOptScheduler *osched = GST_OPT_SCHEDULER (sched); - GST_INFO ( "scheduler set interrupted state"); + GST_INFO ("scheduler set interrupted state"); osched->state = GST_OPT_SCHEDULER_STATE_INTERRUPTED; } return TRUE; @@ -1652,8 +1651,8 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad LinkType type = GST_OPT_INVALID; GstElement *element1, *element2; - GST_INFO ( "pad link between \"%s:%s\" and \"%s:%s\"", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); + GST_INFO ("scheduling link between %s:%s and %s:%s", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); element1 = GST_PAD_PARENT (srcpad); element2 = GST_PAD_PARENT (sinkpad); @@ -1723,7 +1722,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad { GstOptSchedulerGroup *group = NULL; - GST_INFO ( "get to chain based link"); + GST_LOG ("get to chain based link"); /* setup get/chain handlers */ GST_RPAD_GETHANDLER (srcpad) = GST_RPAD_GETFUNC (srcpad); @@ -1742,14 +1741,14 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad group->entry = element1; group->type = GST_OPT_SCHEDULER_GROUP_GET; - GST_INFO ( "setting \"%s\" as entry point of _get-based group %p", - GST_ELEMENT_NAME (element1), group); + GST_DEBUG ("setting \"%s\" as entry point of _get-based group %p", + GST_ELEMENT_NAME (element1), group); } break; } case GST_OPT_LOOP_TO_CHAIN: case GST_OPT_CHAIN_TO_CHAIN: - GST_INFO ( "loop/chain to chain based link"); + GST_LOG ("loop/chain to chain based link"); if (GST_ELEMENT_IS_EVENT_AWARE (element2)) GST_RPAD_CHAINHANDLER (sinkpad) = GST_RPAD_CHAINFUNC (sinkpad); @@ -1763,7 +1762,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad group_elements (osched, element1, element2); break; case GST_OPT_GET_TO_LOOP: - GST_INFO ( "get to loop based link"); + GST_LOG ("get to loop based link"); GST_RPAD_GETHANDLER (srcpad) = GST_RPAD_GETFUNC (srcpad); @@ -1778,7 +1777,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad { GstOptSchedulerGroup *group1, *group2; - GST_INFO ( "chain/loop to loop based link"); + GST_LOG ("chain/loop to loop based link"); GST_RPAD_CHAINHANDLER (sinkpad) = gst_opt_scheduler_loop_wrapper; GST_RPAD_GETHANDLER (srcpad) = gst_opt_scheduler_get_wrapper; @@ -1796,7 +1795,7 @@ gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad if (!group1) { /* create a new group for element1 as it cannot be merged into another group * here. we create the group in the same chain as the loop-based element. */ - GST_INFO ( "creating new group for element %s", GST_ELEMENT_NAME (element1)); + GST_DEBUG ("creating new group for element %s", GST_ELEMENT_NAME (element1)); group1 = create_group (group2->chain, element1); } else { @@ -1867,18 +1866,18 @@ group_can_reach_group (GstOptSchedulerGroup *group, GstOptSchedulerGroup *target gboolean reachable = FALSE; const GSList *links = group->group_links; - GST_INFO ( "checking if group %p can reach %p", - group, target); + GST_LOG ("checking if group %p can reach %p", + group, target); /* seems like we found the target element */ if (group == target) { - GST_INFO ( "found way to reach %p", target); + GST_LOG ("found way to reach %p", target); return TRUE; } /* if the group is marked as visited, we don't need to check here */ if (GST_OPT_SCHEDULER_GROUP_IS_FLAG_SET (group, GST_OPT_SCHEDULER_GROUP_VISITED)) { - GST_INFO ( "already visited %p", group); + GST_LOG ("already visited %p", group); return FALSE; } @@ -1894,8 +1893,8 @@ group_can_reach_group (GstOptSchedulerGroup *group, GstOptSchedulerGroup *target /* find other group in this link */ other = OTHER_GROUP_LINK (link, group); - GST_INFO ( "found link from %p to %p, count %d", - group, other, link->count); + GST_LOG ("found link from %p to %p, count %d", + group, other, link->count); /* check if we can reach the target recursiveley */ reachable = group_can_reach_group (other, target); @@ -1906,7 +1905,7 @@ group_can_reach_group (GstOptSchedulerGroup *group, GstOptSchedulerGroup *target * all groups are checked. */ GST_OPT_SCHEDULER_GROUP_UNSET_FLAG (group, GST_OPT_SCHEDULER_GROUP_VISITED); - GST_INFO ( "leaving group %p with %s", group, (reachable ? "TRUE":"FALSE")); + GST_LOG ("leaving group %p with %s", group, (reachable ? "TRUE":"FALSE")); return reachable; } @@ -1918,8 +1917,8 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp GstElement *element1, *element2; GstOptSchedulerGroup *group1, *group2; - GST_INFO ( "pad unlink between \"%s:%s\" and \"%s:%s\"", - GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); + GST_INFO ("unscheduling link between %s:%s and %s:%s", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad)); element1 = GST_PAD_PARENT (srcpad); element2 = GST_PAD_PARENT (sinkpad); @@ -1939,7 +1938,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* if one the elements has no group (anymore) we don't really care * about the link */ if (!group1 || !group2) { - GST_INFO ( "one (or both) of the elements is not in a group, not interesting"); + GST_LOG ("one (or both) of the elements is not in a group, not interesting"); return; } @@ -1947,7 +1946,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp if (group1 != group2) { gboolean zero; - GST_INFO ( "elements are in different groups"); + GST_LOG ("elements are in different groups"); /* we can remove the links between the groups now */ zero = group_dec_link (group1, group2); @@ -1961,17 +1960,17 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* see if group1 and group2 are still connected in any indirect way */ still_link = group_can_reach_group (group1, group2); - GST_INFO ( "group %p %s reach group %p", group1, (still_link ? "can":"can't"), group2); + GST_DEBUG ("group %p %s reach group %p", group1, (still_link ? "can":"can't"), group2); if (!still_link) { /* groups are really disconnected, migrate one group to a new chain */ chain = create_chain (osched); chain_recursively_migrate_group (chain, group1); - GST_INFO ( "migrated group %p to new chain %p", group1, chain); + GST_DEBUG ("migrated group %p to new chain %p", group1, chain); } } else { - GST_INFO ( "group %p still has direct link with group %p", group1, group2); + GST_DEBUG ("group %p still has direct link with group %p", group1, group2); } } /* hard part, groups are equal */ @@ -1982,7 +1981,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* since group1 == group2, it doesn't matter which group we take */ group = group1; - GST_INFO ( "elements are in the same group %p", group); + GST_LOG ("elements are in the same group %p", group); /* check if the element is still linked to some other element in the group, * we pass the pad that is broken up as an arg because a link on that pad @@ -1995,7 +1994,7 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp /* if there is still a link, we don't need to break this group */ if (still_link1 && still_link2) { - GST_INFO ( "elements still have links with other elements in the group"); + GST_LOG ( "elements still have links with other elements in the group"); /* FIXME it's possible that we have to break the group/chain. This heppens when * the src element recursiveley has links with other elements in the group but not * with all elements. */ @@ -2011,11 +2010,11 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp group->type == GST_OPT_SCHEDULER_GROUP_LOOP) && !GST_ELEMENT_IS_DECOUPLED (element1)) { - GST_INFO ( "element1 is separated from the group"); + GST_LOG ("element1 is separated from the group"); remove_from_group (group, element1); } else { - GST_INFO ( "element1 is decoupled or entry in loop based group"); + GST_LOG ("element1 is decoupled or entry in loop based group"); } } if (!still_link2) { @@ -2025,11 +2024,11 @@ gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp group->type == GST_OPT_SCHEDULER_GROUP_LOOP) && !GST_ELEMENT_IS_DECOUPLED (element2)) { - GST_INFO ( "element2 is separated from the group"); + GST_LOG ("element2 is separated from the group"); remove_from_group (group, element2); } else { - GST_INFO ( "element2 is decoupled or entry in loop based group"); + GST_LOG ("element2 is decoupled or entry in loop based group"); } } } @@ -2053,6 +2052,8 @@ gst_opt_scheduler_iterate (GstScheduler *sched) osched->state = GST_OPT_SCHEDULER_STATE_RUNNING; + GST_DEBUG ("iterating scheduler %p", sched); + while (iterations) { gboolean scheduled = FALSE; GSList *chains;