diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2013-03-15 00:47:47 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2013-03-15 09:29:55 +0000 |
commit | 07e6ae99f1d2df4d19ffb78e26ea7617b60bbd65 (patch) | |
tree | d5b4ad03547da30a0968aa6d7532e1f9ad670b4c | |
parent | 118345eef55cf8d36bac804f993ac4aca23d48b0 (diff) | |
download | gst-omx-07e6ae99f1d2df4d19ffb78e26ea7617b60bbd65.tar.gz |
omx: log states as strings
-rw-r--r-- | omx/gstomx.c | 35 | ||||
-rw-r--r-- | omx/gstomx.h | 1 |
2 files changed, 32 insertions, 4 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c index 0309e37..692fb70 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -218,8 +218,8 @@ gst_omx_component_handle_messages (GstOMXComponent * comp) switch (msg->type) { case GST_OMX_MESSAGE_STATE_SET:{ - GST_INFO_OBJECT (comp->parent, "%s state change to %d finished", - comp->name, msg->content.state_set.state); + GST_INFO_OBJECT (comp->parent, "%s state change to %s finished", + comp->name, gst_omx_state_to_string (msg->content.state_set.state)); comp->state = msg->content.state_set.state; if (comp->state == comp->pending_state) comp->pending_state = OMX_StateInvalid; @@ -425,8 +425,9 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent, msg->type = GST_OMX_MESSAGE_STATE_SET; msg->content.state_set.state = nData2; - GST_DEBUG_OBJECT (comp->parent, "%s state change to %d finished", - comp->name, msg->content.state_set.state); + GST_DEBUG_OBJECT (comp->parent, "%s state change to %s finished", + comp->name, + gst_omx_state_to_string (msg->content.state_set.state)); gst_omx_component_send_message (comp, msg); break; @@ -2435,6 +2436,32 @@ gst_omx_error_to_string (OMX_ERRORTYPE err) } } +const gchar * +gst_omx_state_to_string (OMX_STATETYPE state) +{ + switch (state) { + case OMX_StateInvalid: + return "Invalid"; + case OMX_StateLoaded: + return "Loaded"; + case OMX_StateIdle: + return "Idle"; + case OMX_StateExecuting: + return "Executing"; + case OMX_StatePause: + return "Pause"; + case OMX_StateWaitForResources: + return "WaitForResources"; + default: + if (state >= OMX_StateKhronosExtensions) + return "KhronosExtensionState"; + else if (state >= OMX_StateVendorStartUnused) + return "CustomVendorState"; + break; + } + return "Unknown state"; +} + #if defined(USE_OMX_TARGET_RPI) #define DEFAULT_HACKS (GST_OMX_HACK_NO_COMPONENT_ROLE) #else diff --git a/omx/gstomx.h b/omx/gstomx.h index 1fd6008..0c0ba2c 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -273,6 +273,7 @@ struct _GstOMXClassData { GKeyFile * gst_omx_get_configuration (void); const gchar * gst_omx_error_to_string (OMX_ERRORTYPE err); +const gchar * gst_omx_state_to_string (OMX_STATETYPE state); guint64 gst_omx_parse_hacks (gchar ** hacks); GstOMXCore * gst_omx_core_acquire (const gchar * filename); |