History

Set a log context in the decoder

Martin Storsjö committed 12 years ago

Commit b2cf56c1 parent 9583ac43 files · +21 −14Browse files

Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 3 files). Show all

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+16−10
@@ -104,9 +104,9 @@ CWelsDecoder::CWelsDecoder (void) · 103 unmodified lines
104104 if (m_pWelsTrace != NULL) {
105105 m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
106106 WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
107− }
108107
109− WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
108+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
109+ }
110110
111111 #ifdef OUTPUT_BIT_STREAM
112112 SWelsTime sCurTime;
@@ -161,7 +161,9 @@ CWelsDecoder::CWelsDecoder (void) · 48 unmodified lines
161161 * return: none
162162 ***************************************************************************/
163163 CWelsDecoder::~CWelsDecoder() {
164− WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::~CWelsDecoder()");
164+ if (m_pWelsTrace != NULL) {
165+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::~CWelsDecoder()");
166+ }
165167
166168 UninitDecoder();
167169
@@ -183,8 +185,12 @@ CWelsDecoder::~CWelsDecoder() { · 15 unmodified lines
183185 }
184186
185187 long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
188+ if (m_pWelsTrace == NULL) {
189+ return cmMallocMemeError;
190+ }
191+
186192 if (pParam == NULL) {
187− WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument.");
193+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument.");
188194 return cmInitParaError;
189195 }
190196
@@ -206,7 +212,7 @@ void CWelsDecoder::UninitDecoder (void) { · 15 unmodified lines
206212 if (NULL == m_pDecContext)
207213 return;
208214
209− WelsLog (NULL, WELS_LOG_INFO, "into CWelsDecoder::uninit_decoder()..");
215+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "into CWelsDecoder::uninit_decoder()..");
210216
211217 WelsEndDecoder (m_pDecContext);
212218
@@ -216,19 +222,19 @@ void CWelsDecoder::UninitDecoder (void) { · 3 unmodified lines
216222 m_pDecContext = NULL;
217223 }
218224
219− WelsLog (NULL , WELS_LOG_INFO, "left CWelsDecoder::uninit_decoder()..");
225+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "left CWelsDecoder::uninit_decoder()..");
220226 }
221227
222228 // the return value of this function is not suitable, it need report failure info to upper layer.
223229 void CWelsDecoder::InitDecoder (void) {
224230
225− WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::init_decoder()..");
231+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder()..");
226232
227233 m_pDecContext = (PWelsDecoderContext)WelsMalloc (sizeof (SWelsDecoderContext), "m_pDecContext");
228234
229− WelsInitDecoder (m_pDecContext);
235+ WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
230236
231− WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::init_decoder().. left");
237+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder().. left");
232238 }
233239
234240 /*
@@ -392,7 +398,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 157 unmodified lines
392398 }
393399 }
394400
395− WelsLog (NULL, WELS_LOG_INFO, "decode failed, failure type:%d \n",
401+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n",
396402 m_pDecContext->iErrorCode);
397403 return (DECODING_STATE)m_pDecContext->iErrorCode;
398404 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t