-void CLibCEC::AddLog(const cec_log_level level, const char *strFormat, ...)
-{
- CStdString strLog;
-
- va_list argList;
- va_start(argList, strFormat);
- strLog.FormatV(strFormat, argList);
- va_end(argList);
-
- CLibCEC *instance = CLibCEC::GetInstance();
- if (!instance)
- return;
- CLockObject lock(instance->m_logMutex);
-
- cec_log_message message;
- message.level = level;
- message.time = GetTimeMs() - instance->m_iStartTime;
- snprintf(message.message, sizeof(message.message), "%s", strLog.c_str());
-
- if (instance->m_callbacks && instance->m_callbacks->CBCecLogMessage)
- instance->m_callbacks->CBCecLogMessage(instance->m_cbParam, message);
- else
- instance->m_logBuffer.Push(message);
-}
-
-void CLibCEC::AddKey(const cec_keypress &key)
-{
- CLibCEC *instance = CLibCEC::GetInstance();
- if (!instance)
- return;
- CLockObject lock(instance->m_mutex);
-
- AddLog(CEC_LOG_DEBUG, "key pressed: %1x", key.keycode);
-
- if (instance->m_callbacks && instance->m_callbacks->CBCecKeyPress)
- instance->m_callbacks->CBCecKeyPress(instance->m_cbParam, key);
- else
- instance->m_keyBuffer.Push(key);
-
- instance->m_iCurrentButton = key.duration > 0 ? CEC_USER_CONTROL_CODE_UNKNOWN : key.keycode;
- instance->m_buttontime = key.duration > 0 ? 0 : GetTimeMs();
-}
-
-void CLibCEC::ConfigurationChanged(const libcec_configuration &config)
-{
- CLibCEC *instance = CLibCEC::GetInstance();
- CLockObject lock(instance->m_mutex);
-
- if (instance->m_callbacks &&
- config.clientVersion >= CEC_CLIENT_VERSION_1_5_0 &&
- instance->m_callbacks->CBCecConfigurationChanged &&
- instance->m_cec->IsInitialised())
- instance->m_callbacks->CBCecConfigurationChanged(instance->m_cbParam, config);
-}
-
-void CLibCEC::SetCurrentButton(cec_user_control_code iButtonCode)
-{
- /* push keypress to the keybuffer with 0 duration.
- push another press to the keybuffer with the duration set when the button is released */
- cec_keypress key;
- key.duration = 0;
- key.keycode = iButtonCode;
-
- AddKey(key);
-}
-
-void CLibCEC::AddKey(void)