pad: add debug helper for GstPadLinkReturn names

Add a helper like gst_flow_get_name() for GstPadLinkReturn. Use this in core.
API: gst_pad_link_get_name()
This commit is contained in:
Stefan Sauer 2014-03-11 21:46:14 +01:00
parent 6d20be1702
commit 4a38acaa10
5 changed files with 31 additions and 6 deletions

View file

@ -1735,6 +1735,7 @@ GstPad
GstPadDirection
GstPadFlags
GstPadLinkReturn
gst_pad_link_get_name
GST_PAD_LINK_FAILED
GST_PAD_LINK_SUCCESSFUL
GstPadLinkCheck

View file

@ -869,8 +869,8 @@ gst_ghost_pad_set_target (GstGhostPad * gpad, GstPad * newtarget)
/* ERRORS */
link_failed:
{
GST_WARNING_OBJECT (gpad, "could not link internal and target, reason:%d",
lret);
GST_WARNING_OBJECT (gpad, "could not link internal and target, reason:%s",
gst_pad_link_get_name (lret));
return FALSE;
}
}

View file

@ -251,6 +251,27 @@ gst_flow_to_quark (GstFlowReturn ret)
return 0;
}
/**
* gst_pad_link_get_name:
* @ret: a #GstPadLinkReturn to get the name of.
*
* Gets a string representing the given pad-link return.
*
* Returns: a static string with the name of the pad-link return.
*
* Since: 1.3.1
*/
const gchar *
gst_pad_link_get_name (GstPadLinkReturn ret)
{
static const gchar *names[(-(GST_PAD_LINK_REFUSED)) + 1] = {
"ok", "wrong hierarchy", "was linked", "wrong direction", "no format",
"incompatible scheduling", "refused"
};
ret = CLAMP (ret, GST_PAD_LINK_REFUSED, GST_PAD_LINK_OK);
return names[-ret];
}
#define _do_init \
{ \
gint i; \
@ -2352,8 +2373,9 @@ concurrent_link:
}
link_failed:
{
GST_CAT_INFO (GST_CAT_PADS, "link between %s:%s and %s:%s failed",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
GST_CAT_INFO (GST_CAT_PADS, "link between %s:%s and %s:%s failed: %s",
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad),
gst_pad_link_get_name (result));
GST_PAD_PEER (srcpad) = NULL;
GST_PAD_PEER (sinkpad) = NULL;

View file

@ -179,8 +179,9 @@ typedef enum {
GST_FLOW_CUSTOM_ERROR_2 = -102
} GstFlowReturn;
const gchar* gst_flow_get_name (GstFlowReturn ret);
GQuark gst_flow_to_quark (GstFlowReturn ret);
const gchar* gst_flow_get_name (GstFlowReturn ret);
GQuark gst_flow_to_quark (GstFlowReturn ret);
const gchar* gst_pad_link_get_name (GstPadLinkReturn ret);
/**
* GstPadLinkCheck:

View file

@ -752,6 +752,7 @@ EXPORTS
gst_pad_iterate_internal_links_default
gst_pad_link
gst_pad_link_check_get_type
gst_pad_link_get_name
gst_pad_link_full
gst_pad_link_return_get_type
gst_pad_mark_reconfigure