summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2014-03-11 21:44:39 +0000
committerJan Schmidt <jan@centricular.com>2015-11-10 11:54:09 +1100
commit7e0c130a3bab303dfa429a13234fddb5cb8e15fa (patch)
treed35d7964e98488dc4de9493932938772f5495fa6
parent5020aaa0d00bef0ba481292eee9ec472c7c7d921 (diff)
pad: simplify gst_pad_link_get_name() and fix Since markerSTREAMS_BACKPORT_START
Has added benefit that compiler might warn if more values are added to the enum.
-rw-r--r--gst/gstpad.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 1a1ef6f5c..597681bf6 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -260,17 +260,28 @@ gst_flow_to_quark (GstFlowReturn ret)
*
* Returns: a static string with the name of the pad-link return.
*
- * Since: 1.3.1
+ * Since: 1.4
*/
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];
+ switch (ret) {
+ case GST_PAD_LINK_OK:
+ return "ok";
+ case GST_PAD_LINK_WRONG_HIERARCHY:
+ return "wrong hierarchy";
+ case GST_PAD_LINK_WAS_LINKED:
+ return "was linked";
+ case GST_PAD_LINK_WRONG_DIRECTION:
+ return "wrong direction";
+ case GST_PAD_LINK_NOFORMAT:
+ return "no common format";
+ case GST_PAD_LINK_NOSCHED:
+ return "incompatible scheduling";
+ case GST_PAD_LINK_REFUSED:
+ return "refused";
+ }
+ g_return_val_if_reached ("unknown");
}
#define _do_init \