1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
From 6544830d1a0b9810c2feb2fcb34df3f90b010d2f Mon Sep 17 00:00:00 2001
From: Lars Op den Kamp <lars@opdenkamp.eu>
Date: Mon, 27 Oct 2014 21:01:00 +0100
Subject: [PATCH 4/8] [CEC] fixed: don't return garbage from CEC related app
messenger methods see
https://github.com/xbmc/xbmc/commit/19d37944ca2a2ac2f3e71a40a94e9ea289d8f2db#commitcomment-8248480
---
xbmc/Application.cpp | 14 ++++++++------
xbmc/ApplicationMessenger.cpp | 20 +++++---------------
xbmc/ApplicationMessenger.h | 4 ++--
3 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index d5604dc..4d26183 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -2351,16 +2351,18 @@
if (StringUtils::StartsWithNoCase(action.GetName(),"CECToggleState") || StringUtils::StartsWithNoCase(action.GetName(),"CECStandby"))
{
- bool ret = true;
-
- CLog::Log(LOGDEBUG, "%s: action %s [%d], toggling state of playing device", __FUNCTION__, action.GetName().c_str(), action.GetID());
// do not wake up the screensaver right after switching off the playing device
if (StringUtils::StartsWithNoCase(action.GetName(),"CECToggleState"))
- ret = CApplicationMessenger::Get().CECToggleState();
+ {
+ CLog::Log(LOGDEBUG, "%s: action %s [%d], toggling state of playing device", __FUNCTION__, action.GetName().c_str(), action.GetID());
+ if (!CApplicationMessenger::Get().CECToggleState())
+ return true;
+ }
else
- ret = CApplicationMessenger::Get().CECStandby();
- if (!ret) /* display is switched off */
+ {
+ CApplicationMessenger::Get().CECStandby();
return true;
+ }
}
ResetScreenSaver();
diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp
index 1a59c5c..d228273 100644
--- a/xbmc/ApplicationMessenger.cpp
+++ b/xbmc/ApplicationMessenger.cpp
@@ -843,12 +843,12 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
}
case TMSG_CECACTIVATESOURCE:
{
- *((bool*)pMsg->lpVoid) = g_peripherals.ToggleDeviceState(STATE_ACTIVATE_SOURCE);
+ g_peripherals.ToggleDeviceState(STATE_ACTIVATE_SOURCE);
break;
}
case TMSG_CECSTANDBY:
{
- *((bool*)pMsg->lpVoid) = g_peripherals.ToggleDeviceState(STATE_STANDBY);
+ g_peripherals.ToggleDeviceState(STATE_STANDBY);
break;
}
case TMSG_START_ANDROID_ACTIVITY:
@@ -1396,29 +1396,19 @@ bool CApplicationMessenger::CECToggleState()
ThreadMessage tMsg = {TMSG_CECTOGGLESTATE};
tMsg.lpVoid = (void*)&result;
- SendMessage(tMsg, false);
+ SendMessage(tMsg, true);
return result;
}
-bool CApplicationMessenger::CECActivateSource()
+void CApplicationMessenger::CECActivateSource()
{
- bool result;
-
ThreadMessage tMsg = {TMSG_CECACTIVATESOURCE};
- tMsg.lpVoid = (void*)&result;
SendMessage(tMsg, false);
-
- return result;
}
-bool CApplicationMessenger::CECStandby()
+void CApplicationMessenger::CECStandby()
{
- bool result;
-
ThreadMessage tMsg = {TMSG_CECSTANDBY};
- tMsg.lpVoid = (void*)&result;
SendMessage(tMsg, false);
-
- return result;
}
diff --git a/xbmc/ApplicationMessenger.h b/xbmc/ApplicationMessenger.h
index 9013567..543e065 100644
--- a/xbmc/ApplicationMessenger.h
+++ b/xbmc/ApplicationMessenger.h
@@ -219,8 +219,8 @@ public:
void LoadProfile(unsigned int idx);
bool CECToggleState();
- bool CECActivateSource();
- bool CECStandby();
+ void CECActivateSource();
+ void CECStandby();
CStdString GetResponse();
int SetResponse(CStdString response);
--
2.1.2
|