Merge pull request #1612 from huili2/log_add_this_codec
add this log for codec
This commit is contained in:
commit
0ff1eb482f
@ -54,6 +54,7 @@ typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const ch
|
||||
typedef struct TagLogContext {
|
||||
PWelsLogCallbackFunc pfLog;
|
||||
void* pLogCtx;
|
||||
void* pCodecInstance;
|
||||
} SLogContext;
|
||||
|
||||
|
||||
|
@ -44,6 +44,7 @@ class welsCodecTrace {
|
||||
welsCodecTrace();
|
||||
~welsCodecTrace();
|
||||
|
||||
void SetCodecInstance (void* pCodecInstance);
|
||||
void SetTraceLevel (const int32_t kiLevel);
|
||||
void SetTraceCallback (WelsTraceCallback func);
|
||||
void SetTraceCallbackContext (void* pCtx);
|
||||
|
@ -53,19 +53,19 @@ void WelsLog (SLogContext* logCtx, int32_t iLevel, const char* kpFmt, ...) {
|
||||
char pTraceTag[MAX_LOG_SIZE];
|
||||
switch (iLevel) {
|
||||
case WELS_LOG_ERROR:
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Error:");
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Error:", logCtx->pCodecInstance);
|
||||
break;
|
||||
case WELS_LOG_WARNING:
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Warning:");
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Warning:", logCtx->pCodecInstance);
|
||||
break;
|
||||
case WELS_LOG_INFO:
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Info:");
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Info:", logCtx->pCodecInstance);
|
||||
break;
|
||||
case WELS_LOG_DEBUG:
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Debug:");
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Debug:", logCtx->pCodecInstance);
|
||||
break;
|
||||
default:
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Detail:");
|
||||
WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Detail:", logCtx->pCodecInstance);
|
||||
break;
|
||||
}
|
||||
WelsStrcat (pTraceTag, MAX_LOG_SIZE, kpFmt);
|
||||
|
@ -83,6 +83,10 @@ void welsCodecTrace::CodecTrace (const int32_t iLevel, const char* Str_Format, v
|
||||
}
|
||||
}
|
||||
|
||||
void welsCodecTrace::SetCodecInstance (void* pCodecInstance) {
|
||||
m_sLogCtx.pCodecInstance = pCodecInstance;
|
||||
}
|
||||
|
||||
void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {
|
||||
if (iLevel >= 0)
|
||||
m_iTraceLevel = iLevel;
|
||||
|
@ -104,6 +104,7 @@ CWelsDecoder::CWelsDecoder (void)
|
||||
|
||||
m_pWelsTrace = new welsCodecTrace();
|
||||
if (m_pWelsTrace != NULL) {
|
||||
m_pWelsTrace->SetCodecInstance (this);
|
||||
m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
|
||||
|
||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
|
||||
|
@ -166,6 +166,7 @@ void CWelsH264SVCEncoder::InitEncoder (void) {
|
||||
if (m_pWelsTrace == NULL) {
|
||||
return;
|
||||
}
|
||||
m_pWelsTrace->SetCodecInstance (this);
|
||||
}
|
||||
|
||||
/* Interfaces override from ISVCEncoder */
|
||||
|
Loading…
x
Reference in New Issue
Block a user