xbmc-pvr: update to xbmc-pvr-84817e6, syncing patches with package 'xbmc'

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-12-29 06:07:24 +01:00
parent f4ba6ce76b
commit d60617dbde
28 changed files with 1202 additions and 838 deletions

View File

@ -19,13 +19,12 @@
################################################################################
PKG_NAME="xbmc-pvr-theme-Confluence"
PKG_VERSION="d967ec3"
PKG_VERSION="84817e6"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.xbmc.org"
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
#PKG_URL="http://gujs.openelec.tv/sources/$PKG_NAME-$PKG_VERSION.tar.xz"
PKG_DEPENDS=""
PKG_BUILD_DEPENDS="toolchain"
PKG_PRIORITY="optional"

View File

@ -19,7 +19,7 @@
################################################################################
PKG_NAME="xbmc-pvr"
PKG_VERSION="d967ec3"
PKG_VERSION="84817e6"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"

View File

@ -0,0 +1,582 @@
From 93e3b1bf60b03132f3aa3f85194385364abfeb6a Mon Sep 17 00:00:00 2001
From: Lars Op den Kamp <lars@opdenkamp.eu>
Date: Sun, 11 Dec 2011 23:42:17 +0100
Subject: [PATCH 1/4] 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<CPeripheral *> 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<CPeripheral *> 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<CPeripheral *> 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 <cec.h>
@@ -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<CEC::cec_keypress> m_buttonQueue;
+ std::queue<CecVolumeChange> m_volumeChangeQueue;
unsigned int m_lastKeypress;
+ CecVolumeChange m_lastChange;
CCriticalSection m_critSection;
};
}
--
1.7.5.4
From 3a093c1931360c98bdeac8d40b9fdf9b69c778a0 Mon Sep 17 00:00:00 2001
From: Lars Op den Kamp <lars@opdenkamp.eu>
Date: Sun, 11 Dec 2011 23:43:17 +0100
Subject: [PATCH 2/4] 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
---
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 @@
<setting key="standby_pc_on_tv_standby" type="bool" value="1" label="36014" />
<setting key="cec_debug_logging" type="bool" value="0" label="20191" />
<setting key="use_tv_menu_language" type="bool" value="1" label="36018" />
+ <setting key="connected_device" type="int" label="21373" value="0" min="0" max="15" step="1" />
</peripheral>
</peripherals>
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
From 7b49cb45bf33f7f00784c3655a95756f34de2f51 Mon Sep 17 00:00:00 2001
From: Lars Op den Kamp <lars@opdenkamp.eu>
Date: Sun, 11 Dec 2011 23:44:29 +0100
Subject: [PATCH 3/4] cec: audiosystem control and the previous commit require
libcec v1.3 or higher
---
configure.in | 2 +-
lib/libcec/Makefile | 2 +-
project/BuildDependencies/scripts/libcec_d.txt | 2 +-
tools/darwin/depends/libcec/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 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"
diff --git a/lib/libcec/Makefile b/lib/libcec/Makefile
index 8776161..0b6f322 100644
--- a/lib/libcec/Makefile
+++ b/lib/libcec/Makefile
@@ -7,7 +7,7 @@
# lib name, version
LIBNAME=libcec
-VERSION=1.2.0
+VERSION=1.3.0
SOURCE=$(LIBNAME)-$(VERSION)
# download location and format
diff --git a/project/BuildDependencies/scripts/libcec_d.txt b/project/BuildDependencies/scripts/libcec_d.txt
index ec9df80..fab03c5 100644
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
--
1.7.5.4
From bbb7dfa9c9d4c21b55034562de902d62ee644adb Mon Sep 17 00:00:00 2001
From: Lars Op den Kamp <lars@opdenkamp.eu>
Date: Wed, 21 Dec 2011 00:05:54 +0100
Subject: [PATCH 4/4] cec: improved the volume change response time
---
xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 33 ++++++++++++--------
1 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
index d0c4e6c..9a49a46 100644
--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
@@ -382,20 +382,29 @@ bool CPeripheralCecAdapter::HasConnectedAudioSystem(void)
void CPeripheralCecAdapter::ScheduleVolumeUp(void)
{
- CSingleLock lock(m_critSection);
- m_volumeChangeQueue.push(VOLUME_CHANGE_UP);
+ {
+ CSingleLock lock(m_critSection);
+ m_volumeChangeQueue.push(VOLUME_CHANGE_UP);
+ }
+ Sleep(5);
}
void CPeripheralCecAdapter::ScheduleVolumeDown(void)
{
- CSingleLock lock(m_critSection);
- m_volumeChangeQueue.push(VOLUME_CHANGE_DOWN);
+ {
+ CSingleLock lock(m_critSection);
+ m_volumeChangeQueue.push(VOLUME_CHANGE_DOWN);
+ }
+ Sleep(5);
}
void CPeripheralCecAdapter::ScheduleMute(void)
{
- CSingleLock lock(m_critSection);
- m_volumeChangeQueue.push(VOLUME_CHANGE_MUTE);
+ {
+ CSingleLock lock(m_critSection);
+ m_volumeChangeQueue.push(VOLUME_CHANGE_MUTE);
+ }
+ Sleep(5);
}
void CPeripheralCecAdapter::ProcessVolumeChange(void)
@@ -407,20 +416,19 @@ void CPeripheralCecAdapter::ProcessVolumeChange(void)
if (m_volumeChangeQueue.size() > 0)
{
/* get the first change from the queue */
- if (pendingVolumeChange == VOLUME_CHANGE_NONE)
- {
- pendingVolumeChange = m_volumeChangeQueue.front();
- m_volumeChangeQueue.pop();
- }
+ pendingVolumeChange = m_volumeChangeQueue.front();
+ m_volumeChangeQueue.pop();
/* remove all dupe entries */
while (m_volumeChangeQueue.size() > 0 && m_volumeChangeQueue.front() == pendingVolumeChange)
m_volumeChangeQueue.pop();
+ /* send another keypress after CEC_BUTTON_TIMEOUT ms */
+ bool bRefresh(m_lastKeypress + CEC_BUTTON_TIMEOUT < XbmcThreads::SystemClockMillis());
m_lastKeypress = XbmcThreads::SystemClockMillis();
/* only send the keypress when it hasn't been sent yet */
- if (pendingVolumeChange != m_lastChange)
+ if (pendingVolumeChange != m_lastChange || bRefresh)
m_lastChange = pendingVolumeChange;
else
pendingVolumeChange = VOLUME_CHANGE_NONE;
@@ -429,7 +437,6 @@ void CPeripheralCecAdapter::ProcessVolumeChange(void)
{
/* send a key release */
bSendRelease = true;
- m_lastKeypress = 0;
m_lastChange = VOLUME_CHANGE_NONE;
}
}
--
1.7.5.4

