shithub: openh264

Download patch

ref: cb5ee6c239ae34feba0856eeff021379cac4ceee
parent: b2cf56c618cd849ee54f9df2005ad2507f20d982
author: Martin Storsjö <martin@martin.st>
date: Tue Jun 10 10:37:14 EDT 2014

Remove the global log callback function

Now all logging should use a non-null log context, allowing to
pass the messages to the right recipient.

--- a/codec/common/inc/utils.h
+++ b/codec/common/inc/utils.h
@@ -77,19 +77,6 @@
 extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...);
 #endif
 
-/*!
- *************************************************************************************
- * \brief	set log callback from external call
- *
- * \param	_log	log function routine
- *
- * \return	NONE
- *
- * \note	N/A
- *************************************************************************************
- */
-void WelsSetLogCallback (PWelsLogCallbackFunc _log);
-
 /*
  *	PSNR calculation routines
  */
--- a/codec/common/src/utils.cpp
+++ b/codec/common/src/utils.cpp
@@ -48,33 +48,11 @@
                     const int32_t kiHeight);
 
 
-static PWelsLogCallbackFunc	wlog;
-
-/*!
- *************************************************************************************
- * \brief	set log callback from external call
- *
- * \param	_log	log function routine
- *
- * \return	NONE
- *
- * \note	N/A
- *************************************************************************************
- */
-void WelsSetLogCallback (PWelsLogCallbackFunc _log) {
-  wlog	= _log;
-}
-
 void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) {
   SLogContext* logCtx = (SLogContext*) pCtx;
-  PWelsLogCallbackFunc pfLog = wlog;
-  if (logCtx != NULL && logCtx->pfLog != NULL) {
-    pfLog = logCtx->pfLog;
-    pCtx = logCtx->pLogCtx;
-  }
   va_list vl;
   va_start (vl, kpFmt);
-  pfLog (pCtx, iLevel, kpFmt, vl);
+  logCtx->pfLog (logCtx->pLogCtx, iLevel, kpFmt, vl);
   va_end (vl);
 }
 
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -103,7 +103,6 @@
   m_pWelsTrace	= new welsCodecTrace();
   if (m_pWelsTrace != NULL) {
     m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
-    WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
 
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
   }
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -174,7 +174,6 @@
   }
 
   m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
-  WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
 
 #ifdef REC_FRAME_COUNT
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,