shithub: openh264

Download patch

ref: c8b81b423979651e125609947af70bb1b227b1a9
parent: 20e889fadbfdfa74fee8fcec5e18e03d96ea5d7f
author: Martin Storsjö <[email protected]>
date: Tue Jun 10 08:13:26 EDT 2014

Only keep one single trace function pointer in welsCodecTrace

--- a/codec/common/inc/welsCodecTrace.h
+++ b/codec/common/inc/welsCodecTrace.h
@@ -43,7 +43,6 @@
   welsCodecTrace();
   ~welsCodecTrace();
 
-  static void TraceString (int32_t iLevel, const char* kpStrFormat);
   static void CODEC_TRACE (void* pIgnore, const int32_t kiLevel, const char* kpStrFormat, va_list vl);
 
   void SetTraceLevel (const int32_t kiLevel);
@@ -50,10 +49,7 @@
 
  public:
   static int32_t	m_iTraceLevel;
-  static CM_WELS_TRACE m_fpDebugTrace;
-  static CM_WELS_TRACE m_fpInfoTrace;
-  static CM_WELS_TRACE m_fpWarnTrace;
-  static CM_WELS_TRACE m_fpErrorTrace;
+  static CM_WELS_TRACE m_fpTrace;
 
 };
 
--- a/codec/common/src/welsCodecTrace.cpp
+++ b/codec/common/src/welsCodecTrace.cpp
@@ -47,51 +47,17 @@
 #include "logging.h"
 
 int32_t	welsCodecTrace::m_iTraceLevel			= WELS_LOG_DEFAULT;
-CM_WELS_TRACE welsCodecTrace::m_fpDebugTrace	= NULL;
-CM_WELS_TRACE welsCodecTrace::m_fpInfoTrace	= NULL;
-CM_WELS_TRACE welsCodecTrace::m_fpWarnTrace	= NULL;
-CM_WELS_TRACE welsCodecTrace::m_fpErrorTrace	= NULL;
+CM_WELS_TRACE welsCodecTrace::m_fpTrace	= NULL;
 
 welsCodecTrace::welsCodecTrace() {
 
-  m_fpDebugTrace = welsStderrTrace;
-  m_fpInfoTrace = welsStderrTrace;
-  m_fpWarnTrace = welsStderrTrace;
-  m_fpErrorTrace = welsStderrTrace;
+  m_fpTrace = welsStderrTrace;
 }
 
 welsCodecTrace::~welsCodecTrace() {
-  m_fpDebugTrace = NULL;
-  m_fpInfoTrace = NULL;
-  m_fpWarnTrace = NULL;
-  m_fpErrorTrace = NULL;
+  m_fpTrace = NULL;
 }
 
-void welsCodecTrace::TraceString (int32_t iLevel, const char* str) {
-  switch (iLevel) {
-  case WELS_LOG_ERROR:
-    if (m_fpErrorTrace)
-      m_fpErrorTrace (str);
-    break;
-  case WELS_LOG_WARNING:
-    if (m_fpWarnTrace)
-      m_fpWarnTrace (str);
-    break;
-  case WELS_LOG_INFO:
-    if (m_fpInfoTrace)
-      m_fpInfoTrace (str);
-    break;
-  case WELS_LOG_DEBUG:
-    if (m_fpDebugTrace)
-      m_fpDebugTrace (str);
-    break;
-  default:
-    if (m_fpDebugTrace)
-      m_fpInfoTrace (str);
-    break;
-  }
-}
-
 #define MAX_LOG_SIZE	1024
 
 void welsCodecTrace::CODEC_TRACE (void* ignore, const int32_t iLevel, const char* Str_Format, va_list vl) {
@@ -102,7 +68,7 @@
   char pBuf[MAX_LOG_SIZE] = {0};
   WelsVsnprintf (pBuf, MAX_LOG_SIZE, Str_Format, vl);	// confirmed_safe_unsafe_usage
 
-  welsCodecTrace::TraceString (iLevel, pBuf);
+  m_fpTrace (pBuf);
 }
 
 void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {