Add a log context to the encoder and decoder contexts
This will allow setting non-global logging callbacks, that are different for each encoder or decoder instance.
This commit is contained in:
parent
c8b81b4239
commit
4e428ab020
@ -64,6 +64,10 @@ enum {
|
|||||||
// wels log output
|
// wels log output
|
||||||
typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const char* kpFmt, va_list argv);
|
typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const char* kpFmt, va_list argv);
|
||||||
|
|
||||||
|
typedef struct TagLogContext {
|
||||||
|
PWelsLogCallbackFunc pfLog;
|
||||||
|
void* pLogCtx;
|
||||||
|
} SLogContext;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
@ -66,9 +66,15 @@ void WelsSetLogCallback (PWelsLogCallbackFunc _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;
|
||||||
|
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);
|
||||||
wlog (pCtx, iLevel, kpFmt, vl);
|
pfLog (pCtx, iLevel, kpFmt, vl);
|
||||||
va_end (vl);
|
va_end (vl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ enum {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct TagWelsDecoderContext {
|
typedef struct TagWelsDecoderContext {
|
||||||
|
SLogContext sLogCtx;
|
||||||
// Input
|
// Input
|
||||||
void* pArgDec; // structured arguments for decoder, reserved here for extension in the future
|
void* pArgDec; // structured arguments for decoder, reserved here for extension in the future
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "wels_preprocess.h"
|
#include "wels_preprocess.h"
|
||||||
#include "wels_func_ptr_def.h"
|
#include "wels_func_ptr_def.h"
|
||||||
#include "crt_util_safe_x.h"
|
#include "crt_util_safe_x.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include "mt_defs.h" // for multiple threadin,
|
#include "mt_defs.h" // for multiple threadin,
|
||||||
#include "WelsThreadLib.h"
|
#include "WelsThreadLib.h"
|
||||||
@ -110,6 +111,7 @@ typedef struct TagStrideTables {
|
|||||||
} SStrideTables;
|
} SStrideTables;
|
||||||
|
|
||||||
typedef struct TagWelsEncCtx {
|
typedef struct TagWelsEncCtx {
|
||||||
|
SLogContext sLogCtx;
|
||||||
// Input
|
// Input
|
||||||
SWelsSvcCodingParam* pSvcParam; // SVC parameter, WelsSVCParamConfig in svc_param_settings.h
|
SWelsSvcCodingParam* pSvcParam; // SVC parameter, WelsSVCParamConfig in svc_param_settings.h
|
||||||
SWelsSliceBs* pSliceBs; // bitstream buffering for various slices, [uiSliceIdx]
|
SWelsSliceBs* pSliceBs; // bitstream buffering for various slices, [uiSliceIdx]
|
||||||
|
Loading…
Reference in New Issue
Block a user