ref: b9058e4987084d59e231ac6f1d713080c0bc7189
parent: efdb0cd2e2ed137f9d9ab9cc47211867bf08deeb
author: ruil2 <ruil2@cisco.com>
date: Wed Jul 16 12:49:53 EDT 2014
add trace tag
--- a/codec/common/inc/utils.h
+++ b/codec/common/inc/utils.h
@@ -42,7 +42,7 @@
#include <stdarg.h>
#include "typedefs.h"
-
+#define MAX_LOG_SIZE 1024
/*
* Function pointer declaration for various tool sets
*/
@@ -56,7 +56,8 @@
#ifdef __GNUC__
-extern void WelsLog (SLogContext* pCtx, int32_t iLevel, const char* kpFmt, ...) __attribute__ ((__format__ (__printf__, 3,
+extern void WelsLog (SLogContext* pCtx, int32_t iLevel, const char* kpFmt, ...) __attribute__ ((__format__ (__printf__,
+ 3,
4)));
#else
extern void WelsLog (SLogContext* pCtx, int32_t iLevel, const char* kpFmt, ...);
--- a/codec/common/src/utils.cpp
+++ b/codec/common/src/utils.cpp
@@ -39,7 +39,7 @@
*/
#include "utils.h"
#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
-
+#include "codec_app_def.h"
float WelsCalcPsnr (const void* kpTarPic,
const int32_t kiTarStride,
const void* kpRefPic,
@@ -50,6 +50,28 @@
void WelsLog (SLogContext* logCtx, int32_t iLevel, const char* kpFmt, ...) {
va_list vl;
+ char pTraceTag[MAX_LOG_SIZE];
+ switch (iLevel) {
+ case WELS_LOG_ERROR:
+ WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Error:");
+ break;
+ case WELS_LOG_WARNING:
+ WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Warning:");
+ break;
+ case WELS_LOG_INFO:
+ WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Info:");
+ break;
+ case WELS_LOG_DEBUG:
+ WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Debug:");
+ break;
+ default:
+ WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Detail:");
+ break;
+ }
+ va_start (vl, pTraceTag);
+ logCtx->pfLog (logCtx->pLogCtx, iLevel, pTraceTag, vl);
+ va_end (vl);
+
va_start (vl, kpFmt);
logCtx->pfLog (logCtx->pLogCtx, iLevel, kpFmt, vl);
va_end (vl);
--- a/codec/common/src/welsCodecTrace.cpp
+++ b/codec/common/src/welsCodecTrace.cpp
@@ -64,7 +64,7 @@
m_fpTrace = NULL;
}
-#define MAX_LOG_SIZE 1024
+
void welsCodecTrace::StaticCodecTrace (void* pCtx, const int32_t iLevel, const char* Str_Format, va_list vl) {
welsCodecTrace* self = (welsCodecTrace*) pCtx;