utils: Add a function to get a string representation of GstStateChange

API:
    gst_state_change_get_name

https://bugzilla.gnome.org/show_bug.cgi?id=783798
This commit is contained in:
Thibault Saunier 2017-06-14 17:12:32 -04:00
parent 54e16cc34e
commit 3a1f2c22dc
3 changed files with 44 additions and 0 deletions

View file

@ -929,6 +929,7 @@ gst_element_state_get_name
gst_element_state_change_return_get_name
gst_element_sync_state_with_parent
gst_element_change_state
gst_state_change_get_name
<SUBSECTION element-messages>
gst_element_message_full

View file

@ -1257,6 +1257,46 @@ gst_element_state_change_return_get_name (GstStateChangeReturn state_ret)
}
}
/**
* gst_state_change_get_name:
* @transition: a #GstStateChange to get the name of.
*
* Gets a string representing the given state transition.
*
* Returns: (transfer none): a string with the name of the state
* result.
*
* Since: 1.14
*/
const gchar *
gst_state_change_get_name (GstStateChange transition)
{
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
return "NULL->READY";
case GST_STATE_CHANGE_READY_TO_PAUSED:
return "READY->PAUSED";
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
return "PAUSED->PLAYING";
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
return "PLAYING->PAUSED";
case GST_STATE_CHANGE_PAUSED_TO_READY:
return "PAUSED->READY";
case GST_STATE_CHANGE_READY_TO_NULL:
return "READY->NULL";
case GST_STATE_CHANGE_NULL_TO_NULL:
return "NULL->NULL";
case GST_STATE_CHANGE_READY_TO_READY:
return "READY->READY";
case GST_STATE_CHANGE_PAUSED_TO_PAUSED:
return "PAUSED->PAUSED";
case GST_STATE_CHANGE_PLAYING_TO_PLAYING:
return "PLAYING->PLAYING";
}
return "Unknown state return";
}
static gboolean
gst_element_factory_can_accept_all_caps_in_direction (GstElementFactory *

View file

@ -965,6 +965,9 @@ const gchar* gst_element_state_get_name (GstState state);
GST_EXPORT
const gchar * gst_element_state_change_return_get_name (GstStateChangeReturn state_ret);
GST_EXPORT
const gchar * gst_state_change_get_name (GstStateChange transition);
GST_EXPORT
gboolean gst_element_link (GstElement *src, GstElement *dest);