From: Lars Op den Kamp Date: Mon, 8 Oct 2012 12:12:38 +0000 (+0200) Subject: remove all pre-v2.0 compatibility checks X-Git-Tag: upstream/2.2.0~1^2~17^2^2~6 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=89be86b13333e5849785fb33d3f92114fe9713ac remove all pre-v2.0 compatibility checks --- diff --git a/include/cectypes.h b/include/cectypes.h index c80354e..526a5d8 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -1428,38 +1428,32 @@ struct libcec_configuration bool operator==(const libcec_configuration &other) const { - return ( clientVersion == other.clientVersion && - !strncmp(strDeviceName, other.strDeviceName, 13) && - deviceTypes == other.deviceTypes && - bAutodetectAddress == other.bAutodetectAddress && - iPhysicalAddress == other.iPhysicalAddress && - baseDevice == other.baseDevice && - iHDMIPort == other.iHDMIPort && - tvVendor == other.tvVendor && - wakeDevices == other.wakeDevices && - powerOffDevices == other.powerOffDevices && - serverVersion == other.serverVersion && - bGetSettingsFromROM == other.bGetSettingsFromROM && - bUseTVMenuLanguage == other.bUseTVMenuLanguage && - bActivateSource == other.bActivateSource && - bPowerOffScreensaver == other.bPowerOffScreensaver && - bPowerOffOnStandby == other.bPowerOffOnStandby && - bSendInactiveSource == other.bSendInactiveSource && - /* libcec 1.5.3+ */ - (other.clientVersion < CEC_CLIENT_VERSION_1_5_3 || logicalAddresses == other.logicalAddresses) && - /* libcec 1.6.0+ */ - (other.clientVersion < CEC_CLIENT_VERSION_1_6_0 || iFirmwareVersion == other.iFirmwareVersion) && - (other.clientVersion < CEC_CLIENT_VERSION_1_6_0 || bPowerOffDevicesOnStandby == other.bPowerOffDevicesOnStandby) && - (other.clientVersion < CEC_CLIENT_VERSION_1_6_0 || bShutdownOnStandby == other.bShutdownOnStandby) && - /* libcec 1.6.2+ */ - (other.clientVersion < CEC_CLIENT_VERSION_1_6_2 || !strncmp(strDeviceLanguage, other.strDeviceLanguage, 3)) && - (other.clientVersion < CEC_CLIENT_VERSION_1_6_2 || iFirmwareBuildDate == other.iFirmwareBuildDate) && - /* libcec 1.6.3+ */ - (other.clientVersion < CEC_CLIENT_VERSION_1_6_3 || bMonitorOnly == other.bMonitorOnly) && - /* libcec 1.8.0+ */ - (other.clientVersion < CEC_CLIENT_VERSION_1_8_0 || cecVersion == other.cecVersion) && - /* libcec 1.8.2+ */ - (other.clientVersion < CEC_CLIENT_VERSION_1_8_2 || adapterType == other.adapterType)); + return ( clientVersion == other.clientVersion && + !strncmp(strDeviceName, other.strDeviceName, 13) && + deviceTypes == other.deviceTypes && + bAutodetectAddress == other.bAutodetectAddress && + iPhysicalAddress == other.iPhysicalAddress && + baseDevice == other.baseDevice && + iHDMIPort == other.iHDMIPort && + tvVendor == other.tvVendor && + wakeDevices == other.wakeDevices && + powerOffDevices == other.powerOffDevices && + serverVersion == other.serverVersion && + bGetSettingsFromROM == other.bGetSettingsFromROM && + bUseTVMenuLanguage == other.bUseTVMenuLanguage && + bActivateSource == other.bActivateSource && + bPowerOffScreensaver == other.bPowerOffScreensaver && + bPowerOffOnStandby == other.bPowerOffOnStandby && + bSendInactiveSource == other.bSendInactiveSource && + logicalAddresses == other.logicalAddresses && + iFirmwareVersion == other.iFirmwareVersion && + bPowerOffDevicesOnStandby == other.bPowerOffDevicesOnStandby && + bShutdownOnStandby == other.bShutdownOnStandby && + !strncmp(strDeviceLanguage, other.strDeviceLanguage, 3) && + iFirmwareBuildDate == other.iFirmwareBuildDate && + bMonitorOnly == other.bMonitorOnly && + cecVersion == other.cecVersion && + adapterType == other.adapterType); } bool operator!=(const libcec_configuration &other) const @@ -1476,8 +1470,8 @@ struct libcec_configuration baseDevice = (cec_logical_address)CEC_DEFAULT_BASE_DEVICE; iHDMIPort = CEC_DEFAULT_HDMI_PORT; tvVendor = (uint64_t)CEC_VENDOR_UNKNOWN; - clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5; - serverVersion = (uint32_t)CEC_SERVER_VERSION_PRE_1_5; + clientVersion = (uint32_t)CEC_CLIENT_VERSION_2_0_0; + serverVersion = (uint32_t)CEC_SERVER_VERSION_2_0_0; bAutodetectAddress = 0; bGetSettingsFromROM = CEC_DEFAULT_SETTING_GET_SETTINGS_FROM_ROM; bUseTVMenuLanguage = CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE; diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index 0d75b6e..6be95b7 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -484,8 +484,8 @@ bool CCECClient::Transmit(const cec_command &data, bool bIsReply) bool CCECClient::SendPowerOnDevices(const cec_logical_address address /* = CECDEVICE_TV */) { - // if the broadcast address if set as destination and the client version >=1.5.0, read the wakeDevices setting - if (address == CECDEVICE_BROADCAST && m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_0) + // if the broadcast address if set as destination, read the wakeDevices setting + if (address == CECDEVICE_BROADCAST) { CECDEVICEVEC devices; m_processor->GetDevices()->GetWakeDevices(m_configuration, devices); @@ -497,8 +497,8 @@ bool CCECClient::SendPowerOnDevices(const cec_logical_address address /* = CECDE bool CCECClient::SendStandbyDevices(const cec_logical_address address /* = CECDEVICE_BROADCAST */) { - // if the broadcast address if set as destination and the client version >=1.5.0, read the standbyDevices setting - if (address == CECDEVICE_BROADCAST && m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_0) + // if the broadcast address if set as destination, read the standbyDevices setting + if (address == CECDEVICE_BROADCAST) { CECDEVICEVEC devices; m_processor->GetDevices()->GetPowerOffDevices(m_configuration, devices); @@ -762,59 +762,31 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration) // client version 1.5.0 snprintf(configuration.strDeviceName, 13, "%s", m_configuration.strDeviceName); - configuration.deviceTypes = m_configuration.deviceTypes; - configuration.bAutodetectAddress = m_configuration.bAutodetectAddress; - configuration.iPhysicalAddress = m_configuration.iPhysicalAddress; - configuration.baseDevice = m_configuration.baseDevice; - configuration.iHDMIPort = m_configuration.iHDMIPort; - configuration.clientVersion = m_configuration.clientVersion; - configuration.serverVersion = m_configuration.serverVersion; - configuration.tvVendor = m_configuration.tvVendor; - - configuration.bGetSettingsFromROM = m_configuration.bGetSettingsFromROM; - configuration.bUseTVMenuLanguage = m_configuration.bUseTVMenuLanguage; - configuration.bActivateSource = m_configuration.bActivateSource; - configuration.wakeDevices = m_configuration.wakeDevices; - configuration.powerOffDevices = m_configuration.powerOffDevices; - configuration.bPowerOffScreensaver = m_configuration.bPowerOffScreensaver; - configuration.bPowerOffOnStandby = m_configuration.bPowerOffOnStandby; - - // client version 1.5.1 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_1) - configuration.bSendInactiveSource = m_configuration.bSendInactiveSource; - - // client version 1.5.3 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_3) - configuration.logicalAddresses = m_configuration.logicalAddresses; - - // client version 1.6.0 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_0) - { - configuration.iFirmwareVersion = m_configuration.iFirmwareVersion; - configuration.bPowerOffDevicesOnStandby = m_configuration.bPowerOffDevicesOnStandby; - configuration.bShutdownOnStandby = m_configuration.bShutdownOnStandby; - } - - // client version 1.6.2 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_2) - { - memcpy(configuration.strDeviceLanguage, m_configuration.strDeviceLanguage, 3); - configuration.iFirmwareBuildDate = m_configuration.iFirmwareBuildDate; - } - - // client version 1.6.3 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_3) - { - configuration.bMonitorOnly = m_configuration.bMonitorOnly; - } - - // client version 1.8.0 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_8_0) - configuration.cecVersion = m_configuration.cecVersion; - - // client version 1.8.2 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_8_2) - configuration.adapterType = m_configuration.adapterType; + configuration.deviceTypes = m_configuration.deviceTypes; + configuration.bAutodetectAddress = m_configuration.bAutodetectAddress; + configuration.iPhysicalAddress = m_configuration.iPhysicalAddress; + configuration.baseDevice = m_configuration.baseDevice; + configuration.iHDMIPort = m_configuration.iHDMIPort; + configuration.clientVersion = m_configuration.clientVersion; + configuration.serverVersion = m_configuration.serverVersion; + configuration.tvVendor = m_configuration.tvVendor; + configuration.bGetSettingsFromROM = m_configuration.bGetSettingsFromROM; + configuration.bUseTVMenuLanguage = m_configuration.bUseTVMenuLanguage; + configuration.bActivateSource = m_configuration.bActivateSource; + configuration.wakeDevices = m_configuration.wakeDevices; + configuration.powerOffDevices = m_configuration.powerOffDevices; + configuration.bPowerOffScreensaver = m_configuration.bPowerOffScreensaver; + configuration.bPowerOffOnStandby = m_configuration.bPowerOffOnStandby; + configuration.bSendInactiveSource = m_configuration.bSendInactiveSource; + configuration.logicalAddresses = m_configuration.logicalAddresses; + configuration.iFirmwareVersion = m_configuration.iFirmwareVersion; + configuration.bPowerOffDevicesOnStandby = m_configuration.bPowerOffDevicesOnStandby; + configuration.bShutdownOnStandby = m_configuration.bShutdownOnStandby; + memcpy(configuration.strDeviceLanguage, m_configuration.strDeviceLanguage, 3); + configuration.iFirmwareBuildDate = m_configuration.iFirmwareBuildDate; + configuration.bMonitorOnly = m_configuration.bMonitorOnly; + configuration.cecVersion = m_configuration.cecVersion; + configuration.adapterType = m_configuration.adapterType; return true; } @@ -842,48 +814,21 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration) // just copy these { CLockObject lock(m_mutex); - m_configuration.bUseTVMenuLanguage = configuration.bUseTVMenuLanguage; - m_configuration.bActivateSource = configuration.bActivateSource; - m_configuration.bGetSettingsFromROM = configuration.bGetSettingsFromROM; - m_configuration.wakeDevices = configuration.wakeDevices; - m_configuration.powerOffDevices = configuration.powerOffDevices; - m_configuration.bPowerOffScreensaver = configuration.bPowerOffScreensaver; - m_configuration.bPowerOffOnStandby = configuration.bPowerOffOnStandby; - - // client version 1.5.1 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_1) - m_configuration.bSendInactiveSource = configuration.bSendInactiveSource; - - // client version 1.6.0 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_0) - { - m_configuration.bPowerOffDevicesOnStandby = configuration.bPowerOffDevicesOnStandby; - m_configuration.bShutdownOnStandby = configuration.bShutdownOnStandby; - } - - // client version 1.6.2 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_2) - { - memcpy(m_configuration.strDeviceLanguage, configuration.strDeviceLanguage, 3); - } - - // client version 1.6.3 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_3) - { - m_configuration.bMonitorOnly = configuration.bMonitorOnly; - } - - // client version 1.8.0 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_8_0) - m_configuration.cecVersion = configuration.cecVersion; - - // client version 1.8.2 - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_8_2) - m_configuration.adapterType = configuration.adapterType; - - // ensure that there is at least 1 device type set - if (m_configuration.deviceTypes.IsEmpty()) - m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); + m_configuration.bUseTVMenuLanguage = configuration.bUseTVMenuLanguage; + m_configuration.bActivateSource = configuration.bActivateSource; + m_configuration.bGetSettingsFromROM = configuration.bGetSettingsFromROM; + m_configuration.wakeDevices = configuration.wakeDevices; + m_configuration.powerOffDevices = configuration.powerOffDevices; + m_configuration.bPowerOffScreensaver = configuration.bPowerOffScreensaver; + m_configuration.bPowerOffOnStandby = configuration.bPowerOffOnStandby; + m_configuration.bSendInactiveSource = configuration.bSendInactiveSource; + m_configuration.bPowerOffDevicesOnStandby = configuration.bPowerOffDevicesOnStandby; + m_configuration.bShutdownOnStandby = configuration.bShutdownOnStandby; + memcpy(m_configuration.strDeviceLanguage, configuration.strDeviceLanguage, 3); + m_configuration.bMonitorOnly = configuration.bMonitorOnly; + m_configuration.cecVersion = configuration.cecVersion; + m_configuration.adapterType = configuration.adapterType; + m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); } bool bNeedReinit(false); @@ -1454,7 +1399,6 @@ void CCECClient::CallbackConfigurationChanged(const libcec_configuration &config { CLockObject lock(m_cbMutex); if (m_configuration.callbacks && - m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_0 && m_configuration.callbacks->CBCecConfigurationChanged && m_processor->CECInitialised()) m_configuration.callbacks->CBCecConfigurationChanged(m_configuration.callbackParam, config); @@ -1464,7 +1408,6 @@ void CCECClient::CallbackSourceActivated(bool bActivated, const cec_logical_addr { CLockObject lock(m_cbMutex); if (m_configuration.callbacks && - m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_7_1 && m_configuration.callbacks->CBCecSourceActivated) m_configuration.callbacks->CBCecSourceActivated(m_configuration.callbackParam, logicalAddress, bActivated ? 1 : 0); } @@ -1473,7 +1416,6 @@ void CCECClient::CallbackAlert(const libcec_alert type, const libcec_parameter & { CLockObject lock(m_cbMutex); if (m_configuration.callbacks && - m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_0 && m_configuration.callbacks->CBCecAlert) m_configuration.callbacks->CBCecAlert(m_configuration.callbackParam, type, param); } @@ -1482,7 +1424,6 @@ int CCECClient::CallbackMenuStateChanged(const cec_menu_state newState) { CLockObject lock(m_cbMutex); if (m_configuration.callbacks && - m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_2 && m_configuration.callbacks->CBCecMenuStateChanged) return m_configuration.callbacks->CBCecMenuStateChanged(m_configuration.callbackParam, newState); return 0; diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index ad41d3c..824744c 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -708,7 +708,13 @@ bool CCECProcessor::RegisterClient(CCECClient *client) libcec_configuration &configuration = *client->GetConfiguration(); - if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_3 && configuration.bMonitorOnly == 1) + if (configuration.clientVersion < CEC_CLIENT_VERSION_2_0_0) + { + m_libcec->AddLog(CEC_LOG_ERROR, "failed to register a new CEC client: client version %s is no longer supported", ToString((cec_client_version)configuration.clientVersion)); + return false; + } + + if (configuration.bMonitorOnly == 1) return true; if (!CECInitialised())