diff --git a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-811-cec_PR556_and_570.patch b/packages/mediacenter/xbmc/patches/xbmc-f3b0020-811-cec_PR556_and_570.patch new file mode 100644 index 0000000000..db3cb35537 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/xbmc-f3b0020-811-cec_PR556_and_570.patch @@ -0,0 +1,710 @@ +From 26cde7b1d61b750a687ed2aaa211f18cc8b2623d Mon Sep 17 00:00:00 2001 +From: Lars Op den Kamp +Date: Thu, 8 Dec 2011 00:47:35 +0100 +Subject: [PATCH] cec: temporary merge of PR556 and 570 + +cec fixes: + - pose as a recording device instead of a playback device on the cec bus, so the tuner related buttons on the tv's remote work too. + - removed the option to mark xbmc as inactive view when stopping, but always send the command instead, as is required by the cec spec. + - corrections in repeated keypress handling. display a message when the CEC adapter is connecting and when it is connected and to which devices. + +changed: Set strings to empty instead of removing them + +cec: added volume control on a CEC enabled amplifier when one is found + +cec: set the HDMI port and the device to which the CEC adapter was connected, to be able to determine the correct physical address. this is a work around, until the CEC adapter's firmware supports physical address detection, but is needed for people who have connected XBMC to something else than the TV + +cec: audiosystem control and the previous commit require libcec v1.3 or higher +--- + configure.in | 2 +- + language/Catalan/strings.xml | 2 +- + language/Chinese (Simple)/strings.xml | 2 +- + language/Czech/strings.xml | 2 +- + language/Dutch/strings.xml | 2 +- + language/English/strings.xml | 2 +- + language/Finnish/strings.xml | 2 +- + language/German/strings.xml | 2 +- + language/Korean/strings.xml | 2 +- + language/Slovenian/strings.xml | 2 +- + language/Turkish/strings.xml | 2 +- + project/BuildDependencies/scripts/libcec_d.txt | 2 +- + system/peripherals.xml | 4 +- + tools/darwin/depends/libcec/Makefile | 2 +- + xbmc/Application.cpp | 64 +++++++ + xbmc/Application.h | 1 + + xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 193 +++++++++++++++++---- + xbmc/peripherals/devices/PeripheralCecAdapter.h | 20 ++- + 18 files changed, 260 insertions(+), 48 deletions(-) + +diff --git a/configure.in b/configure.in +index e7045ba..f6c28ca 100755 +--- a/configure.in ++++ b/configure.in +@@ -1173,7 +1173,7 @@ if test "x$use_libcec" != "xno"; then + + # libcec is dyloaded, so we need to check for its headers and link any depends. + if test "x$use_libcec" != "xno"; then +- PKG_CHECK_MODULES([CEC],[libcec >= 1.1.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) ++ PKG_CHECK_MODULES([CEC],[libcec >= 1.3.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) + + if test "x$use_libcec" != "xno"; then + INCLUDES="$INCLUDES $CEC_CFLAGS" +diff --git a/language/Catalan/strings.xml b/language/Catalan/strings.xml +index 61ecd11..645279b 100644 +--- a/language/Catalan/strings.xml ++++ b/language/Catalan/strings.xml +@@ -2382,7 +2382,7 @@ + Power on the TV when starting XBMC + Power off devices when stopping XBMC + Put devices in standby mode when activating screensaver +- Set as inactive source when stopping XBMC ++ + Could not detect the CEC port. Set it up manually. + Could not detect the CEC adapter. + Unsupported libcec interface version. %d is greater than the version XBMC supports (%d) +diff --git a/language/Chinese (Simple)/strings.xml b/language/Chinese (Simple)/strings.xml +index dbb07ee..6627bfd 100644 +--- a/language/Chinese (Simple)/strings.xml ++++ b/language/Chinese (Simple)/strings.xml +@@ -2376,7 +2376,7 @@ + 启动XBMC时开启电视 + 退出XBMC时关闭设备 + 激活屏幕保护程序时设备进入待机状态 +- 退出XBMC时设为禁用资源 ++ + 未检测到 CEC 端口。需人工设置。 + 未检测到 CEC 适配器。 + 不支持的 libcec 界面版本。%d 高于 XBMC 支持的版本(%d) +diff --git a/language/Czech/strings.xml b/language/Czech/strings.xml +index be50357..898806d 100644 +--- a/language/Czech/strings.xml ++++ b/language/Czech/strings.xml +@@ -2383,7 +2383,7 @@ + Zapnout TV při spouštění XBMC + Vypnout zařízení při ukončování XBMC + Uvést zařízení do pohotovostního režimu při aktivování spořiče obrazovky +- Nastavit jako neaktivní zdroj při ukončování XBMC ++ + Nepodařilo se najít CEC port. Nastavte jej ručně. + Nepodařilo se najít CEC adaptér. + Nepodporovaná verze libcec rozhraní. %d je vyšší než verze podporovaná XBMC (%d) +diff --git a/language/Dutch/strings.xml b/language/Dutch/strings.xml +index 2269d55..d04d1bd 100644 +--- a/language/Dutch/strings.xml ++++ b/language/Dutch/strings.xml +@@ -2883,7 +2883,7 @@ + Schakel de TV in bij het opstarten van XBMC + Schakel apparatuur uit bij het stoppen van XBMC + Schakel app. uit zolang de schermbeveiliging actief is +- Markeer als inactieve bron bij het stoppen van XBMC ++ + Kon de CEC poort niet detecteren. Stel het manueel in. + Kon de CEC adapter niet detecteren. + Versie %d van de libcec interface version wordt niet ondersteund door XBMC (> %d) +diff --git a/language/English/strings.xml b/language/English/strings.xml +index 1b2afe5..090a1b9 100644 +--- a/language/English/strings.xml ++++ b/language/English/strings.xml +@@ -2831,7 +2831,7 @@ + Power on the TV when starting XBMC + Power off devices when stopping XBMC + Put devices in standby mode when activating screensaver +- Set as inactive source when stopping XBMC ++ + Could not detect the CEC port. Set it up manually. + Could not detect the CEC adapter. + Unsupported libcec interface version. %d is greater than the version XBMC supports (%d) +diff --git a/language/Finnish/strings.xml b/language/Finnish/strings.xml +index 9ef1ebd..82f6fc8 100644 +--- a/language/Finnish/strings.xml ++++ b/language/Finnish/strings.xml +@@ -2823,7 +2823,7 @@ + Käynnistä laitteet kun XBMC käynnistetään + Sammuta laitteet kun XBMC sammutetaan + Aseta laitteet valmiustilaan näytönsäästäjän aktivoituessa +- Aseta laite toimettomaksi lähteeksi kun XBMC sammutetaan ++ + CEC-porttia ei havaittu. Määritä se käsin. + CEC-sovitinta ei havaittu. + Ei tuettu libcec-rajapinnan versio. %d on suurempi kuin versio, jota XBMC tukee (%d) +diff --git a/language/German/strings.xml b/language/German/strings.xml +index a98c6f8..1d5a4ff 100644 +--- a/language/German/strings.xml ++++ b/language/German/strings.xml +@@ -2816,7 +2816,7 @@ + Geräte anschalten wenn XBMC startet + Geräte ausschalten wenn XBMC beendet wird + Geräte in den Standby versetzen wenn der Bilschirmschoner aktiviert wird +- Als inaktiv markieren wenn XBMC beendet wird ++ + Der CEC Port konnte nicht gefunden werden. Manuell einstellen. + Der CEC Adapter konnte nicht gefunden werden. + Nicht unterstützte libcec Version. %d ist größer als die von XBMC unterstützte Version (%d) +diff --git a/language/Korean/strings.xml b/language/Korean/strings.xml +index 7904e3c..373ac24 100644 +--- a/language/Korean/strings.xml ++++ b/language/Korean/strings.xml +@@ -2379,7 +2379,7 @@ + Power on devices when starting XBMC + Power off devices when stopping XBMC + Put devices in standby mode when activating screensaver +- Set as inactive source when stopping XBMC ++ + Could not detect the CEC port. Set it up manually. + Could not detect the CEC adapter. + Unsupported libcec interface version. %d is greater than the version XBMC supports (%d) +diff --git a/language/Slovenian/strings.xml b/language/Slovenian/strings.xml +index cd8bb14..78f8398 100644 +--- a/language/Slovenian/strings.xml ++++ b/language/Slovenian/strings.xml +@@ -2817,7 +2817,7 @@ + Vključi TV ob zagonu XBMC + Izključi naprave ob izhodu iz XBMC + Postavi naprave v stanje pripravljenosti ob ohranjevalniku zaslona +- Nastavi kot neaktiven vir ob izhodu iz XBMC ++ + Ni mogoče zaznati vrat CEC. Nastavite jih ročno. + Ni mogoče zaznati adapterja CEC. + Nepodprta različica libcec. %d je višja, kot jo podpira XBMC (%d) +diff --git a/language/Turkish/strings.xml b/language/Turkish/strings.xml +index f07f036..3ae7806 100644 +--- a/language/Turkish/strings.xml ++++ b/language/Turkish/strings.xml +@@ -2389,7 +2389,7 @@ + XBMC başlatılınca Televizyonu aç + XBMC durdurulunca aygıtı kapat + Ekran koruyucu devreye girince aygıtı bekleme moduna geçir +- XBMC durdurulunca etkin olmayan kaynak olarak ayarla ++ + CEC portu algılanamadı. El ile ayarla. + CEC bağdaştırıcısı algılanamadı. + Desteklenmeyen libcec arabirim sürümü. %d is greater than the version XBMC supports (%d) +diff --git a/project/BuildDependencies/scripts/libcec_d.txt b/project/BuildDependencies/scripts/libcec_d.txt +index ec9df80..fab03c5 100644 +diff --git a/system/peripherals.xml b/system/peripherals.xml +index 8f916ae..3882256 100644 +--- a/system/peripherals.xml ++++ b/system/peripherals.xml +@@ -15,9 +15,9 @@ + + + +- + + +- ++ ++ + + +diff --git a/tools/darwin/depends/libcec/Makefile b/tools/darwin/depends/libcec/Makefile +index c6b44c0..38f9162 100644 +--- a/tools/darwin/depends/libcec/Makefile ++++ b/tools/darwin/depends/libcec/Makefile +@@ -2,7 +2,7 @@ include ../Makefile.include + + # lib name, version + LIBNAME=libcec +-VERSION=1.2.0 ++VERSION=1.3.0 + SOURCE=$(LIBNAME)-$(VERSION) + ARCHIVE=$(SOURCE).tar.gz + +diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp +index 0e0511e..2cfb8d3 100644 +--- a/xbmc/Application.cpp ++++ b/xbmc/Application.cpp +@@ -2592,6 +2592,26 @@ bool CApplication::OnAction(const CAction &action) + // Check for global volume control + if (action.GetAmount() && (action.GetID() == ACTION_VOLUME_UP || action.GetID() == ACTION_VOLUME_DOWN)) + { ++ /* try to set the volume on a connected amp */ ++ #ifdef HAVE_LIBCEC ++ vector peripherals; ++ if (g_peripherals.GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) ++ { ++ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) ++ { ++ CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); ++ if (cecDevice && cecDevice->HasConnectedAudioSystem()) ++ { ++ if (action.GetID() == ACTION_VOLUME_UP) ++ cecDevice->ScheduleVolumeUp(); ++ else ++ cecDevice->ScheduleVolumeDown(); ++ return true; ++ } ++ } ++ } ++ #endif ++ + if (!m_pPlayer || !m_pPlayer->IsPassthrough()) + { + // increase or decrease the volume +@@ -5031,11 +5051,49 @@ void CApplication::ShowVolumeBar(const CAction *action) + + bool CApplication::IsMuted() const + { ++ /* try to set the mute setting on a connected amp */ ++#ifdef HAVE_LIBCEC ++ vector peripherals; ++ if (g_peripherals.GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) ++ { ++ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) ++ { ++ CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); ++ if (cecDevice && cecDevice->HasConnectedAudioSystem()) ++ return false; ++ } ++ } ++#endif + return g_settings.m_bMute; + } + ++bool CApplication::CecMute(void) ++{ ++ /* try to set the mute setting on a connected amp */ ++#ifdef HAVE_LIBCEC ++ vector peripherals; ++ if (g_peripherals.GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) ++ { ++ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) ++ { ++ CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); ++ if (cecDevice && cecDevice->HasConnectedAudioSystem()) ++ { ++ cecDevice->ScheduleMute(); ++ return true; ++ } ++ } ++ } ++#endif ++ ++ return false; ++} ++ + void CApplication::ToggleMute(void) + { ++ if (CecMute()) ++ return; ++ + if (g_settings.m_bMute) + UnMute(); + else +@@ -5044,6 +5102,9 @@ void CApplication::ToggleMute(void) + + void CApplication::Mute() + { ++ if (CecMute()) ++ return; ++ + g_settings.m_iPreMuteVolumeLevel = GetVolume(); + SetVolume(0); + g_settings.m_bMute = true; +@@ -5051,6 +5112,9 @@ void CApplication::Mute() + + void CApplication::UnMute() + { ++ if (CecMute()) ++ return; ++ + SetVolume(g_settings.m_iPreMuteVolumeLevel); + g_settings.m_iPreMuteVolumeLevel = 0; + g_settings.m_bMute = false; +diff --git a/xbmc/Application.h b/xbmc/Application.h +index 7688de7..26552ba 100644 +--- a/xbmc/Application.h ++++ b/xbmc/Application.h +@@ -172,6 +172,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs + void SetVolume(long iValue, bool isPercentage = true); + bool IsMuted() const; + void ToggleMute(void); ++ bool CecMute(void); + void ShowVolumeBar(const CAction *action = NULL); + int GetPlaySpeed() const; + int GetSubtitleDelay() const; +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +index 7ebcf87..d0c4e6c 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp +@@ -31,6 +31,7 @@ + #include "peripherals/Peripherals.h" + #include "peripherals/bus/PeripheralBus.h" + #include "settings/GUISettings.h" ++#include "settings/Settings.h" + #include "utils/log.h" + + #include +@@ -71,7 +72,9 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface + m_bStarted(false), + m_bHasButton(false), + m_bIsReady(false), +- m_strMenuLanguage("???") ++ m_strMenuLanguage("???"), ++ m_lastKeypress(0), ++ m_lastChange(VOLUME_CHANGE_NONE) + { + m_button.iButton = 0; + m_button.iDuration = 0; +@@ -81,7 +84,7 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface + { + cec_device_type_list typeList; + typeList.clear(); +- typeList.add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); ++ typeList.add(CEC_DEVICE_TYPE_RECORDING_DEVICE); + m_cecAdapter = m_dll->CECInit("XBMC", typeList); + } + else +@@ -128,10 +131,9 @@ void CPeripheralCecAdapter::Announce(EAnnouncementFlag flag, const char *sender, + { + if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnQuit") && m_bIsReady) + { ++ m_cecAdapter->SetInactiveView(); + if (GetSettingBool("cec_power_off_shutdown")) + m_cecAdapter->StandbyDevices(); +- else if (GetSettingBool("cec_mark_inactive_shutdown")) +- m_cecAdapter->SetInactiveView(); + } + else if (flag == GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverDeactivated") && GetSettingBool("cec_standby_screensaver") && m_bIsReady) + { +@@ -245,9 +247,20 @@ void CPeripheralCecAdapter::Process(void) + if (strPort.empty()) + return; + ++ // set correct physical address from peripheral settings ++ int iDevice = GetSettingInt("connected_device"); ++ int iHdmiPort = GetSettingInt("cec_hdmi_port"); ++ SetHdmiPort(iDevice, iHdmiPort); ++ FlushLog(); ++ + // open the CEC adapter + CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, strPort.c_str()); + ++ // scanning the CEC bus takes about 5 seconds, so display a notification to inform users that we're busy ++ CStdString strMessage; ++ strMessage.Format(g_localizeStrings.Get(21336), g_localizeStrings.Get(36000)); ++ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), strMessage); ++ + if (!m_cecAdapter->Open(strPort.c_str(), 10000)) + { + FlushLog(); +@@ -258,7 +271,6 @@ void CPeripheralCecAdapter::Process(void) + } + + CLog::Log(LOGDEBUG, "%s - connection to the CEC adapter opened", __FUNCTION__); +- + m_bIsReady = true; + CAnnouncementManager::AddAnnouncer(this); + +@@ -268,16 +280,6 @@ void CPeripheralCecAdapter::Process(void) + FlushLog(); + } + +- /* get the vendor id directly after connecting, because the TV might be using a non-standard CEC implementation */ +- m_cecAdapter->GetDeviceVendorId(CECDEVICE_TV); +- +- // set correct physical address from peripheral settings +- int iHdmiPort = GetSettingInt("cec_hdmi_port"); +- if (iHdmiPort <= 0 || iHdmiPort > 16) +- iHdmiPort = 1; +- m_cecAdapter->SetPhysicalAddress((uint16_t) (iHdmiPort << 12)); +- FlushLog(); +- + if (GetSettingBool("use_tv_menu_language")) + { + cec_menu_language language; +@@ -285,7 +287,24 @@ void CPeripheralCecAdapter::Process(void) + SetMenuLanguage(language.language); + } + ++ CStdString strNotification; ++ cec_osd_name tvName = m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV); ++ strNotification.Format("%s: %s", g_localizeStrings.Get(36016), tvName.name); ++ ++ /* disable the mute setting when an amp is found, because the amp handles the mute setting and ++ set PCM output to 100% */ ++ if (HasConnectedAudioSystem()) ++ { ++ cec_osd_name ampName = m_cecAdapter->GetDeviceOSDName(CECDEVICE_AUDIOSYSTEM); ++ CLog::Log(LOGDEBUG, "%s - CEC capable amplifier found (%s). volume will be controlled on the amp", __FUNCTION__, ampName.name); ++ strNotification.AppendFormat(" - %s", ampName.name); ++ ++ g_settings.m_bMute = false; ++ g_settings.m_nVolumeLevel = VOLUME_MAXIMUM; ++ } ++ + m_cecAdapter->SetOSDString(CECDEVICE_TV, CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME, g_localizeStrings.Get(36016).c_str()); ++ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), strNotification); + + while (!m_bStop) + { +@@ -293,6 +312,8 @@ void CPeripheralCecAdapter::Process(void) + if (!m_bStop) + ProcessNextCommand(); + if (!m_bStop) ++ ProcessVolumeChange(); ++ if (!m_bStop) + Sleep(5); + } + +@@ -308,7 +329,7 @@ bool CPeripheralCecAdapter::PowerOnCecDevices(cec_logical_address iLogicalAddres + + if (m_cecAdapter && m_bIsReady) + { +- CLog::Log(LOGDEBUG, "%s - powering on CEC capable devices with address %1x", __FUNCTION__, iLogicalAddress); ++ CLog::Log(LOGDEBUG, "%s - powering on CEC capable device with address %1x", __FUNCTION__, iLogicalAddress); + bReturn = m_cecAdapter->PowerOnDevices(iLogicalAddress); + } + +@@ -340,20 +361,124 @@ bool CPeripheralCecAdapter::SendPing(void) + return bReturn; + } + +-bool CPeripheralCecAdapter::SetHdmiPort(int iHdmiPort) ++bool CPeripheralCecAdapter::SetHdmiPort(int iDevice, int iHdmiPort) + { + bool bReturn(false); + if (m_cecAdapter && m_bIsReady) + { + if (iHdmiPort <= 0 || iHdmiPort > 16) + iHdmiPort = 1; +- CLog::Log(LOGDEBUG, "%s - changing active HDMI port to %d", __FUNCTION__, iHdmiPort); +- bReturn = m_cecAdapter->SetPhysicalAddress(iHdmiPort << 12); ++ CLog::Log(LOGDEBUG, "%s - changing active HDMI port to %d on device %d", __FUNCTION__, iHdmiPort, iDevice); ++ bReturn = m_cecAdapter->SetHDMIPort((cec_logical_address)iDevice, iHdmiPort); + } + + return bReturn; + } + ++bool CPeripheralCecAdapter::HasConnectedAudioSystem(void) ++{ ++ return m_cecAdapter && m_cecAdapter->IsActiveDeviceType(CEC_DEVICE_TYPE_AUDIO_SYSTEM); ++} ++ ++void CPeripheralCecAdapter::ScheduleVolumeUp(void) ++{ ++ CSingleLock lock(m_critSection); ++ m_volumeChangeQueue.push(VOLUME_CHANGE_UP); ++} ++ ++void CPeripheralCecAdapter::ScheduleVolumeDown(void) ++{ ++ CSingleLock lock(m_critSection); ++ m_volumeChangeQueue.push(VOLUME_CHANGE_DOWN); ++} ++ ++void CPeripheralCecAdapter::ScheduleMute(void) ++{ ++ CSingleLock lock(m_critSection); ++ m_volumeChangeQueue.push(VOLUME_CHANGE_MUTE); ++} ++ ++void CPeripheralCecAdapter::ProcessVolumeChange(void) ++{ ++ bool bSendRelease(false); ++ CecVolumeChange pendingVolumeChange = VOLUME_CHANGE_NONE; ++ { ++ CSingleLock lock(m_critSection); ++ if (m_volumeChangeQueue.size() > 0) ++ { ++ /* get the first change from the queue */ ++ if (pendingVolumeChange == VOLUME_CHANGE_NONE) ++ { ++ pendingVolumeChange = m_volumeChangeQueue.front(); ++ m_volumeChangeQueue.pop(); ++ } ++ ++ /* remove all dupe entries */ ++ while (m_volumeChangeQueue.size() > 0 && m_volumeChangeQueue.front() == pendingVolumeChange) ++ m_volumeChangeQueue.pop(); ++ ++ m_lastKeypress = XbmcThreads::SystemClockMillis(); ++ ++ /* only send the keypress when it hasn't been sent yet */ ++ if (pendingVolumeChange != m_lastChange) ++ m_lastChange = pendingVolumeChange; ++ else ++ pendingVolumeChange = VOLUME_CHANGE_NONE; ++ } ++ else if (m_lastKeypress > 0 && m_lastKeypress + CEC_BUTTON_TIMEOUT < XbmcThreads::SystemClockMillis()) ++ { ++ /* send a key release */ ++ bSendRelease = true; ++ m_lastKeypress = 0; ++ m_lastChange = VOLUME_CHANGE_NONE; ++ } ++ } ++ ++ switch (pendingVolumeChange) ++ { ++ case VOLUME_CHANGE_UP: ++ m_cecAdapter->SendKeypress(CECDEVICE_AUDIOSYSTEM, CEC_USER_CONTROL_CODE_VOLUME_UP, false); ++ break; ++ case VOLUME_CHANGE_DOWN: ++ m_cecAdapter->SendKeypress(CECDEVICE_AUDIOSYSTEM, CEC_USER_CONTROL_CODE_VOLUME_DOWN, false); ++ break; ++ case VOLUME_CHANGE_MUTE: ++ m_cecAdapter->SendKeypress(CECDEVICE_AUDIOSYSTEM, CEC_USER_CONTROL_CODE_MUTE, false); ++ break; ++ case VOLUME_CHANGE_NONE: ++ if (bSendRelease) ++ m_cecAdapter->SendKeyRelease(CECDEVICE_AUDIOSYSTEM, false); ++ break; ++ } ++} ++ ++void CPeripheralCecAdapter::VolumeUp(void) ++{ ++ if (HasConnectedAudioSystem()) ++ { ++ CSingleLock lock(m_critSection); ++ m_volumeChangeQueue.push(VOLUME_CHANGE_UP); ++ } ++} ++ ++void CPeripheralCecAdapter::VolumeDown(void) ++{ ++ if (HasConnectedAudioSystem()) ++ { ++ CSingleLock lock(m_critSection); ++ m_volumeChangeQueue.push(VOLUME_CHANGE_DOWN); ++ } ++} ++ ++void CPeripheralCecAdapter::Mute(void) ++{ ++ if (HasConnectedAudioSystem()) ++ { ++ CSingleLock lock(m_critSection); ++ m_volumeChangeQueue.push(VOLUME_CHANGE_MUTE); ++ } ++} ++ + void CPeripheralCecAdapter::SetMenuLanguage(const char *strLanguage) + { + if (m_strMenuLanguage.Equals(strLanguage)) +@@ -504,16 +629,18 @@ bool CPeripheralCecAdapter::GetNextCecKey(cec_keypress &key) + + bool CPeripheralCecAdapter::GetNextKey(void) + { ++ bool bHasButton(false); + CSingleLock lock(m_critSection); + if (m_bHasButton && m_button.iDuration > 0) +- return false; ++ return bHasButton; + + cec_keypress key; + if (!m_bIsReady || !GetNextCecKey(key)) +- return false; ++ return bHasButton; + + CLog::Log(LOGDEBUG, "%s - received key %2x", __FUNCTION__, key.keycode); + DWORD iButton = 0; ++ bHasButton = true; + + switch (key.keycode) + { +@@ -681,22 +808,24 @@ bool CPeripheralCecAdapter::GetNextKey(void) + case CEC_USER_CONTROL_CODE_DATA: + case CEC_USER_CONTROL_CODE_UNKNOWN: + default: +- m_bHasButton = false; +- return false; ++ bHasButton = false; ++ return bHasButton; + } + +- if (!m_bHasButton && iButton == m_button.iButton && m_button.iDuration == 0 && key.duration > 0) ++ if (!m_bHasButton && bHasButton && iButton == m_button.iButton && m_button.iDuration == 0 && key.duration > 0) + { + /* released button of the previous keypress */ +- m_bHasButton = false; +- return false; ++ return m_bHasButton; + } + +- m_bHasButton = true; +- m_button.iDuration = key.duration; +- m_button.iButton = iButton; ++ if (bHasButton) ++ { ++ m_bHasButton = true; ++ m_button.iDuration = key.duration; ++ m_button.iButton = iButton; ++ } + +- return true; ++ return m_bHasButton; + } + + WORD CPeripheralCecAdapter::GetButton(void) +@@ -733,9 +862,9 @@ void CPeripheralCecAdapter::OnSettingChanged(const CStdString &strChangedSetting + else if (bEnabled && !m_cecAdapter && m_bStarted) + InitialiseFeature(FEATURE_CEC); + } +- else if (strChangedSetting.Equals("cec_hdmi_port")) ++ else if (strChangedSetting.Equals("connected_device") || strChangedSetting.Equals("cec_hdmi_port")) + { +- SetHdmiPort(GetSettingInt("cec_hdmi_port")); ++ SetHdmiPort(GetSettingInt("connected_device"), GetSettingInt("cec_hdmi_port")); + } + } + +diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h +index b05e106..768e38a 100644 +--- a/xbmc/peripherals/devices/PeripheralCecAdapter.h ++++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h +@@ -49,6 +49,13 @@ + unsigned int iDuration; + } CecButtonPress; + ++ typedef enum ++ { ++ VOLUME_CHANGE_NONE, ++ VOLUME_CHANGE_UP, ++ VOLUME_CHANGE_DOWN, ++ VOLUME_CHANGE_MUTE ++ } CecVolumeChange; + + class CPeripheralCecAdapter : public CPeripheralHID, public ANNOUNCEMENT::IAnnouncer, private CThread + { +@@ -59,9 +66,16 @@ + virtual void Announce(ANNOUNCEMENT::EAnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); + virtual bool PowerOnCecDevices(CEC::cec_logical_address iLogicalAddress); + virtual bool StandbyCecDevices(CEC::cec_logical_address iLogicalAddress); ++ virtual bool HasConnectedAudioSystem(void); ++ virtual void ScheduleVolumeUp(void); ++ virtual void VolumeUp(void); ++ virtual void ScheduleVolumeDown(void); ++ virtual void VolumeDown(void); ++ virtual void ScheduleMute(void); ++ virtual void Mute(void); + + virtual bool SendPing(void); +- virtual bool SetHdmiPort(int iHdmiPort); ++ virtual bool SetHdmiPort(int iDevice, int iHdmiPort); + + virtual void OnSettingChanged(const CStdString &strChangedSetting); + +@@ -77,6 +91,7 @@ + virtual bool InitialiseFeature(const PeripheralFeature feature); + virtual void Process(void); + virtual void ProcessNextCommand(void); ++ virtual void ProcessVolumeChange(void); + virtual void SetMenuLanguage(const char *strLanguage); + static bool FindConfigLocation(CStdString &strString); + static bool TranslateComPort(CStdString &strPort); +@@ -90,6 +105,9 @@ + CDateTime m_screensaverLastActivated; + CecButtonPress m_button; + std::queue m_buttonQueue; ++ std::queue m_volumeChangeQueue; ++ unsigned int m_lastKeypress; ++ CecVolumeChange m_lastChange; + CCriticalSection m_critSection; + }; + } +-- +1.7.5.4 + diff --git a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-811-cec_fixes.patch b/packages/mediacenter/xbmc/patches/xbmc-f3b0020-811-cec_fixes.patch deleted file mode 100644 index cea1f51001..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-811-cec_fixes.patch +++ /dev/null @@ -1,330 +0,0 @@ -From f113d257af73b84dfb0ebf578c0d305fb52a3c40 Mon Sep 17 00:00:00 2001 -From: Lars Op den Kamp -Date: Thu, 8 Dec 2011 00:47:35 +0100 -Subject: [PATCH] cec fixes: - pose as a recording device instead of a - playback device on the cec bus, so the tuner related - buttons on the tv's remote work too. - removed the - option to mark xbmc as inactive view when stopping, but - always send the command instead, as is required by the cec - spec. - corrections in repeated keypress handling. - display a message when the CEC adapter is connecting and - when it is connected and to which devices. - ---- - language/Catalan/strings.xml | 1 - - language/Chinese (Simple)/strings.xml | 1 - - language/Czech/strings.xml | 1 - - language/Dutch/strings.xml | 1 - - language/English/strings.xml | 1 - - language/Finnish/strings.xml | 1 - - language/German/strings.xml | 1 - - language/Korean/strings.xml | 1 - - language/Slovenian/strings.xml | 1 - - language/Turkish/strings.xml | 1 - - system/peripherals.xml | 3 +- - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 58 +++++++++++---------- - xbmc/peripherals/devices/PeripheralCecAdapter.h | 1 + - 13 files changed, 33 insertions(+), 39 deletions(-) - -diff --git a/language/Catalan/strings.xml b/language/Catalan/strings.xml -index 61ecd11..8c7c673 100644 ---- a/language/Catalan/strings.xml -+++ b/language/Catalan/strings.xml -@@ -2382,7 +2382,6 @@ - Power on the TV when starting XBMC - Power off devices when stopping XBMC - Put devices in standby mode when activating screensaver -- Set as inactive source when stopping XBMC - Could not detect the CEC port. Set it up manually. - Could not detect the CEC adapter. - Unsupported libcec interface version. %d is greater than the version XBMC supports (%d) -diff --git a/language/Chinese (Simple)/strings.xml b/language/Chinese (Simple)/strings.xml -index dbb07ee..3db7fc5 100644 ---- a/language/Chinese (Simple)/strings.xml -+++ b/language/Chinese (Simple)/strings.xml -@@ -2376,7 +2376,6 @@ - 启动XBMC时开启电视 - 退出XBMC时关闭设备 - 激活屏幕保护程序时设备进入待机状态 -- 退出XBMC时设为禁用资源 - 未检测到 CEC 端口。需人工设置。 - 未检测到 CEC 适配器。 - 不支持的 libcec 界面版本。%d 高于 XBMC 支持的版本(%d) -diff --git a/language/Czech/strings.xml b/language/Czech/strings.xml -index be50357..25aab79 100644 ---- a/language/Czech/strings.xml -+++ b/language/Czech/strings.xml -@@ -2383,7 +2383,6 @@ - Zapnout TV při spouštění XBMC - Vypnout zařízení při ukončování XBMC - Uvést zařízení do pohotovostního režimu při aktivování spořiče obrazovky -- Nastavit jako neaktivní zdroj při ukončování XBMC - Nepodařilo se najít CEC port. Nastavte jej ručně. - Nepodařilo se najít CEC adaptér. - Nepodporovaná verze libcec rozhraní. %d je vyšší než verze podporovaná XBMC (%d) -diff --git a/language/Dutch/strings.xml b/language/Dutch/strings.xml -index 8747a23..040f503 100644 ---- a/language/Dutch/strings.xml -+++ b/language/Dutch/strings.xml -@@ -2345,7 +2345,6 @@ - Schakel de TV in bij het opstarten van XBMC - Schakel apparatuur uit bij het stoppen van XBMC - Schakel app. uit zolang de schermbeveiliging actief is -- Markeer als inactieve bron bij het stoppen van XBMC - Kon de CEC poort niet detecteren. Stel het manueel in. - Kon de CEC adapter niet detecteren. - Versie %d van de libcec interface version wordt niet ondersteund door XBMC (> %d) -diff --git a/language/English/strings.xml b/language/English/strings.xml -index 73405bf..5228c80 100644 ---- a/language/English/strings.xml -+++ b/language/English/strings.xml -@@ -2380,7 +2380,6 @@ - Power on the TV when starting XBMC - Power off devices when stopping XBMC - Put devices in standby mode when activating screensaver -- Set as inactive source when stopping XBMC - Could not detect the CEC port. Set it up manually. - Could not detect the CEC adapter. - Unsupported libcec interface version. %d is greater than the version XBMC supports (%d) -diff --git a/language/Finnish/strings.xml b/language/Finnish/strings.xml -index 8bd0369..d83daa0 100644 ---- a/language/Finnish/strings.xml -+++ b/language/Finnish/strings.xml -@@ -2382,7 +2382,6 @@ - Käynnistä laitteet kun XBMC käynnistetään - Sammuta laitteet kun XBMC sammutetaan - Aseta laitteet valmiustilaan näytönsäästäjän aktivoituessa -- Aseta laite toimettomaksi lähteeksi kun XBMC sammutetaan - CEC-porttia ei havaittu. Määritä se käsin. - CEC-sovitinta ei havaittu. - Ei tuettu libcec-rajapinnan versio. %d on suurempi kuin versio, jota XBMC tukee (%d) -diff --git a/language/German/strings.xml b/language/German/strings.xml -index b5d14bf..13487ce 100644 ---- a/language/German/strings.xml -+++ b/language/German/strings.xml -@@ -2378,7 +2378,6 @@ - Geräte anschalten wenn XBMC startet - Geräte ausschalten wenn XBMC beendet wird - Geräte in den Standby versetzen wenn der Bilschirmschoner aktiviert wird -- Als inaktiv markieren wenn XBMC beendet wird - Der CEC Port konnte nicht gefunden werden. Manuell einstellen. - Der CEC Adapter konnte nicht gefunden werden. - Nicht unterstützte libcec Version. %d ist größer als die von XBMC unterstützte Version (%d) -diff --git a/language/Korean/strings.xml b/language/Korean/strings.xml -index 7904e3c..8430210 100644 ---- a/language/Korean/strings.xml -+++ b/language/Korean/strings.xml -@@ -2379,7 +2379,6 @@ - Power on devices when starting XBMC - Power off devices when stopping XBMC - Put devices in standby mode when activating screensaver -- Set as inactive source when stopping XBMC - Could not detect the CEC port. Set it up manually. - Could not detect the CEC adapter. - Unsupported libcec interface version. %d is greater than the version XBMC supports (%d) -diff --git a/language/Slovenian/strings.xml b/language/Slovenian/strings.xml -index f986f38..9aefaef 100644 ---- a/language/Slovenian/strings.xml -+++ b/language/Slovenian/strings.xml -@@ -2383,7 +2383,6 @@ - Vključi naprave ob zagonu XBMC - Izključi naprave ob izhodu iz XBMC - Postavi naprave v stanje pripravljenosti ob ohranjevalniku zaslona -- Nastavi kot neaktiven vir ob izhodu iz XBMC - Ni mogoče zaznati vrat CEC. Nastavite jih ročno. - Ni mogoče zaznati adapterja CEC. - Nepodprta različica libcec. %d je višja, kot jo podpira XBMC (%d) -diff --git a/language/Turkish/strings.xml b/language/Turkish/strings.xml -index f07f036..2d48532 100644 ---- a/language/Turkish/strings.xml -+++ b/language/Turkish/strings.xml -@@ -2389,7 +2389,6 @@ - XBMC başlatılınca Televizyonu aç - XBMC durdurulunca aygıtı kapat - Ekran koruyucu devreye girince aygıtı bekleme moduna geçir -- XBMC durdurulunca etkin olmayan kaynak olarak ayarla - CEC portu algılanamadı. El ile ayarla. - CEC bağdaştırıcısı algılanamadı. - Desteklenmeyen libcec arabirim sürümü. %d is greater than the version XBMC supports (%d) -diff --git a/system/peripherals.xml b/system/peripherals.xml -index 8f916ae..f5cf50d 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -15,9 +15,8 @@ - - - -- - - -- -+ - - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 7ebcf87..21eb069 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -71,7 +71,8 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface - m_bStarted(false), - m_bHasButton(false), - m_bIsReady(false), -- m_strMenuLanguage("???") -+ m_strMenuLanguage("???"), -+ m_lastKeypress(0) - { - m_button.iButton = 0; - m_button.iDuration = 0; -@@ -81,7 +82,7 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface - { - cec_device_type_list typeList; - typeList.clear(); -- typeList.add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); -+ typeList.add(CEC_DEVICE_TYPE_RECORDING_DEVICE); - m_cecAdapter = m_dll->CECInit("XBMC", typeList); - } - else -@@ -128,10 +129,9 @@ void CPeripheralCecAdapter::Announce(EAnnouncementFlag flag, const char *sender, - { - if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnQuit") && m_bIsReady) - { -+ m_cecAdapter->SetInactiveView(); - if (GetSettingBool("cec_power_off_shutdown")) - m_cecAdapter->StandbyDevices(); -- else if (GetSettingBool("cec_mark_inactive_shutdown")) -- m_cecAdapter->SetInactiveView(); - } - else if (flag == GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverDeactivated") && GetSettingBool("cec_standby_screensaver") && m_bIsReady) - { -@@ -245,9 +245,19 @@ void CPeripheralCecAdapter::Process(void) - if (strPort.empty()) - return; - -+ // set correct physical address from peripheral settings -+ int iHdmiPort = GetSettingInt("cec_hdmi_port"); -+ SetHdmiPort(iHdmiPort); -+ FlushLog(); -+ - // open the CEC adapter - CLog::Log(LOGDEBUG, "%s - opening a connection to the CEC adapter: %s", __FUNCTION__, strPort.c_str()); - -+ // scanning the CEC bus takes about 5 seconds, so display a notification to inform users that we're busy -+ CStdString strMessage; -+ strMessage.Format(g_localizeStrings.Get(21336), g_localizeStrings.Get(36000)); -+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), strMessage); -+ - if (!m_cecAdapter->Open(strPort.c_str(), 10000)) - { - FlushLog(); -@@ -258,7 +268,6 @@ void CPeripheralCecAdapter::Process(void) - } - - CLog::Log(LOGDEBUG, "%s - connection to the CEC adapter opened", __FUNCTION__); -- - m_bIsReady = true; - CAnnouncementManager::AddAnnouncer(this); - -@@ -268,16 +277,6 @@ void CPeripheralCecAdapter::Process(void) - FlushLog(); - } - -- /* get the vendor id directly after connecting, because the TV might be using a non-standard CEC implementation */ -- m_cecAdapter->GetDeviceVendorId(CECDEVICE_TV); -- -- // set correct physical address from peripheral settings -- int iHdmiPort = GetSettingInt("cec_hdmi_port"); -- if (iHdmiPort <= 0 || iHdmiPort > 16) -- iHdmiPort = 1; -- m_cecAdapter->SetPhysicalAddress((uint16_t) (iHdmiPort << 12)); -- FlushLog(); -- - if (GetSettingBool("use_tv_menu_language")) - { - cec_menu_language language; -@@ -286,6 +285,7 @@ void CPeripheralCecAdapter::Process(void) - } - - m_cecAdapter->SetOSDString(CECDEVICE_TV, CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME, g_localizeStrings.Get(36016).c_str()); -+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), g_localizeStrings.Get(36016)); - - while (!m_bStop) - { -@@ -308,7 +308,7 @@ bool CPeripheralCecAdapter::PowerOnCecDevices(cec_logical_address iLogicalAddres - - if (m_cecAdapter && m_bIsReady) - { -- CLog::Log(LOGDEBUG, "%s - powering on CEC capable devices with address %1x", __FUNCTION__, iLogicalAddress); -+ CLog::Log(LOGDEBUG, "%s - powering on CEC capable device with address %1x", __FUNCTION__, iLogicalAddress); - bReturn = m_cecAdapter->PowerOnDevices(iLogicalAddress); - } - -@@ -504,16 +504,18 @@ bool CPeripheralCecAdapter::GetNextCecKey(cec_keypress &key) - - bool CPeripheralCecAdapter::GetNextKey(void) - { -+ bool bHasButton(false); - CSingleLock lock(m_critSection); - if (m_bHasButton && m_button.iDuration > 0) -- return false; -+ return bHasButton; - - cec_keypress key; - if (!m_bIsReady || !GetNextCecKey(key)) -- return false; -+ return bHasButton; - - CLog::Log(LOGDEBUG, "%s - received key %2x", __FUNCTION__, key.keycode); - DWORD iButton = 0; -+ bHasButton = true; - - switch (key.keycode) - { -@@ -681,22 +683,24 @@ bool CPeripheralCecAdapter::GetNextKey(void) - case CEC_USER_CONTROL_CODE_DATA: - case CEC_USER_CONTROL_CODE_UNKNOWN: - default: -- m_bHasButton = false; -- return false; -+ bHasButton = false; -+ return bHasButton; - } - -- if (!m_bHasButton && iButton == m_button.iButton && m_button.iDuration == 0 && key.duration > 0) -+ if (!m_bHasButton && bHasButton && iButton == m_button.iButton && m_button.iDuration == 0 && key.duration > 0) - { - /* released button of the previous keypress */ -- m_bHasButton = false; -- return false; -+ return m_bHasButton; - } - -- m_bHasButton = true; -- m_button.iDuration = key.duration; -- m_button.iButton = iButton; -+ if (bHasButton) -+ { -+ m_bHasButton = true; -+ m_button.iDuration = key.duration; -+ m_button.iButton = iButton; -+ } - -- return true; -+ return m_bHasButton; - } - - WORD CPeripheralCecAdapter::GetButton(void) -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h -index b05e106..2fcbb1d 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.h -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h -@@ -90,6 +90,7 @@ - CDateTime m_screensaverLastActivated; - CecButtonPress m_button; - std::queue m_buttonQueue; -+ unsigned int m_lastKeypress; - CCriticalSection m_critSection; - }; - } --- -1.7.5.4 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-812-cec_added_volume_control_on_a_CEC_enabled_amplifier_when_one_is_found.patch b/packages/mediacenter/xbmc/patches/xbmc-f3b0020-812-cec_added_volume_control_on_a_CEC_enabled_amplifier_when_one_is_found.patch deleted file mode 100644 index f6bab5d4f3..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-812-cec_added_volume_control_on_a_CEC_enabled_amplifier_when_one_is_found.patch +++ /dev/null @@ -1,347 +0,0 @@ -From da3e09a15d575cba0406d13ba090fd50ccb4249d Mon Sep 17 00:00:00 2001 -From: Lars Op den Kamp -Date: Thu, 8 Dec 2011 01:25:52 +0100 -Subject: [PATCH] cec: added volume control on a CEC enabled amplifier when - one is found - ---- - xbmc/Application.cpp | 64 ++++++++++ - xbmc/Application.h | 1 + - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 128 ++++++++++++++++++++- - xbmc/peripherals/devices/PeripheralCecAdapter.h | 17 +++ - 4 files changed, 208 insertions(+), 2 deletions(-) - -diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index 36eb715..47bb339 100644 ---- a/xbmc/Application.cpp -+++ b/xbmc/Application.cpp -@@ -2530,6 +2530,26 @@ bool CApplication::OnAction(const CAction &action) - // Check for global volume control - if (action.GetAmount() && (action.GetID() == ACTION_VOLUME_UP || action.GetID() == ACTION_VOLUME_DOWN)) - { -+ /* try to set the volume on a connected amp */ -+ #ifdef HAVE_LIBCEC -+ vector peripherals; -+ if (g_peripherals.GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) -+ { -+ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) -+ { -+ CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); -+ if (cecDevice && cecDevice->HasConnectedAudioSystem()) -+ { -+ if (action.GetID() == ACTION_VOLUME_UP) -+ cecDevice->ScheduleVolumeUp(); -+ else -+ cecDevice->ScheduleVolumeDown(); -+ return true; -+ } -+ } -+ } -+ #endif -+ - if (!m_pPlayer || !m_pPlayer->IsPassthrough()) - { - // increase or decrease the volume -@@ -4935,11 +4955,49 @@ void CApplication::ShowVolumeBar(const CAction *action) - - bool CApplication::IsMuted() const - { -+ /* try to set the mute setting on a connected amp */ -+#ifdef HAVE_LIBCEC -+ vector peripherals; -+ if (g_peripherals.GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) -+ { -+ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) -+ { -+ CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); -+ if (cecDevice && cecDevice->HasConnectedAudioSystem()) -+ return false; -+ } -+ } -+#endif - return g_settings.m_bMute; - } - -+bool CApplication::CecMute(void) -+{ -+ /* try to set the mute setting on a connected amp */ -+#ifdef HAVE_LIBCEC -+ vector peripherals; -+ if (g_peripherals.GetPeripheralsWithFeature(peripherals, FEATURE_CEC)) -+ { -+ for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < peripherals.size(); iPeripheralPtr++) -+ { -+ CPeripheralCecAdapter *cecDevice = (CPeripheralCecAdapter *) peripherals.at(iPeripheralPtr); -+ if (cecDevice && cecDevice->HasConnectedAudioSystem()) -+ { -+ cecDevice->ScheduleMute(); -+ return true; -+ } -+ } -+ } -+#endif -+ -+ return false; -+} -+ - void CApplication::ToggleMute(void) - { -+ if (CecMute()) -+ return; -+ - if (g_settings.m_bMute) - UnMute(); - else -@@ -4948,6 +5006,9 @@ void CApplication::ToggleMute(void) - - void CApplication::Mute() - { -+ if (CecMute()) -+ return; -+ - g_settings.m_iPreMuteVolumeLevel = GetVolume(); - SetVolume(0); - g_settings.m_bMute = true; -@@ -4955,6 +5016,9 @@ void CApplication::Mute() - - void CApplication::UnMute() - { -+ if (CecMute()) -+ return; -+ - SetVolume(g_settings.m_iPreMuteVolumeLevel); - g_settings.m_iPreMuteVolumeLevel = 0; - g_settings.m_bMute = false; -diff --git a/xbmc/Application.h b/xbmc/Application.h -index d4bb9b3..cc07209 100644 ---- a/xbmc/Application.h -+++ b/xbmc/Application.h -@@ -166,6 +166,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs - void SetVolume(long iValue, bool isPercentage = true); - bool IsMuted() const; - void ToggleMute(void); -+ bool CecMute(void); - void ShowVolumeBar(const CAction *action = NULL); - int GetPlaySpeed() const; - int GetSubtitleDelay() const; -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 21eb069..868a27c 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -31,6 +31,7 @@ - #include "peripherals/Peripherals.h" - #include "peripherals/bus/PeripheralBus.h" - #include "settings/GUISettings.h" -+#include "settings/Settings.h" - #include "utils/log.h" - - #include -@@ -72,7 +73,8 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface - m_bHasButton(false), - m_bIsReady(false), - m_strMenuLanguage("???"), -- m_lastKeypress(0) -+ m_lastKeypress(0), -+ m_lastChange(VOLUME_CHANGE_NONE) - { - m_button.iButton = 0; - m_button.iDuration = 0; -@@ -284,8 +286,24 @@ void CPeripheralCecAdapter::Process(void) - SetMenuLanguage(language.language); - } - -+ CStdString strNotification; -+ cec_osd_name tvName = m_cecAdapter->GetDeviceOSDName(CECDEVICE_TV); -+ strNotification.Format("%s: %s", g_localizeStrings.Get(36016), tvName.name); -+ -+ /* disable the mute setting when an amp is found, because the amp handles the mute setting and -+ set PCM output to 100% */ -+ if (HasConnectedAudioSystem()) -+ { -+ cec_osd_name ampName = m_cecAdapter->GetDeviceOSDName(CECDEVICE_AUDIOSYSTEM); -+ CLog::Log(LOGDEBUG, "%s - CEC capable amplifier found (%s). volume will be controlled on the amp", __FUNCTION__, ampName.name); -+ strNotification.AppendFormat(" - %s", ampName.name); -+ -+ g_settings.m_bMute = false; -+ g_settings.m_nVolumeLevel = VOLUME_MAXIMUM; -+ } -+ - m_cecAdapter->SetOSDString(CECDEVICE_TV, CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME, g_localizeStrings.Get(36016).c_str()); -- CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), g_localizeStrings.Get(36016)); -+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(36000), strNotification); - - while (!m_bStop) - { -@@ -293,6 +311,8 @@ void CPeripheralCecAdapter::Process(void) - if (!m_bStop) - ProcessNextCommand(); - if (!m_bStop) -+ ProcessVolumeChange(); -+ if (!m_bStop) - Sleep(5); - } - -@@ -354,6 +374,110 @@ bool CPeripheralCecAdapter::SetHdmiPort(int iHdmiPort) - return bReturn; - } - -+bool CPeripheralCecAdapter::HasConnectedAudioSystem(void) -+{ -+ return m_cecAdapter && m_cecAdapter->IsActiveDeviceType(CEC_DEVICE_TYPE_AUDIO_SYSTEM); -+} -+ -+void CPeripheralCecAdapter::ScheduleVolumeUp(void) -+{ -+ CSingleLock lock(m_critSection); -+ m_volumeChangeQueue.push(VOLUME_CHANGE_UP); -+} -+ -+void CPeripheralCecAdapter::ScheduleVolumeDown(void) -+{ -+ CSingleLock lock(m_critSection); -+ m_volumeChangeQueue.push(VOLUME_CHANGE_DOWN); -+} -+ -+void CPeripheralCecAdapter::ScheduleMute(void) -+{ -+ CSingleLock lock(m_critSection); -+ m_volumeChangeQueue.push(VOLUME_CHANGE_MUTE); -+} -+ -+void CPeripheralCecAdapter::ProcessVolumeChange(void) -+{ -+ bool bSendRelease(false); -+ CecVolumeChange pendingVolumeChange = VOLUME_CHANGE_NONE; -+ { -+ CSingleLock lock(m_critSection); -+ if (m_volumeChangeQueue.size() > 0) -+ { -+ /* get the first change from the queue */ -+ if (pendingVolumeChange == VOLUME_CHANGE_NONE) -+ { -+ pendingVolumeChange = m_volumeChangeQueue.front(); -+ m_volumeChangeQueue.pop(); -+ } -+ -+ /* remove all dupe entries */ -+ while (m_volumeChangeQueue.size() > 0 && m_volumeChangeQueue.front() == pendingVolumeChange) -+ m_volumeChangeQueue.pop(); -+ -+ m_lastKeypress = XbmcThreads::SystemClockMillis(); -+ -+ /* only send the keypress when it hasn't been sent yet */ -+ if (pendingVolumeChange != m_lastChange) -+ m_lastChange = pendingVolumeChange; -+ else -+ pendingVolumeChange = VOLUME_CHANGE_NONE; -+ } -+ else if (m_lastKeypress > 0 && m_lastKeypress + CEC_BUTTON_TIMEOUT < XbmcThreads::SystemClockMillis()) -+ { -+ /* send a key release */ -+ bSendRelease = true; -+ m_lastKeypress = 0; -+ m_lastChange = VOLUME_CHANGE_NONE; -+ } -+ } -+ -+ switch (pendingVolumeChange) -+ { -+ case VOLUME_CHANGE_UP: -+ m_cecAdapter->SendKeypress(CECDEVICE_AUDIOSYSTEM, CEC_USER_CONTROL_CODE_VOLUME_UP, false); -+ break; -+ case VOLUME_CHANGE_DOWN: -+ m_cecAdapter->SendKeypress(CECDEVICE_AUDIOSYSTEM, CEC_USER_CONTROL_CODE_VOLUME_DOWN, false); -+ break; -+ case VOLUME_CHANGE_MUTE: -+ m_cecAdapter->SendKeypress(CECDEVICE_AUDIOSYSTEM, CEC_USER_CONTROL_CODE_MUTE, false); -+ break; -+ case VOLUME_CHANGE_NONE: -+ if (bSendRelease) -+ m_cecAdapter->SendKeyRelease(CECDEVICE_AUDIOSYSTEM, false); -+ break; -+ } -+} -+ -+void CPeripheralCecAdapter::VolumeUp(void) -+{ -+ if (HasConnectedAudioSystem()) -+ { -+ CSingleLock lock(m_critSection); -+ m_volumeChangeQueue.push(VOLUME_CHANGE_UP); -+ } -+} -+ -+void CPeripheralCecAdapter::VolumeDown(void) -+{ -+ if (HasConnectedAudioSystem()) -+ { -+ CSingleLock lock(m_critSection); -+ m_volumeChangeQueue.push(VOLUME_CHANGE_DOWN); -+ } -+} -+ -+void CPeripheralCecAdapter::Mute(void) -+{ -+ if (HasConnectedAudioSystem()) -+ { -+ CSingleLock lock(m_critSection); -+ m_volumeChangeQueue.push(VOLUME_CHANGE_MUTE); -+ } -+} -+ - void CPeripheralCecAdapter::SetMenuLanguage(const char *strLanguage) - { - if (m_strMenuLanguage.Equals(strLanguage)) -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h -index 2fcbb1d..e1e302d 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.h -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h -@@ -49,6 +49,13 @@ - unsigned int iDuration; - } CecButtonPress; - -+ typedef enum -+ { -+ VOLUME_CHANGE_NONE, -+ VOLUME_CHANGE_UP, -+ VOLUME_CHANGE_DOWN, -+ VOLUME_CHANGE_MUTE -+ } CecVolumeChange; - - class CPeripheralCecAdapter : public CPeripheralHID, public ANNOUNCEMENT::IAnnouncer, private CThread - { -@@ -59,6 +66,13 @@ - virtual void Announce(ANNOUNCEMENT::EAnnouncementFlag flag, const char *sender, const char *message, const CVariant &data); - virtual bool PowerOnCecDevices(CEC::cec_logical_address iLogicalAddress); - virtual bool StandbyCecDevices(CEC::cec_logical_address iLogicalAddress); -+ virtual bool HasConnectedAudioSystem(void); -+ virtual void ScheduleVolumeUp(void); -+ virtual void VolumeUp(void); -+ virtual void ScheduleVolumeDown(void); -+ virtual void VolumeDown(void); -+ virtual void ScheduleMute(void); -+ virtual void Mute(void); - - virtual bool SendPing(void); - virtual bool SetHdmiPort(int iHdmiPort); -@@ -77,6 +91,7 @@ - virtual bool InitialiseFeature(const PeripheralFeature feature); - virtual void Process(void); - virtual void ProcessNextCommand(void); -+ virtual void ProcessVolumeChange(void); - virtual void SetMenuLanguage(const char *strLanguage); - static bool FindConfigLocation(CStdString &strString); - static bool TranslateComPort(CStdString &strPort); -@@ -90,7 +105,9 @@ - CDateTime m_screensaverLastActivated; - CecButtonPress m_button; - std::queue m_buttonQueue; -+ std::queue m_volumeChangeQueue; - unsigned int m_lastKeypress; -+ CecVolumeChange m_lastChange; - CCriticalSection m_critSection; - }; - } --- -1.7.5.4 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-813-cec_set_the_HDMI_port_and_the_device_to_which_the_CEC_adapter_was_connected.patch b/packages/mediacenter/xbmc/patches/xbmc-f3b0020-813-cec_set_the_HDMI_port_and_the_device_to_which_the_CEC_adapter_was_connected.patch deleted file mode 100644 index fd5d5ddcfa..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-813-cec_set_the_HDMI_port_and_the_device_to_which_the_CEC_adapter_was_connected.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 966f1fd37989d0b8abefcee02b9da9aa767b8787 Mon Sep 17 00:00:00 2001 -From: Lars Op den Kamp -Date: Thu, 8 Dec 2011 01:28:19 +0100 -Subject: [PATCH] cec: set the HDMI port and the device to which the CEC - adapter was connected, to be able to determine the correct - physical address. this is a work around, until the CEC - adapter's firmware supports physical address detection - ---- - system/peripherals.xml | 1 + - xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 13 +++++++------ - xbmc/peripherals/devices/PeripheralCecAdapter.h | 2 +- - 3 files changed, 9 insertions(+), 7 deletions(-) - -diff --git a/system/peripherals.xml b/system/peripherals.xml -index f5cf50d..3882256 100644 ---- a/system/peripherals.xml -+++ b/system/peripherals.xml -@@ -18,5 +18,6 @@ - - - -+ - - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -index 868a27c..d0c4e6c 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp -@@ -248,8 +248,9 @@ void CPeripheralCecAdapter::Process(void) - return; - - // set correct physical address from peripheral settings -+ int iDevice = GetSettingInt("connected_device"); - int iHdmiPort = GetSettingInt("cec_hdmi_port"); -- SetHdmiPort(iHdmiPort); -+ SetHdmiPort(iDevice, iHdmiPort); - FlushLog(); - - // open the CEC adapter -@@ -360,15 +361,15 @@ bool CPeripheralCecAdapter::SendPing(void) - return bReturn; - } - --bool CPeripheralCecAdapter::SetHdmiPort(int iHdmiPort) -+bool CPeripheralCecAdapter::SetHdmiPort(int iDevice, int iHdmiPort) - { - bool bReturn(false); - if (m_cecAdapter && m_bIsReady) - { - if (iHdmiPort <= 0 || iHdmiPort > 16) - iHdmiPort = 1; -- CLog::Log(LOGDEBUG, "%s - changing active HDMI port to %d", __FUNCTION__, iHdmiPort); -- bReturn = m_cecAdapter->SetPhysicalAddress(iHdmiPort << 12); -+ CLog::Log(LOGDEBUG, "%s - changing active HDMI port to %d on device %d", __FUNCTION__, iHdmiPort, iDevice); -+ bReturn = m_cecAdapter->SetHDMIPort((cec_logical_address)iDevice, iHdmiPort); - } - - return bReturn; -@@ -861,9 +862,9 @@ void CPeripheralCecAdapter::OnSettingChanged(const CStdString &strChangedSetting - else if (bEnabled && !m_cecAdapter && m_bStarted) - InitialiseFeature(FEATURE_CEC); - } -- else if (strChangedSetting.Equals("cec_hdmi_port")) -+ else if (strChangedSetting.Equals("connected_device") || strChangedSetting.Equals("cec_hdmi_port")) - { -- SetHdmiPort(GetSettingInt("cec_hdmi_port")); -+ SetHdmiPort(GetSettingInt("connected_device"), GetSettingInt("cec_hdmi_port")); - } - } - -diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.h b/xbmc/peripherals/devices/PeripheralCecAdapter.h -index e1e302d..768e38a 100644 ---- a/xbmc/peripherals/devices/PeripheralCecAdapter.h -+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.h -@@ -75,7 +75,7 @@ - virtual void Mute(void); - - virtual bool SendPing(void); -- virtual bool SetHdmiPort(int iHdmiPort); -+ virtual bool SetHdmiPort(int iDevice, int iHdmiPort); - - virtual void OnSettingChanged(const CStdString &strChangedSetting); - --- -1.7.5.4 - diff --git a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-814-cec_the_newly_added_features_in_XBMC_require_libcec_v1.3_or_higher.patch b/packages/mediacenter/xbmc/patches/xbmc-f3b0020-814-cec_the_newly_added_features_in_XBMC_require_libcec_v1.3_or_higher.patch deleted file mode 100644 index 9c84a05f4b..0000000000 --- a/packages/mediacenter/xbmc/patches/xbmc-f3b0020-814-cec_the_newly_added_features_in_XBMC_require_libcec_v1.3_or_higher.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 7b57da70c68fced81a0797cc872df10acb3fa6af Mon Sep 17 00:00:00 2001 -From: Lars Op den Kamp -Date: Fri, 9 Dec 2011 15:55:16 +0100 -Subject: [PATCH] cec: the newly added features in XBMC require libcec v1.3 or - higher - ---- - configure.in | 2 +- - project/BuildDependencies/scripts/libcec_d.txt | 2 +- - tools/darwin/depends/libcec/Makefile | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/configure.in b/configure.in -index bca9239..b31b4dd 100755 ---- a/configure.in -+++ b/configure.in -@@ -1173,7 +1173,7 @@ if test "x$use_libcec" != "xno"; then - - # libcec is dyloaded, so we need to check for its headers and link any depends. - if test "x$use_libcec" != "xno"; then -- PKG_CHECK_MODULES([CEC],[libcec >= 1.1.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) -+ PKG_CHECK_MODULES([CEC],[libcec >= 1.3.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)]) - - if test "x$use_libcec" != "xno"; then - INCLUDES="$INCLUDES $CEC_CFLAGS" --- -1.7.5.4 -