[cec] don't send incorrect pause/resume to slideshow when the source is (de)activated...
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 9 Jan 2013 01:16:55 +0000 (02:16 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 9 Jan 2013 01:16:55 +0000 (02:16 +0100)
xbmc/peripherals/devices/PeripheralCecAdapter.cpp
xbmc/peripherals/devices/PeripheralCecAdapter.h

index 15c0bf2..b3ac396 100644 (file)
@@ -132,6 +132,7 @@ void CPeripheralCecAdapter::ResetMembers(void)
   m_bStandbyPending          = false;
   m_bActiveSourceBeforeStandby = false;
   m_bOnPlayReceived          = false;
+  m_bPlaybackPaused          = false;
 
   m_currentButton.iButton    = 0;
   m_currentButton.iDuration  = 0;
@@ -1198,17 +1199,23 @@ void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_log
   {
     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))
+    bool bPlayingAndDeactivated = activated == 0 && (
+        (pSlideShow && pSlideShow->IsPlaying()) || g_application.IsPlaying());
+    bool bPausedAndActivated = activated == 1 && adapter->m_bPlaybackPaused && (
+        (pSlideShow && pSlideShow->IsPaused()) || g_application.IsPaused());
+    if (bPlayingAndDeactivated)
+      adapter->m_bPlaybackPaused = true;
+    else if (bPausedAndActivated)
+      adapter->m_bPlaybackPaused = false;
+
+    if (bPlayingAndDeactivated || bPausedAndActivated)
     {
-      // pause/resume player
-      CApplicationMessenger::Get().MediaPause();
+      if (pSlideShow)
+        // pause/resume slideshow
+        pSlideShow->OnAction(CAction(ACTION_PAUSE));
+      else
+        // pause/resume player
+        CApplicationMessenger::Get().MediaPause();
     }
   }
 }
index 20e5744..23cd99e 100644 (file)
@@ -170,6 +170,7 @@ namespace PERIPHERALS
     CDateTime                         m_preventActivateSourceOnPlay;
     bool                              m_bActiveSourceBeforeStandby;
     bool                              m_bOnPlayReceived;
+    bool                              m_bPlaybackPaused;
   };
 
   class CPeripheralCecAdapterUpdateThread : public CThread