Unified · Split
| @@ -54,6 +54,7 @@ typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const ch · 53 unmodified lines | |||
| 54 | typedef struct TagLogContext { | 54 | typedef struct TagLogContext { |
| 55 | PWelsLogCallbackFunc pfLog; | 55 | PWelsLogCallbackFunc pfLog; |
| 56 | void* pLogCtx; | 56 | void* pLogCtx; |
| 57 | void* pCodecInstance; | ||
| 57 | } SLogContext; | 58 | } SLogContext; |
| 58 | 59 | ||
| 59 | 60 | ||
| @@ -44,6 +44,7 @@ class welsCodecTrace { · 43 unmodified lines | |||
| 44 | welsCodecTrace(); | 44 | welsCodecTrace(); |
| 45 | ~welsCodecTrace(); | 45 | ~welsCodecTrace(); |
| 46 | 46 | ||
| 47 | void SetCodecInstance (void* pCodecInstance); | ||
| 47 | void SetTraceLevel (const int32_t kiLevel); | 48 | void SetTraceLevel (const int32_t kiLevel); |
| 48 | void SetTraceCallback (WelsTraceCallback func); | 49 | void SetTraceCallback (WelsTraceCallback func); |
| 49 | void SetTraceCallbackContext (void* pCtx); | 50 | void SetTraceCallbackContext (void* pCtx); |
| @@ -53,19 +53,19 @@ void WelsLog (SLogContext* logCtx, int32_t iLevel, const char* kpFmt, ...) { · 52 unmodified lines | |||
| 53 | char pTraceTag[MAX_LOG_SIZE]; | 53 | char pTraceTag[MAX_LOG_SIZE]; |
| 54 | switch (iLevel) { | 54 | switch (iLevel) { |
| 55 | case WELS_LOG_ERROR: | 55 | case WELS_LOG_ERROR: |
| 56 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Error:"); | 56 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Error:", logCtx->pCodecInstance); |
| 57 | break; | 57 | break; |
| 58 | case WELS_LOG_WARNING: | 58 | case WELS_LOG_WARNING: |
| 59 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Warning:"); | 59 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Warning:", logCtx->pCodecInstance); |
| 60 | break; | 60 | break; |
| 61 | case WELS_LOG_INFO: | 61 | case WELS_LOG_INFO: |
| 62 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Info:"); | 62 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Info:", logCtx->pCodecInstance); |
| 63 | break; | 63 | break; |
| 64 | case WELS_LOG_DEBUG: | 64 | case WELS_LOG_DEBUG: |
| 65 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Debug:"); | 65 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Debug:", logCtx->pCodecInstance); |
| 66 | break; | 66 | break; |
| 67 | default: | 67 | default: |
| 68 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] Detail:"); | 68 | WelsSnprintf (pTraceTag, MAX_LOG_SIZE, "[OpenH264] this = 0x%p, Detail:", logCtx->pCodecInstance); |
| 69 | break; | 69 | break; |
| 70 | } | 70 | } |
| 71 | WelsStrcat (pTraceTag, MAX_LOG_SIZE, kpFmt); | 71 | WelsStrcat (pTraceTag, MAX_LOG_SIZE, kpFmt); |
| @@ -83,6 +83,10 @@ void welsCodecTrace::CodecTrace (const int32_t iLevel, const char* Str_Format, v · 82 unmodified lines | |||
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | void welsCodecTrace::SetCodecInstance (void* pCodecInstance) { | ||
| 87 | m_sLogCtx.pCodecInstance = pCodecInstance; | ||
| 88 | } | ||
| 89 | |||
| 86 | void welsCodecTrace::SetTraceLevel (const int32_t iLevel) { | 90 | void welsCodecTrace::SetTraceLevel (const int32_t iLevel) { |
| 87 | if (iLevel >= 0) | 91 | if (iLevel >= 0) |
| 88 | m_iTraceLevel = iLevel; | 92 | m_iTraceLevel = iLevel; |
| @@ -104,6 +104,7 @@ CWelsDecoder::CWelsDecoder (void) · 103 unmodified lines | |||
| 104 | 104 | ||
| 105 | m_pWelsTrace = new welsCodecTrace(); | 105 | m_pWelsTrace = new welsCodecTrace(); |
| 106 | if (m_pWelsTrace != NULL) { | 106 | if (m_pWelsTrace != NULL) { |
| 107 | m_pWelsTrace->SetCodecInstance (this); | ||
| 107 | m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR); | 108 | m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR); |
| 108 | 109 | ||
| 109 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry"); | 110 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry"); |
| @@ -166,6 +166,7 @@ void CWelsH264SVCEncoder::InitEncoder (void) { · 165 unmodified lines | |||
| 166 | if (m_pWelsTrace == NULL) { | 166 | if (m_pWelsTrace == NULL) { |
| 167 | return; | 167 | return; |
| 168 | } | 168 | } |
| 169 | m_pWelsTrace->SetCodecInstance (this); | ||
| 169 | } | 170 | } |
| 170 | 171 | ||
| 171 | /* Interfaces override from ISVCEncoder */ | 172 | /* Interfaces override from ISVCEncoder */ |