Skip to content
Browse files

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

…resume playback when switching back to XBMC
  • Loading branch information...
1 parent 5cea3da commit bcef616622e75c7abd1079e2d33453cc2fcc12cd @opdenkamp opdenkamp committed
Showing with 34 additions and 5 deletions.
  1. +4 −0 language/English/strings.po
  2. +5 −4 system/peripherals.xml
  3. +25 −1 xbmc/peripherals/devices/PeripheralCecAdapter.cpp
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
26 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"
@@ -1127,11 +1129,33 @@ void CPeripheralCecAdapter::OnSettingChanged(const CStdString &strChangedSetting
}
}
-void CPeripheralCecAdapter::CecSourceActivated(void *param, const CEC::cec_logical_address address, const uint8_t activated)
+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)

0 comments on commit bcef616

Please sign in to comment.
Something went wrong with that request. Please try again.