mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 20:25:25 +00:00
pad: simplify gst_pad_link_get_name() and fix Since marker
Has added benefit that compiler might warn if more values are added to the enum.
This commit is contained in:
parent
4a38acaa10
commit
075cc42f88
1 changed files with 18 additions and 7 deletions
25
gst/gstpad.c
25
gst/gstpad.c
|
@ -259,17 +259,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 \
|
||||
|
|
Loading…
Reference in a new issue