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.
This commit is contained in:
parent
b2cf56c618
commit
cb5ee6c239
@ -77,19 +77,6 @@ extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) __attri
|
|||||||
extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...);
|
extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...);
|
||||||
#endif
|
#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
|
* PSNR calculation routines
|
||||||
*/
|
*/
|
||||||
|
@ -48,33 +48,11 @@ float WelsCalcPsnr (const void* kpTarPic,
|
|||||||
const int32_t kiHeight);
|
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, ...) {
|
void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) {
|
||||||
SLogContext* logCtx = (SLogContext*) pCtx;
|
SLogContext* logCtx = (SLogContext*) pCtx;
|
||||||
PWelsLogCallbackFunc pfLog = wlog;
|
|
||||||
if (logCtx != NULL && logCtx->pfLog != NULL) {
|
|
||||||
pfLog = logCtx->pfLog;
|
|
||||||
pCtx = logCtx->pLogCtx;
|
|
||||||
}
|
|
||||||
va_list vl;
|
va_list vl;
|
||||||
va_start (vl, kpFmt);
|
va_start (vl, kpFmt);
|
||||||
pfLog (pCtx, iLevel, kpFmt, vl);
|
logCtx->pfLog (logCtx->pLogCtx, iLevel, kpFmt, vl);
|
||||||
va_end (vl);
|
va_end (vl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,6 @@ CWelsDecoder::CWelsDecoder (void)
|
|||||||
m_pWelsTrace = new welsCodecTrace();
|
m_pWelsTrace = new welsCodecTrace();
|
||||||
if (m_pWelsTrace != NULL) {
|
if (m_pWelsTrace != NULL) {
|
||||||
m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
|
m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
|
||||||
WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
|
|
||||||
|
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,6 @@ void CWelsH264SVCEncoder::InitEncoder (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
|
m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
|
||||||
WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
|
|
||||||
|
|
||||||
#ifdef REC_FRAME_COUNT
|
#ifdef REC_FRAME_COUNT
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user