Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

cec: wake the screensaver when XBMC was made the active source. #1211

Merged
merged 3 commits into from

4 participants

@opdenkamp
Collaborator

does what the title says.

@elupus
Collaborator
@mkortstiege
Collaborator

Jep.

@opdenkamp opdenkamp was assigned
@opdenkamp
Collaborator

thanks, assigned to the august milestone

@Memphiz
Owner

looks good

@opdenkamp
Collaborator

I've added one more commit, that also does what the title says ;-)
optionally pauses playback when switching to another source, and resumes playback when switching back to xbmc

@opdenkamp
Collaborator

well, 2 more instead of 1 :) mapped two more unmapped buttons

@opdenkamp opdenkamp merged commit 22e12a7 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 24, 2012
  1. @opdenkamp
Commits on Jul 31, 2012
  1. @opdenkamp

    cec: optionally pause playback when switching to another source, and …

    opdenkamp authored
    …resume playback when switching back to XBMC
  2. @opdenkamp

    cec: map the data (teletext) button to XINPUT_IR_REMOTE_TELETEXT and …

    opdenkamp authored
    …subpicture to XINPUT_IR_REMOTE_SUBTITLE
This page is out of date. Refresh to see the latest.
View
4 language/English/strings.po
@@ -9499,3 +9499,7 @@ msgctxt "#36032"
msgid "The port is busy. Only one program can access the CEC adapter"
msgstr ""
+msgctxt "#36033"
+msgid "Pause playback when switching to another source"
+msgstr ""
+
View
9 system/peripherals.xml
@@ -19,10 +19,11 @@
<setting key="standby_tv_on_pc_standby" type="bool" value="1" label="36026" order="7" />
<setting key="send_inactive_source" type="bool" value="1" label="36025" order="8" />
<setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="9" />
- <setting key="physical_address" type="string" label="36021" value="0" order="10" />
- <setting key="cec_hdmi_port" type="int" value="1" min="1" max="15" label="36015" order="11" />
- <setting key="connected_device" type="int" label="36019" value="0" min="0" max="15" step="1" order="12" />
- <setting key="port" type="string" value="" label="36022" order="13" />
+ <setting key="pause_playback_on_deactivate" type="bool" value="1" label="36033" order="10" />
+ <setting key="physical_address" type="string" label="36021" value="0" order="11" />
+ <setting key="cec_hdmi_port" type="int" value="1" min="1" max="15" label="36015" order="12" />
+ <setting key="connected_device" type="int" label="36019" value="0" min="0" max="15" step="1" order="13" />
+ <setting key="port" type="string" value="" label="36022" order="14" />
<setting key="tv_vendor" type="int" value="0" configurable="0" />
<setting key="device_name" type="string" value="XBMC" configurable="0" />
View
42 xbmc/peripherals/devices/PeripheralCecAdapter.cpp
@@ -28,9 +28,11 @@
#include "DynamicDll.h"
#include "threads/SingleLock.h"
#include "dialogs/GUIDialogKaiToast.h"
+#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
#include "peripherals/Peripherals.h"
#include "peripherals/bus/PeripheralBus.h"
+#include "pictures/GUIWindowSlideShow.h"
#include "settings/GUISettings.h"
#include "settings/Settings.h"
#include "utils/log.h"
@@ -186,6 +188,7 @@ bool CPeripheralCecAdapter::InitialiseFeature(const PeripheralFeature feature)
m_callbacks.CBCecCommand = &CecCommand;
m_callbacks.CBCecConfigurationChanged = &CecConfiguration;
m_callbacks.CBCecAlert = &CecAlert;
+ m_callbacks.CBCecSourceActivated = &CecSourceActivated;
m_configuration.callbackParam = this;
m_configuration.callbacks = &m_callbacks;
@@ -1032,6 +1035,14 @@ void CPeripheralCecAdapter::PushCecKeypress(const cec_keypress &key)
xbmcKey.iButton = XINPUT_IR_REMOTE_TITLE; // context menu
PushCecKeypress(xbmcKey);
break;
+ case CEC_USER_CONTROL_CODE_DATA:
+ xbmcKey.iButton = XINPUT_IR_REMOTE_TELETEXT;
+ PushCecKeypress(xbmcKey);
+ break;
+ case CEC_USER_CONTROL_CODE_SUB_PICTURE:
+ xbmcKey.iButton = XINPUT_IR_REMOTE_SUBTITLE;
+ PushCecKeypress(xbmcKey);
+ break;
case CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION:
case CEC_USER_CONTROL_CODE_EJECT:
case CEC_USER_CONTROL_CODE_INPUT_SELECT:
@@ -1040,7 +1051,6 @@ void CPeripheralCecAdapter::PushCecKeypress(const cec_keypress &key)
case CEC_USER_CONTROL_CODE_STOP_RECORD:
case CEC_USER_CONTROL_CODE_PAUSE_RECORD:
case CEC_USER_CONTROL_CODE_ANGLE:
- case CEC_USER_CONTROL_CODE_SUB_PICTURE:
case CEC_USER_CONTROL_CODE_VIDEO_ON_DEMAND:
case CEC_USER_CONTROL_CODE_TIMER_PROGRAMMING:
case CEC_USER_CONTROL_CODE_PLAY_FUNCTION:
@@ -1057,7 +1067,6 @@ void CPeripheralCecAdapter::PushCecKeypress(const cec_keypress &key)
case CEC_USER_CONTROL_CODE_POWER_TOGGLE_FUNCTION:
case CEC_USER_CONTROL_CODE_POWER_OFF_FUNCTION:
case CEC_USER_CONTROL_CODE_F5:
- case CEC_USER_CONTROL_CODE_DATA:
case CEC_USER_CONTROL_CODE_UNKNOWN:
default:
break;
@@ -1126,6 +1135,35 @@ void CPeripheralCecAdapter::OnSettingChanged(const CStdString &strChangedSetting
}
}
+void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_logical_address address, const uint8_t activated)
+{
+ CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
+ if (!adapter)
+ return;
+
+ // wake up the screensaver, so the user doesn't switch to a black screen
+ if (activated == 1)
+ g_application.WakeUpScreenSaverAndDPMS();
+
+ if (adapter->GetSettingBool("pause_playback_on_deactivate"))
+ {
+ bool bShowingSlideshow = (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW);
+ CGUIWindowSlideShow *pSlideShow = bShowingSlideshow ? (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW) : NULL;
+
+ if (pSlideShow)
+ {
+ // pause/resume slideshow
+ pSlideShow->OnAction(CAction(ACTION_PAUSE));
+ }
+ else if ((g_application.IsPlaying() && activated == 0) ||
+ (g_application.IsPaused() && activated == 1))
+ {
+ // pause/resume player
+ CApplicationMessenger::Get().MediaPause();
+ }
+ }
+}
+
int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message &message)
{
CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
View
1  xbmc/peripherals/devices/PeripheralCecAdapter.h
@@ -123,6 +123,7 @@ namespace PERIPHERALS
static int CecCommand(void *cbParam, const CEC::cec_command &command);
static int CecConfiguration(void *cbParam, const CEC::libcec_configuration &config);
static int CecAlert(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter &data);
+ static void CecSourceActivated(void *param, const CEC::cec_logical_address address, const uint8_t activated);
bool IsRunning(void) const;
void ReopenConnection(void);
Something went wrong with that request. Please try again.