This will allow setting non-global logging callbacks, that are different for each encoder or decoder instance.
Showing the changes to codec/common/src/utils.cpp (1 of 4 files). Show all
Unified · Split
| @@ -66,9 +66,15 @@ void WelsSetLogCallback (PWelsLogCallbackFunc _log) { · 65 unmodified lines | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) { | 68 | void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) { |
| 69 | SLogContext* logCtx = (SLogContext*) pCtx; | ||
| 70 | PWelsLogCallbackFunc pfLog = wlog; | ||
| 71 | if (logCtx != NULL && logCtx->pfLog != NULL) { | ||
| 72 | pfLog = logCtx->pfLog; | ||
| 73 | pCtx = logCtx->pLogCtx; | ||
| 74 | } | ||
| 69 | va_list vl; | 75 | va_list vl; |
| 70 | va_start (vl, kpFmt); | 76 | va_start (vl, kpFmt); |
| 71 | wlog (pCtx, iLevel, kpFmt, vl); | 77 | pfLog (pCtx, iLevel, kpFmt, vl); |
| 72 | va_end (vl); | 78 | va_end (vl); |
| 73 | } | 79 | } |
| 74 | 80 | ||