Add a method for overriding the logging function in welsCodecTrace

This commit is contained in:
Martin Storsjö
2014-06-10 14:47:25 +03:00
parent ce8065fe68
commit 6e5f31214a
4 changed files with 15 additions and 5 deletions

View File

@@ -51,6 +51,7 @@ welsCodecTrace::welsCodecTrace() {
m_iTraceLevel = WELS_LOG_DEFAULT;
m_fpTrace = welsStderrTrace;
m_pTraceCtx = NULL;
m_sLogCtx.pLogCtx = this;
m_sLogCtx.pfLog = StaticCodecTrace;
@@ -75,7 +76,7 @@ void welsCodecTrace::CodecTrace (const int32_t iLevel, const char* Str_Format, v
char pBuf[MAX_LOG_SIZE] = {0};
WelsVsnprintf (pBuf, MAX_LOG_SIZE, Str_Format, vl); // confirmed_safe_unsafe_usage
m_fpTrace (pBuf);
m_fpTrace (m_pTraceCtx, iLevel, pBuf);
}
void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {
@@ -83,4 +84,11 @@ void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {
m_iTraceLevel = iLevel;
}
void welsCodecTrace::SetTraceCallback (CM_WELS_TRACE func) {
m_fpTrace = func;
}
void welsCodecTrace::SetTraceCallbackContext (void* ctx) {
m_pTraceCtx = ctx;
}