View File

@ -3710,7 +3710,7 @@ index 2f0b5ac..e97a14c 100644
CDVDMessageQueue* m_pAudioQueue;
CDVDMessageQueue* m_pVideoQueue;
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index 568ed10..abfdf2b 100644
index b54e34e..504e348 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -348,7 +348,7 @@ bool CDVDPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options)
@ -3731,7 +3731,7 @@ index 568ed10..abfdf2b 100644
CUtil::ClearTempFonts();
}
@@ -2884,7 +2884,7 @@ bool CDVDPlayer::OpenAudioStream(int iStream, int source)
@@ -2878,7 +2878,7 @@ bool CDVDPlayer::OpenAudioStream(int iStream, int source)
m_dvdPlayerAudio.SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
/* audio normally won't consume full cpu, so let it have prio */
@ -3740,7 +3740,7 @@ index 568ed10..abfdf2b 100644
return true;
}
@@ -2946,11 +2946,11 @@ bool CDVDPlayer::OpenVideoStream(int iStream, int source)
@@ -2940,11 +2940,11 @@ bool CDVDPlayer::OpenVideoStream(int iStream, int source)
// the CoreAudio audio device handler thread. We do the same for
// the DVDPlayerVideo thread so it can run to sleep without getting
// swapped out by a busy OS.
@ -5354,7 +5354,7 @@ index e61aa23..1ea4b9c 100644
//save current thread priority and set thread priority to THREAD_PRIORITY_TIME_CRITICAL
int priority = GetThreadPriority(GetCurrentThread());
diff --git a/xbmc/settings/GUISettings.cpp b/xbmc/settings/GUISettings.cpp
index a36ef58..4f1e329 100644
index e228621..b31dec0 100644
--- a/xbmc/settings/GUISettings.cpp
+++ b/xbmc/settings/GUISettings.cpp
@@ -592,6 +592,10 @@ void CGUISettings::Initialize()
@ -5366,7 +5366,7 @@ index a36ef58..4f1e329 100644
+ AddBool(vp, "videoplayer.usexvbasharedsurface", 13434, true);
+#endif
#ifdef HAS_DX
AddBool(g_sysinfo.IsVistaOrHigher() ? vp: NULL, "videoplayer.usedxva2", 13427, false);
AddBool(g_sysinfo.IsVistaOrHigher() ? vp: NULL, "videoplayer.usedxva2", 13427, g_sysinfo.IsVistaOrHigher() ? true : false);
#endif
diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp
index 596967c..15db1bc 100644
@ -7001,7 +7001,7 @@ index b91477d..8a05568 100644
// threaded lookup functions
diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp
index b9a1522..3750f7a 100644
index 75b533b..258f9e0 100644
--- a/xbmc/video/VideoInfoScanner.cpp
+++ b/xbmc/video/VideoInfoScanner.cpp
@@ -53,7 +53,7 @@ using namespace ADDON;
@ -7014,7 +7014,7 @@ index b9a1522..3750f7a 100644
m_bRunning = false;
m_pObserver = NULL;
diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp
index 076dc3a..3f8080e 100644
index 076dc3a..1f7c4c6 100644
--- a/xbmc/video/VideoReferenceClock.cpp
+++ b/xbmc/video/VideoReferenceClock.cpp
@@ -106,7 +106,7 @@ using namespace std;
@ -7043,7 +7043,17 @@ index 076dc3a..3f8080e 100644
None
};
@@ -463,6 +466,19 @@ void CVideoReferenceClock::RunGLX()
@@ -323,6 +326,9 @@ bool CVideoReferenceClock::SetupGLX()
return false;
}
+ m_glXSwapIntervalMESA = NULL;
+ m_glXSwapIntervalMESA = (int (*)(int))glXGetProcAddress((const GLubyte*)"glXSwapIntervalMESA");
+
XRRSizes(m_Dpy, m_vInfo->screen, &ReturnV);
if (ReturnV == 0)
{
@@ -463,6 +469,19 @@ void CVideoReferenceClock::RunGLX()
bool IsReset = false;
int64_t Now;
@ -7053,7 +7063,7 @@ index 076dc3a..3f8080e 100644
+ {
+ CStdString Vendor = VendorPtr;
+ Vendor.ToLower();
+ if (Vendor.compare(0, 3, "ati") == 0)
+ if ((Vendor.compare(0, 3, "ati") == 0) && m_glXSwapIntervalMESA)
+ {
+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: GL_VENDOR: %s, using ati workaround", VendorPtr);
+ AtiWorkaround = true;
@ -7063,7 +7073,15 @@ index 076dc3a..3f8080e 100644
CSingleLock SingleLock(m_CritSection);
SingleLock.Leave();
@@ -473,7 +489,14 @@ void CVideoReferenceClock::RunGLX()
@@ -470,10 +489,48 @@ void CVideoReferenceClock::RunGLX()
m_glXGetVideoSyncSGI(&VblankCount);
PrevVblankCount = VblankCount;
+ int precision = 1;
+ int proximity;
+ uint64_t lastVblankTime = CurrentHostCounter();
+ int sleepTime, correction;
+
while(!m_bStop)
{
//wait for the next vblank
@ -7072,14 +7090,40 @@ index 076dc3a..3f8080e 100644
+ ReturnV = m_glXWaitVideoSyncSGI(2, (VblankCount + 1) % 2, &VblankCount);
+ else
+ {
+ glXSwapBuffers(m_Dpy,m_Window);
+ //-------------------------------
+ proximity = 0;
+ sleepTime = precision * 100000LL / m_RefreshRate;
+ correction = CurrentHostCounter() - lastVblankTime;
+ if (sleepTime > correction)
+ sleepTime -= correction;
+ usleep(sleepTime);
+ m_glXGetVideoSyncSGI(&VblankCount);
+ if (VblankCount == PrevVblankCount)
+ {
+ usleep(sleepTime/2);
+ m_glXGetVideoSyncSGI(&VblankCount);
+ while (VblankCount == PrevVblankCount)
+ {
+ usleep(sleepTime/10);
+ m_glXGetVideoSyncSGI(&VblankCount);
+ proximity++;
+ }
+ }
+ else if (precision > 1)
+ precision--;
+
+ if (proximity > 4 && precision < 9)
+ precision++;
+
+ lastVblankTime = CurrentHostCounter();
+
+ ReturnV = 0;
+ }
+
m_glXGetVideoSyncSGI(&VblankCount); //the vblank count returned by glXWaitVideoSyncSGI is not always correct
Now = CurrentHostCounter(); //get the timestamp of this vblank
@@ -492,7 +515,6 @@ void CVideoReferenceClock::RunGLX()
@@ -492,13 +549,14 @@ void CVideoReferenceClock::RunGLX()
SingleLock.Leave();
SendVblankSignal();
UpdateRefreshrate();
@ -7087,45 +7131,26 @@ index 076dc3a..3f8080e 100644
IsReset = false;
}
else
@@ -503,21 +525,24 @@ void CVideoReferenceClock::RunGLX()
{
CLog::Log(LOGDEBUG, "CVideoReferenceClock: Vblank counter has reset");
+ precision = 1;
+
//only try reattaching once
if (IsReset)
return;
diff --git a/xbmc/video/VideoReferenceClock.h b/xbmc/video/VideoReferenceClock.h
index 9699cd4..5d1149a 100644
--- a/xbmc/video/VideoReferenceClock.h
+++ b/xbmc/video/VideoReferenceClock.h
@@ -114,6 +114,7 @@ class CVideoReferenceClock : public CThread
- //because of a bug in the nvidia driver, glXWaitVideoSyncSGI breaks when the vblank counter resets
- CLog::Log(LOGDEBUG, "CVideoReferenceClock: Detaching glX context");
- ReturnV = glXMakeCurrent(m_Dpy, None, NULL);
- if (ReturnV != True)
+ if (!AtiWorkaround)
{
- CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXMakeCurrent returned %i", ReturnV);
- return;
- }
-
- CLog::Log(LOGDEBUG, "CVideoReferenceClock: Attaching glX context");
- ReturnV = glXMakeCurrent(m_Dpy, m_Window, m_Context);
- if (ReturnV != True)
- {
- CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXMakeCurrent returned %i", ReturnV);
- return;
+ //because of a bug in the nvidia driver, glXWaitVideoSyncSGI breaks when the vblank counter resets
+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: Detaching glX context");
+ ReturnV = glXMakeCurrent(m_Dpy, None, NULL);
+ if (ReturnV != True)
+ {
+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXMakeCurrent returned %i", ReturnV);
+ return;
+ }
+
+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: Attaching glX context");
+ ReturnV = glXMakeCurrent(m_Dpy, m_Window, m_Context);
+ if (ReturnV != True)
+ {
+ CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXMakeCurrent returned %i", ReturnV);
+ return;
+ }
}
int (*m_glXWaitVideoSyncSGI) (int, int, unsigned int*);
int (*m_glXGetVideoSyncSGI) (unsigned int*);
+ int (*m_glXSwapIntervalMESA) (int);
m_glXGetVideoSyncSGI(&VblankCount);
Display* m_Dpy;
XVisualInfo *m_vInfo;
diff --git a/xbmc/win32/PlatformDefs.h b/xbmc/win32/PlatformDefs.h
index 57cab8f..74e3d53 100644
--- a/xbmc/win32/PlatformDefs.h
@ -7152,7 +7177,7 @@ index 56856ac..8aa7da9 100644
m_hwnd = NULL;
m_hProcess = NULL;
diff --git a/xbmc/windowing/WinEventsSDL.cpp b/xbmc/windowing/WinEventsSDL.cpp
index afff390..2e8b869 100644
index afff390..807d873 100644
--- a/xbmc/windowing/WinEventsSDL.cpp
+++ b/xbmc/windowing/WinEventsSDL.cpp
@@ -216,8 +216,16 @@ bool CWinEventsSDL::MessagePump()
@ -7164,7 +7189,7 @@ index afff390..2e8b869 100644
{
+ {
+#if defined(HAS_GLX)
+ CSingleLock lock(g_graphicsContext);
+ X11Lock xlock(g_Windowing);
+#endif
+ if (!SDL_PollEvent(&event))
+ break;
@ -7173,3 +7198,308 @@ index afff390..2e8b869 100644
switch(event.type)
{
case SDL_QUIT:
@@ -330,7 +338,14 @@ bool CWinEventsSDL::MessagePump()
case SDL_MOUSEMOTION:
{
- if (0 == (SDL_GetAppState() & SDL_APPMOUSEFOCUS))
+ Uint8 state;
+ {
+#if defined(HAS_GLX)
+ X11Lock xlock(g_Windowing);
+#endif
+ state = SDL_GetAppState() & SDL_APPMOUSEFOCUS;
+ }
+ if (0 == state)
{
g_Mouse.SetActive(false);
#if defined(__APPLE__)
diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp
index 62cf554..0f35d64 100644
--- a/xbmc/windowing/X11/WinSystemX11.cpp
+++ b/xbmc/windowing/X11/WinSystemX11.cpp
@@ -35,6 +35,8 @@
#include <X11/Xlib.h>
#include "cores/VideoRenderers/RenderManager.h"
#include "utils/TimeUtils.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/GUISettings.h"
#if defined(HAS_XRANDR)
#include <X11/extensions/Xrandr.h>
@@ -52,6 +54,7 @@ CWinSystemX11::CWinSystemX11() : CWinSystemBase()
m_wmWindow = 0;
m_bWasFullScreenBeforeMinimize = false;
m_dpyLostTime = 0;
+ m_internalModeSwitch = false;
}
CWinSystemX11::~CWinSystemX11()
@@ -160,13 +163,14 @@ bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int n
m_nWidth = newWidth;
m_nHeight = newHeight;
-
+ Uint8 state;
int options = SDL_OPENGL;
if (m_bFullScreen)
options |= SDL_FULLSCREEN;
else
options |= SDL_RESIZABLE;
+ X11Lock xlock(*this);
if ((m_SDLSurface = SDL_SetVideoMode(m_nWidth, m_nHeight, 0, options)))
{
RefreshGlxContext();
@@ -176,12 +180,53 @@ bool CWinSystemX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int n
return false;
}
+void CWinSystemX11::RefreshWindow()
+{
+ // save current mode if this is not an internal request
+ if (!m_internalModeSwitch)
+ {
+ CLog::Log(LOGNOTICE, "CWinSystemX11::RefreshWindow - external or initial xrandr event");
+ m_xrandrOut = g_xrandr.GetCurrentOutput();
+ m_xrandrMode = g_xrandr.GetCurrentMode(m_xrandrOut.name);
+ }
+ m_internalModeSwitch = false;
+
+ g_xrandr.Query(true);
+ XOutput out = g_xrandr.GetCurrentOutput();
+ XMode mode = g_xrandr.GetCurrentMode(out.name);
+
+ RESOLUTION_INFO res;
+ unsigned int i;
+ bool found(false);
+ for (i = RES_DESKTOP; i < g_settings.m_ResInfo.size(); ++i)
+ {
+ if (g_settings.m_ResInfo[i].strId == mode.id)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ CLog::Log(LOGERROR, "CWinSystemX11::RefreshWindow - could not find resolution");
+ return;
+ }
+
+ g_graphicsContext.SetVideoResolution((RESOLUTION)i, true);
+ g_guiSettings.SetInt("window.width", mode.w);
+ g_guiSettings.SetInt("window.height", mode.h);
+ g_settings.Save();
+}
+
bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays)
{
m_nWidth = res.iWidth;
m_nHeight = res.iHeight;
m_bFullScreen = fullScreen;
+ X11Lock xlock(*this);
+
#if defined(HAS_XRANDR)
XOutput out;
XMode mode;
@@ -191,13 +236,32 @@ bool CWinSystemX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl
mode.hz = res.fRefreshRate;
mode.id = res.strId;
- if(m_bFullScreen)
+ XOutput currout = g_xrandr.GetCurrentOutput();
+ XMode currmode = g_xrandr.GetCurrentMode(currout.name);
+
+ if (m_xrandrOut.name.empty())
{
+ m_xrandrOut = currout;
+ m_xrandrMode = currmode;
+ }
+
+ if(!m_bFullScreen)
+ {
+ // reset to mode we had before internal mode switch
+ out = m_xrandrOut;
+ mode = m_xrandrMode;
+ }
+
+ // only call xrandr if mode changes
+ if (currout.name != out.name || currmode.w != mode.w || currmode.h != mode.h ||
+ currmode.hz != mode.hz || currmode.id != mode.id)
+ {
+ CLog::Log(LOGNOTICE, "CWinSystemX11::SetFullScreen - calling xrandr");
OnLostDevice();
+ m_internalModeSwitch = true;
g_xrandr.SetMode(out, mode);
}
- else
- g_xrandr.RestoreState();
+
#endif
int options = SDL_OPENGL;
@@ -318,6 +382,9 @@ bool CWinSystemX11::RefreshGlxContext()
bool retVal = false;
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
+
+ X11Lock xlock(*this);
+
if (SDL_GetWMInfo(&info) <= 0)
{
CLog::Log(LOGERROR, "Failed to get window manager info from SDL");
@@ -410,11 +477,15 @@ bool CWinSystemX11::RefreshGlxContext()
void CWinSystemX11::ShowOSMouse(bool show)
{
+ X11Lock xlock(*this);
+
SDL_ShowCursor(show ? 1 : 0);
}
void CWinSystemX11::ResetOSScreensaver()
{
+ X11Lock xlock(*this);
+
if (m_bFullScreen)
{
//disallow the screensaver when we're fullscreen by periodically calling XResetScreenSaver(),
@@ -441,6 +512,8 @@ void CWinSystemX11::NotifyAppActiveChange(bool bActivated)
}
bool CWinSystemX11::Minimize()
{
+ X11Lock xlock(*this);
+
m_bWasFullScreenBeforeMinimize = g_graphicsContext.IsFullScreenRoot();
if (m_bWasFullScreenBeforeMinimize)
g_graphicsContext.ToggleFullScreenRoot();
@@ -454,12 +527,16 @@ bool CWinSystemX11::Restore()
}
bool CWinSystemX11::Hide()
{
+ X11Lock xlock(*this);
+
XUnmapWindow(m_dpy, m_wmWindow);
XSync(m_dpy, False);
return true;
}
bool CWinSystemX11::Show(bool raise)
{
+ X11Lock xlock(*this);
+
XMapWindow(m_dpy, m_wmWindow);
XSync(m_dpy, False);
return true;
@@ -471,6 +548,7 @@ void CWinSystemX11::CheckDisplayEvents()
bool bGotEvent(false);
bool bTimeout(false);
XEvent Event;
+
while (XCheckTypedEvent(m_dpy, m_RREventBase + RRScreenChangeNotify, &Event))
{
if (Event.type == m_RREventBase + RRScreenChangeNotify)
@@ -491,6 +569,7 @@ void CWinSystemX11::CheckDisplayEvents()
if (bGotEvent || bTimeout)
{
CLog::Log(LOGDEBUG, "%s - notify display reset event", __FUNCTION__);
+ RefreshWindow();
CSingleLock lock(m_resourceSection);
diff --git a/xbmc/windowing/X11/WinSystemX11.h b/xbmc/windowing/X11/WinSystemX11.h
index 5b941be..549d632 100644
--- a/xbmc/windowing/X11/WinSystemX11.h
+++ b/xbmc/windowing/X11/WinSystemX11.h
@@ -27,6 +27,7 @@
#include "utils/Stopwatch.h"
#include <GL/glx.h>
#include "threads/CriticalSection.h"
+#include "XRandR.h"
class IDispResource;
@@ -60,6 +61,7 @@ public:
// Local to WinSystemX11 only
Display* GetDisplay() { return m_dpy; }
GLXWindow GetWindow() { return m_glWindow; }
+ void RefreshWindow();
protected:
bool RefreshGlxContext();
@@ -76,6 +78,9 @@ protected:
CCriticalSection m_resourceSection;
std::vector<IDispResource*> m_resources;
uint64_t m_dpyLostTime;
+ XOutput m_xrandrOut;
+ XMode m_xrandrMode;
+ bool m_internalModeSwitch;
private:
bool IsSuitableVisual(XVisualInfo *vInfo);
@@ -83,5 +88,14 @@ private:
CStopWatch m_screensaverReset;
};
+class X11Lock
+{
+public:
+ X11Lock(CWinSystemX11 &winX11) { dpy = winX11.GetDisplay(); if (dpy) XLockDisplay(dpy); };
+ virtual ~X11Lock() { if (dpy) XUnlockDisplay(dpy); };
+private:
+ Display *dpy;
+};
+
#endif // WINDOW_SYSTEM_H
diff --git a/xbmc/windowing/X11/WinSystemX11GL.cpp b/xbmc/windowing/X11/WinSystemX11GL.cpp
index ec02b10..71d7d94 100644
--- a/xbmc/windowing/X11/WinSystemX11GL.cpp
+++ b/xbmc/windowing/X11/WinSystemX11GL.cpp
@@ -43,6 +43,8 @@ CWinSystemX11GL::~CWinSystemX11GL()
bool CWinSystemX11GL::PresentRenderImpl(const CDirtyRegionList& dirty)
{
+ X11Lock xlock(*this);
+
CheckDisplayEvents();
if(m_iVSyncMode == 3)
@@ -124,6 +126,8 @@ bool CWinSystemX11GL::PresentRenderImpl(const CDirtyRegionList& dirty)
void CWinSystemX11GL::SetVSyncImpl(bool enable)
{
+ X11Lock xlock(*this);
+
/* turn of current setting first */
if(m_glXSwapIntervalSGI)
m_glXSwapIntervalSGI(0);
@@ -200,6 +204,8 @@ bool CWinSystemX11GL::IsExtSupported(const char* extension)
bool CWinSystemX11GL::CreateNewWindow(const CStdString& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction)
{
+ X11Lock xlock(*this);
+
if(!CWinSystemX11::CreateNewWindow(name, fullScreen, res, userFunction))
return false;
@@ -246,6 +252,8 @@ bool CWinSystemX11GL::CreateNewWindow(const CStdString& name, bool fullScreen, R
bool CWinSystemX11GL::ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop)
{
+ X11Lock xlock(*this);
+
CWinSystemX11::ResizeWindow(newWidth, newHeight, newLeft, newTop);
CRenderSystemGL::ResetRenderSystem(newWidth, newHeight, false, 0);
@@ -254,6 +262,8 @@ bool CWinSystemX11GL::ResizeWindow(int newWidth, int newHeight, int newLeft, int
bool CWinSystemX11GL::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays)
{
+ X11Lock xlock(*this);
+
CWinSystemX11::SetFullScreen(fullScreen, res, blankOtherDisplays);
CRenderSystemGL::ResetRenderSystem(res.iWidth, res.iHeight, fullScreen, res.fRefreshRate);

View File

@ -0,0 +1,78 @@
From 0a693dcaaf74b6d1ce9341143db6584c42470644 Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sat, 10 Dec 2011 12:20:15 +0100
Subject: [PATCH] vdpau: lock x11 on init/uninit, vdpau shares display
connection with main thread
---
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
index 823686c..f2cce8a 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
@@ -412,7 +412,6 @@ int CVDPAU::Check(AVCodecContext* avctx)
{
CLog::Log(LOGNOTICE,"Attempting recovery");
- CSingleLock gLock(g_graphicsContext);
CExclusiveLock lock(m_DecoderSection);
FiniVDPAUOutput();
@@ -441,6 +440,8 @@ void CVDPAU::CheckFeatures()
{
if (videoMixer == VDP_INVALID_HANDLE)
{
+ X11Lock xlock(g_Windowing);
+
CLog::Log(LOGNOTICE, " (VDPAU) Creating the video mixer");
// Creation of VideoMixer.
VdpVideoMixerParameter parameters[] = {
@@ -673,6 +674,8 @@ void CVDPAU::SetDeinterlacing()
void CVDPAU::InitVDPAUProcs()
{
+ X11Lock xlock(g_Windowing);
+
char* error;
(void)dlerror();
@@ -690,7 +693,6 @@ void CVDPAU::InitVDPAUProcs()
if (dl_vdp_device_create_x11)
{
- CSingleLock lock(g_graphicsContext);
m_Display = g_Windowing.GetDisplay();
}
@@ -779,6 +781,8 @@ void CVDPAU::InitVDPAUProcs()
void CVDPAU::FiniVDPAUProcs()
{
+ X11Lock xlock(g_Windowing);
+
while (!m_videoSurfaces.empty())
{
vdpau_render_state *render = m_videoSurfaces.back();
@@ -931,6 +935,8 @@ bool CVDPAU::ConfigOutputMethod(AVCodecContext *avctx, AVFrame *pFrame)
FiniOutputMethod();
+ X11Lock xlock(g_Windowing);
+
MakePixmap(avctx->width,avctx->height);
vdp_st = vdp_presentation_queue_target_create_x11(vdp_device,
@@ -979,6 +985,8 @@ bool CVDPAU::ConfigOutputMethod(AVCodecContext *avctx, AVFrame *pFrame)
bool CVDPAU::FiniOutputMethod()
{
+ X11Lock xlock(g_Windowing);
+
VdpStatus vdp_st;
if (vdp_flip_queue != VDP_INVALID_HANDLE)
--
1.7.5.4

View File

@ -0,0 +1,29 @@
From 067004b0301366cb4bafc22dff21ec396e044bb7 Mon Sep 17 00:00:00 2001
From: arnova <arnova@void.org>
Date: Wed, 21 Dec 2011 13:59:13 +0100
Subject: [PATCH] [SDL] fixed: Crash when mixer fails to initialise
---
xbmc/guilib/GUIAudioManager.cpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/xbmc/guilib/GUIAudioManager.cpp b/xbmc/guilib/GUIAudioManager.cpp
index 83f4e40..db58426 100644
--- a/xbmc/guilib/GUIAudioManager.cpp
+++ b/xbmc/guilib/GUIAudioManager.cpp
@@ -73,8 +73,10 @@ void CGUIAudioManager::Initialize(int iDevice)
#elif defined(HAS_SDL_AUDIO)
Mix_CloseAudio();
if (Mix_OpenAudio(44100, AUDIO_S16, 2, 4096))
- CLog::Log(LOGERROR, "Unable to open audio mixer");
- Mix_Volume(0, (int)(128.f * (g_settings.m_nVolumeLevel - VOLUME_MINIMUM) / (float)(VOLUME_MAXIMUM - VOLUME_MINIMUM)));
+ CLog::Log(LOGERROR, "Unable to open audio mixer");
+ else
+ Mix_Volume(0, (int)(128.f * (g_settings.m_nVolumeLevel - VOLUME_MINIMUM) / (float)(VOLUME_MAXIMUM - VOLUME_MINIMUM)));
+
m_bInitialized = true;
#endif
}
--
1.7.5.4

View File

@ -0,0 +1,69 @@
diff --git a/xbmc/filesystem/DllLibCurl.cpp b/xbmc/filesystem/DllLibCurl.cpp
index f93e693..65ecad8 100644
--- a/xbmc/filesystem/DllLibCurl.cpp
+++ b/xbmc/filesystem/DllLibCurl.cpp
@@ -39,7 +39,7 @@ bool DllLibCurlGlobal::Load()
CSingleLock lock(m_critSection);
if(g_curlReferences > 0)
{
- g_curlReferences++;
+ //g_curlReferences++;
return true;
}
@@ -56,13 +56,16 @@ bool DllLibCurlGlobal::Load()
}
/* check idle will clean up the last one */
- g_curlReferences = 2;
+ //g_curlReferences = 2;
+ g_curlReferences = 1;
return true;
}
void DllLibCurlGlobal::Unload()
{
+ return;
+ /*
CSingleLock lock(m_critSection);
if (--g_curlReferences == 0)
{
@@ -75,19 +78,22 @@ void DllLibCurlGlobal::Unload()
DllDynamic::Unload();
}
- /* CheckIdle will clear this one up */
+ // CheckIdle will clear this one up
if(g_curlReferences == 1)
g_curlTimeout = XbmcThreads::SystemClockMillis();
+ */
}
void DllLibCurlGlobal::CheckIdle()
{
/* avoid locking section here, to avoid stalling gfx thread on loads*/
+ return;
+ /*
if(g_curlReferences == 0)
return;
CSingleLock lock(m_critSection);
- /* 20 seconds idle time before closing handle */
+ // 20 seconds idle time before closing handle
const unsigned int idletime = 30000;
VEC_CURLSESSIONS::iterator it = m_sessions.begin();
@@ -112,9 +118,10 @@ void DllLibCurlGlobal::CheckIdle()
it++;
}
- /* check if we should unload the dll */
+ // check if we should unload the dll
if(g_curlReferences == 1 && XbmcThreads::SystemClockMillis() - g_curlTimeout > idletime)
Unload();
+ */
}
void DllLibCurlGlobal::easy_aquire(const char *protocol, const char *hostname, CURL_HANDLE** easy_handle, CURLM** multi_handle)

View File

@ -0,0 +1,63 @@
From 505b702af7025ad977558e75d25764744c47f5a3 Mon Sep 17 00:00:00 2001
From: vdrfan <vdrfan-nospam-@xbmc.org>
Date: Wed, 28 Dec 2011 00:31:07 +0100
Subject: [PATCH] fixed: reverted File.cpp parts of
23607e247c0074d88464a39eca643897550cb70 as they were
causing troubles
---
xbmc/filesystem/File.cpp | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/xbmc/filesystem/File.cpp b/xbmc/filesystem/File.cpp
index 375226e..ef16255 100644
--- a/xbmc/filesystem/File.cpp
+++ b/xbmc/filesystem/File.cpp
@@ -217,15 +217,16 @@ bool CFile::Open(const CStdString& strFileName, unsigned int flags)
try
{
bool bPathInCache;
- CURL url(URIUtils::SubstitutePath(strFileName));
- if (url.GetProtocol() == "zip")
- url.SetOptions("");
- if (!g_directoryCache.FileExists(url.Get(), bPathInCache) )
+ CURL url2(strFileName);
+ if (url2.GetProtocol() == "zip")
+ url2.SetOptions("");
+ if (!g_directoryCache.FileExists(url2.Get(), bPathInCache) )
{
if (bPathInCache)
return false;
}
+ CURL url(URIUtils::SubstitutePath(strFileName));
if ( (flags & READ_NO_CACHE) == 0 && URIUtils::IsInternetStream(url) && !CUtil::IsPicture(strFileName) )
m_flags |= READ_CACHED;
@@ -343,7 +344,7 @@ bool CFile::OpenForWrite(const CStdString& strFileName, bool bOverWrite)
bool CFile::Exists(const CStdString& strFileName, bool bUseCache /* = true */)
{
- CURL url(URIUtils::SubstitutePath(strFileName));
+ CURL url;
try
{
@@ -353,12 +354,13 @@ bool CFile::Exists(const CStdString& strFileName, bool bUseCache /* = true */)
if (bUseCache)
{
bool bPathInCache;
- if (g_directoryCache.FileExists(url.Get(), bPathInCache) )
+ if (g_directoryCache.FileExists(strFileName, bPathInCache) )
return true;
if (bPathInCache)
return false;
}
+ url = URIUtils::SubstitutePath(strFileName);
auto_ptr<IFile> pFile(CFileFactory::CreateLoader(url));
if (!pFile.get())
return false;
--
1.7.5.4

View File

@ -1,710 +0,0 @@
From 26cde7b1d61b750a687ed2aaa211f18cc8b2623d Mon Sep 17 00:00:00 2001
From: Lars Op den Kamp <lars@opdenkamp.eu>
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 @@
<string id="36007">Power on the TV when starting XBMC</string>
<string id="36008">Power off devices when stopping XBMC</string>
<string id="36009">Put devices in standby mode when activating screensaver</string>
- <string id="36010">Set as inactive source when stopping XBMC</string>
+ <string id="36010"></string>
<string id="36011">Could not detect the CEC port. Set it up manually.</string>
<string id="36012">Could not detect the CEC adapter.</string>
<string id="36013">Unsupported libcec interface version. %d is greater than the version XBMC supports (%d)</string>
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 @@
<string id="36007">启动XBMC时开启电视</string>
<string id="36008">退出XBMC时关闭设备</string>
<string id="36009">激活屏幕保护程序时设备进入待机状态</string>
- <string id="36010">退出XBMC时设为禁用资源</string>
+ <string id="36010"></string>
<string id="36011">未检测到 CEC 端口。需人工设置。</string>
<string id="36012">未检测到 CEC 适配器。</string>
<string id="36013">不支持的 libcec 界面版本。%d 高于 XBMC 支持的版本(%d</string>
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 @@
<string id="36007">Zapnout TV při spouštění XBMC</string>
<string id="36008">Vypnout zařízení při ukončování XBMC</string>
<string id="36009">Uvést zařízení do pohotovostního režimu při aktivování spořiče obrazovky</string>
- <string id="36010">Nastavit jako neaktivní zdroj při ukončování XBMC</string>
+ <string id="36010"></string>
<string id="36011">Nepodařilo se najít CEC port. Nastavte jej ručně.</string>
<string id="36012">Nepodařilo se najít CEC adaptér.</string>
<string id="36013">Nepodporovaná verze libcec rozhraní. %d je vyšší než verze podporovaná XBMC (%d)</string>
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 @@
<string id="36007">Schakel de TV in bij het opstarten van XBMC</string>
<string id="36008">Schakel apparatuur uit bij het stoppen van XBMC</string>
<string id="36009">Schakel app. uit zolang de schermbeveiliging actief is</string>
- <string id="36010">Markeer als inactieve bron bij het stoppen van XBMC</string>
+ <string id="36010"></string>
<string id="36011">Kon de CEC poort niet detecteren. Stel het manueel in.</string>
<string id="36012">Kon de CEC adapter niet detecteren.</string>
<string id="36013">Versie %d van de libcec interface version wordt niet ondersteund door XBMC (> %d)</string>
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 @@
<string id="36007">Power on the TV when starting XBMC</string>
<string id="36008">Power off devices when stopping XBMC</string>
<string id="36009">Put devices in standby mode when activating screensaver</string>
- <string id="36010">Set as inactive source when stopping XBMC</string>
+ <string id="36010"></string>
<string id="36011">Could not detect the CEC port. Set it up manually.</string>
<string id="36012">Could not detect the CEC adapter.</string>
<string id="36013">Unsupported libcec interface version. %d is greater than the version XBMC supports (%d)</string>
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 @@
<string id="36007">Käynnistä laitteet kun XBMC käynnistetään</string>
<string id="36008">Sammuta laitteet kun XBMC sammutetaan</string>
<string id="36009">Aseta laitteet valmiustilaan näytönsäästäjän aktivoituessa</string>
- <string id="36010">Aseta laite toimettomaksi lähteeksi kun XBMC sammutetaan</string>
+ <string id="36010"></string>
<string id="36011">CEC-porttia ei havaittu. Määritä se käsin.</string>
<string id="36012">CEC-sovitinta ei havaittu.</string>
<string id="36013">Ei tuettu libcec-rajapinnan versio. %d on suurempi kuin versio, jota XBMC tukee (%d)</string>
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 @@
<string id="36007">Geräte anschalten wenn XBMC startet</string>
<string id="36008">Geräte ausschalten wenn XBMC beendet wird</string>
<string id="36009">Geräte in den Standby versetzen wenn der Bilschirmschoner aktiviert wird</string>
- <string id="36010">Als inaktiv markieren wenn XBMC beendet wird</string>
+ <string id="36010"></string>
<string id="36011">Der CEC Port konnte nicht gefunden werden. Manuell einstellen.</string>
<string id="36012">Der CEC Adapter konnte nicht gefunden werden.</string>
<string id="36013">Nicht unterstützte libcec Version. %d ist größer als die von XBMC unterstützte Version (%d)</string>
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 @@
<string id="36007">Power on devices when starting XBMC</string>
<string id="36008">Power off devices when stopping XBMC</string>
<string id="36009">Put devices in standby mode when activating screensaver</string>
- <string id="36010">Set as inactive source when stopping XBMC</string>
+ <string id="36010"></string>
<string id="36011">Could not detect the CEC port. Set it up manually.</string>
<string id="36012">Could not detect the CEC adapter.</string>
<string id="36013">Unsupported libcec interface version. %d is greater than the version XBMC supports (%d)</string>
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 @@
<string id="36007">Vključi TV ob zagonu XBMC</string>
<string id="36008">Izključi naprave ob izhodu iz XBMC</string>
<string id="36009">Postavi naprave v stanje pripravljenosti ob ohranjevalniku zaslona</string>
- <string id="36010">Nastavi kot neaktiven vir ob izhodu iz XBMC</string>
+ <string id="36010"></string>
<string id="36011">Ni mogoče zaznati vrat CEC. Nastavite jih ročno.</string>
<string id="36012">Ni mogoče zaznati adapterja CEC.</string>
<string id="36013">Nepodprta različica libcec. %d je višja, kot jo podpira XBMC (%d)</string>
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 @@
<string id="36007">XBMC başlatılınca Televizyonu aç</string>
<string id="36008">XBMC durdurulunca aygıtı kapat</string>
<string id="36009">Ekran koruyucu devreye girince aygıtı bekleme moduna geçir</string>
- <string id="36010">XBMC durdurulunca etkin olmayan kaynak olarak ayarla</string>
+ <string id="36010"></string>
<string id="36011">CEC portu algılanamadı. El ile ayarla.</string>
<string id="36012">CEC bağdaştırıcısı algılanamadı.</string>
<string id="36013">Desteklenmeyen libcec arabirim sürümü. %d is greater than the version XBMC supports (%d)</string>
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 @@
<setting key="cec_power_on_startup" type="bool" value="1" label="36007" />
<setting key="cec_power_off_shutdown" type="bool" value="1" label="36008" />
<setting key="cec_standby_screensaver" type="bool" value="1" label="36009" />
- <setting key="cec_mark_inactive_shutdown" type="bool" value="0" label="36010" />
<setting key="standby_pc_on_tv_standby" type="bool" value="1" label="36014" />
<setting key="cec_debug_logging" type="bool" value="0" label="20191" />
- <setting key="use_tv_menu_language" type="bool" value="1" label="36018" />
+ <setting key="use_tv_menu_language" type="bool" value="1" label="36018" />
+ <setting key="connected_device" type="int" label="21373" value="0" min="0" max="15" step="1" />
</peripheral>
</peripherals>
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<CPeripheral *> 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<CPeripheral *> 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<CPeripheral *> 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 <cec.h>
@@ -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<CEC::cec_keypress> m_buttonQueue;
+ std::queue<CecVolumeChange> m_volumeChangeQueue;
+ unsigned int m_lastKeypress;
+ CecVolumeChange m_lastChange;
CCriticalSection m_critSection;
};
}
--
1.7.5.4

View File

@ -1,76 +0,0 @@
From a9b48dfd39366c86ac79afb0ed545d1c234165a8 Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sat, 10 Dec 2011 12:20:15 +0100
Subject: [PATCH 1/2] vdpau: lock graphics context when accessing x11 display
---
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
index 17a988b..ee02947 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
@@ -670,6 +670,8 @@ void CVDPAU::SetDeinterlacing()
void CVDPAU::InitVDPAUProcs()
{
+ CSingleLock glock(g_graphicsContext);
+
char* error;
(void)dlerror();
@@ -687,7 +689,6 @@ void CVDPAU::InitVDPAUProcs()
if (dl_vdp_device_create_x11)
{
- CSingleLock lock(g_graphicsContext);
m_Display = g_Windowing.GetDisplay();
}
@@ -776,6 +777,8 @@ void CVDPAU::InitVDPAUProcs()
void CVDPAU::FiniVDPAUProcs()
{
+ CSingleLock glock(g_graphicsContext);
+
while (!m_videoSurfaces.empty())
{
vdpau_render_state *render = m_videoSurfaces.back();
@@ -928,6 +931,8 @@ bool CVDPAU::ConfigOutputMethod(AVCodecContext *avctx, AVFrame *pFrame)
FiniOutputMethod();
+ CSingleLock glock(g_graphicsContext);
+
MakePixmap(avctx->width,avctx->height);
vdp_st = vdp_presentation_queue_target_create_x11(vdp_device,
@@ -976,6 +981,8 @@ bool CVDPAU::ConfigOutputMethod(AVCodecContext *avctx, AVFrame *pFrame)
bool CVDPAU::FiniOutputMethod()
{
+ CSingleLock glock(g_graphicsContext);
+
VdpStatus vdp_st;
if (vdp_flip_queue != VDP_INVALID_HANDLE)
--
1.7.5.4
From 8da716c22f8bd8e3ff9a235e134a7a88de3fac6b Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sat, 10 Dec 2011 12:21:35 +0100
Subject: [PATCH 2/2] lock graphics context when polling events, display
connection might be in use by e.g. vdpau
---
xbmc/windowing/WinEventsSDL.cpp | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/xbmc/windowing/WinEventsSDL.cpp b/xbmc/windowing/WinEventsSDL.cpp
index afff390..2e8b869 100644
--
1.7.5.4