jsonrpc: only close the specified player (fixes #13936)
authormontellese <montellese@xbmc.org>
Wed, 9 Jan 2013 22:28:57 +0000 (23:28 +0100)
committerS. Davilla <davilla@4pi.com>
Fri, 11 Jan 2013 13:58:42 +0000 (08:58 -0500)
xbmc/ApplicationMessenger.cpp
xbmc/ApplicationMessenger.h
xbmc/interfaces/json-rpc/PlayerOperations.cpp

index 988b887..59c2ee2 100644 (file)
@@ -468,9 +468,19 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
     case TMSG_MEDIA_STOP:
       {
         // restore to previous window if needed
-        if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW ||
-            g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
-            g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
+        bool stopSlideshow = true;
+        bool stopVideo = true;
+        bool stopMusic = true;
+        if (pMsg->dwParam1 >= 0)
+        {
+          stopSlideshow = (pMsg->dwParam1 == PLAYLIST_PICTURE);
+          stopVideo = (pMsg->dwParam1 == PLAYLIST_VIDEO);
+          stopMusic = (pMsg->dwParam1 == PLAYLIST_MUSIC);
+        }
+
+        if ((stopSlideshow && g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW) ||
+            (stopVideo && g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) ||
+            (stopMusic && g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION))
           g_windowManager.PreviousWindow();
 
         g_application.ResetScreenSaver();
@@ -890,9 +900,10 @@ void CApplicationMessenger::PlayFile(const CFileItem &item, bool bRestart /*= fa
   SendMessage(tMsg, false);
 }
 
-void CApplicationMessenger::MediaStop(bool bWait /* = true */)
+void CApplicationMessenger::MediaStop(bool bWait /* = true */, int playlistid /* = -1 */)
 {
   ThreadMessage tMsg = {TMSG_MEDIA_STOP};
+  tMsg.dwParam1 = playlistid;
   SendMessage(tMsg, bWait);
 }
 
index 625a5b3..0bceaaa 100644 (file)
@@ -165,7 +165,7 @@ public:
   void MediaPlay(const CFileItem &item);
   void MediaPlay(const CFileItemList &item, int song = 0);
   void MediaPlay(int playlistid, int song = -1);
-  void MediaStop(bool bWait = true);
+  void MediaStop(bool bWait = true, int playlistid = -1);
   void MediaPause();
   void MediaRestart(bool bWait);
 
index fb2b5e4..89f7b87 100644 (file)
@@ -262,7 +262,7 @@ JSONRPC_STATUS CPlayerOperations::Stop(const CStdString &method, ITransportLayer
   {
     case Video:
     case Audio:
-      CApplicationMessenger::Get().SendAction(CAction(ACTION_STOP));
+      CApplicationMessenger::Get().MediaStop(true, parameterObject["playerid"].asInteger());
       return ACK;
 
     case Picture: