From d7862b927c0c38e8199d11bedf4bd2b29c4e88f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 15 Mar 2013 01:06:05 +0000 Subject: [PATCH] omx: log commands as strings Makes logs easier to read. --- omx/gstomx.c | 28 ++++++++++++++++++++++++++-- omx/gstomx.h | 2 ++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/omx/gstomx.c b/omx/gstomx.c index 692fb70c3c..26a9f15385 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -415,8 +415,8 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent, { OMX_COMMANDTYPE cmd = (OMX_COMMANDTYPE) nData1; - GST_DEBUG_OBJECT (comp->parent, "%s command %d complete", comp->name, - cmd); + GST_DEBUG_OBJECT (comp->parent, "%s command %s complete (%d)", + comp->name, gst_omx_command_to_string (cmd), cmd); switch (cmd) { case OMX_CommandStateSet:{ @@ -2462,6 +2462,30 @@ gst_omx_state_to_string (OMX_STATETYPE state) return "Unknown state"; } +const gchar * +gst_omx_command_to_string (OMX_COMMANDTYPE cmd) +{ + switch (cmd) { + case OMX_CommandStateSet: + return "SetState"; + case OMX_CommandFlush: + return "Flush"; + case OMX_CommandPortDisable: + return "DisablePort"; + case OMX_CommandPortEnable: + return "EnablePort"; + case OMX_CommandMarkBuffer: + return "MarkBuffer"; + default: + if (cmd >= OMX_CommandKhronosExtensions) + return "KhronosExtensionCommand"; + else if (cmd >= OMX_CommandVendorStartUnused) + return "VendorExtensionCommand"; + break; + } + return "Unknown command"; +} + #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 0c0ba2cf48..b5d83797c7 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -274,6 +274,8 @@ 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); +const gchar * gst_omx_command_to_string (OMX_COMMANDTYPE cmd); + guint64 gst_omx_parse_hacks (gchar ** hacks); GstOMXCore * gst_omx_core_acquire (const gchar * filename);