[vlc-commits] omxil: Factorize event debug printing to a separate function

Martin Storsjö git at videolan.org
Mon Mar 18 17:41:14 CET 2013


vlc | branch: master | Martin Storsjö <martin at martin.st> | Mon Mar 11 16:52:16 2013 +0200| [9cc68b95891375d97d988ed92566dfd60b132aeb] | committer: Martin Storsjö

omxil: Factorize event debug printing to a separate function

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9cc68b95891375d97d988ed92566dfd60b132aeb
---

 modules/codec/omxil/omxil.c       |   23 +----------------------
 modules/codec/omxil/omxil_utils.h |    2 ++
 modules/codec/omxil/utils.c       |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index b6f4e6f..0536cee 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1565,33 +1565,14 @@ static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE omx_handle,
     unsigned int i;
     (void)omx_handle;
 
+    PrintOmxEvent((vlc_object_t *) p_dec, event, data_1, data_2, event_data);
     switch (event)
     {
-    case OMX_EventCmdComplete:
-        switch ((OMX_STATETYPE)data_1)
-        {
-        case OMX_CommandStateSet:
-            msg_Dbg( p_dec, "OmxEventHandler (%s, %s, %s)", EventToString(event),
-                     CommandToString(data_1), StateToString(data_2) );
-            break;
-
-        default:
-            msg_Dbg( p_dec, "OmxEventHandler (%s, %s, %u)", EventToString(event),
-                     CommandToString(data_1), (unsigned int)data_2 );
-            break;
-        }
-        break;
-
     case OMX_EventError:
-        msg_Dbg( p_dec, "OmxEventHandler (%s, %s, %u, %s)", EventToString(event),
-                 ErrorToString((OMX_ERRORTYPE)data_1), (unsigned int)data_2,
-                 (const char *)event_data);
         //p_sys->b_error = true;
         break;
 
     case OMX_EventPortSettingsChanged:
-        msg_Dbg( p_dec, "OmxEventHandler (%s, %u, %u)", EventToString(event),
-                 (unsigned int)data_1, (unsigned int)data_2 );
         if( data_2 == 0 || data_2 == OMX_IndexParamPortDefinition )
         {
             OMX_BUFFERHEADERTYPE *sentinel;
@@ -1617,8 +1598,6 @@ static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE omx_handle,
         break;
 
     default:
-        msg_Dbg( p_dec, "OmxEventHandler (%s, %u, %u)", EventToString(event),
-                 (unsigned int)data_1, (unsigned int)data_2 );
         break;
     }
 
diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h
index 406ab1b..91be2f0 100644
--- a/modules/codec/omxil/omxil_utils.h
+++ b/modules/codec/omxil/omxil_utils.h
@@ -158,6 +158,8 @@ OMX_ERRORTYPE WaitForOmxEvent(decoder_t *p_dec, OMX_EVENTTYPE *event,
 OMX_ERRORTYPE WaitForSpecificOmxEvent(decoder_t *p_dec,
     OMX_EVENTTYPE specific_event, OMX_U32 *data_1, OMX_U32 *data_2,
     OMX_PTR *event_data);
+void PrintOmxEvent(vlc_object_t *p_this, OMX_EVENTTYPE event, OMX_U32 data_1,
+    OMX_U32 data_2, OMX_PTR event_data);
 
 /*****************************************************************************
  * Picture utility functions
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index 069e2ff..1521e6b 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -116,6 +116,39 @@ OMX_ERRORTYPE WaitForSpecificOmxEvent(decoder_t *p_dec,
     return OMX_ErrorNone;
 }
 
+void PrintOmxEvent(vlc_object_t *p_this, OMX_EVENTTYPE event, OMX_U32 data_1,
+    OMX_U32 data_2, OMX_PTR event_data)
+{
+    switch (event)
+    {
+    case OMX_EventCmdComplete:
+        switch ((OMX_STATETYPE)data_1)
+        {
+        case OMX_CommandStateSet:
+            msg_Dbg( p_this, "OmxEventHandler (%s, %s, %s)", EventToString(event),
+                     CommandToString(data_1), StateToString(data_2) );
+            break;
+
+        default:
+            msg_Dbg( p_this, "OmxEventHandler (%s, %s, %u)", EventToString(event),
+                     CommandToString(data_1), (unsigned int)data_2 );
+            break;
+        }
+        break;
+
+    case OMX_EventError:
+        msg_Dbg( p_this, "OmxEventHandler (%s, %s, %u, %s)", EventToString(event),
+                 ErrorToString((OMX_ERRORTYPE)data_1), (unsigned int)data_2,
+                 (const char *)event_data);
+        break;
+
+    default:
+        msg_Dbg( p_this, "OmxEventHandler (%s, %u, %u)", EventToString(event),
+                 (unsigned int)data_1, (unsigned int)data_2 );
+        break;
+    }
+}
+
 /*****************************************************************************
  * Picture utility functions
  *****************************************************************************/



More information about the vlc-commits mailing list