Skip to content
This repository
Browse code

jsonrpc: only close the specified player (fixes #13936)

  • Loading branch information...
commit c79c5d5ba71155d7bb18c7bf0d99f695534de8c1 1 parent 90105fa
Sascha Montellese authored January 09, 2013
19  xbmc/ApplicationMessenger.cpp
@@ -468,9 +468,19 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
468 468
     case TMSG_MEDIA_STOP:
469 469
       {
470 470
         // restore to previous window if needed
471  
-        if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW ||
472  
-            g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
473  
-            g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
  471
+        bool stopSlideshow = true;
  472
+        bool stopVideo = true;
  473
+        bool stopMusic = true;
  474
+        if (pMsg->dwParam1 >= 0)
  475
+        {
  476
+          stopSlideshow = (pMsg->dwParam1 == PLAYLIST_PICTURE);
  477
+          stopVideo = (pMsg->dwParam1 == PLAYLIST_VIDEO);
  478
+          stopMusic = (pMsg->dwParam1 == PLAYLIST_MUSIC);
  479
+        }
  480
+
  481
+        if ((stopSlideshow && g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW) ||
  482
+            (stopVideo && g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) ||
  483
+            (stopMusic && g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION))
474 484
           g_windowManager.PreviousWindow();
475 485
 
476 486
         g_application.ResetScreenSaver();
@@ -890,9 +900,10 @@ void CApplicationMessenger::PlayFile(const CFileItem &item, bool bRestart /*= fa
890 900
   SendMessage(tMsg, false);
891 901
 }
892 902
 
893  
-void CApplicationMessenger::MediaStop(bool bWait /* = true */)
  903
+void CApplicationMessenger::MediaStop(bool bWait /* = true */, int playlistid /* = -1 */)
894 904
 {
895 905
   ThreadMessage tMsg = {TMSG_MEDIA_STOP};
  906
+  tMsg.dwParam1 = playlistid;
896 907
   SendMessage(tMsg, bWait);
897 908
 }
898 909
 
2  xbmc/ApplicationMessenger.h
@@ -165,7 +165,7 @@ class CApplicationMessenger
165 165
   void MediaPlay(const CFileItem &item);
166 166
   void MediaPlay(const CFileItemList &item, int song = 0);
167 167
   void MediaPlay(int playlistid, int song = -1);
168  
-  void MediaStop(bool bWait = true);
  168
+  void MediaStop(bool bWait = true, int playlistid = -1);
169 169
   void MediaPause();
170 170
   void MediaRestart(bool bWait);
171 171
 
2  xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -262,7 +262,7 @@ JSONRPC_STATUS CPlayerOperations::Stop(const CStdString &method, ITransportLayer
262 262
   {
263 263
     case Video:
264 264
     case Audio:
265  
-      CApplicationMessenger::Get().SendAction(CAction(ACTION_STOP));
  265
+      CApplicationMessenger::Get().MediaStop(true, parameterObject["playerid"].asInteger());
266 266
       return ACK;
267 267
 
268 268
     case Picture:

0 notes on commit c79c5d5

ulion

dwParam1 is unsigned, the code will always set three stop bools false?

jmarshallnz

I suspect we want pMsg->dwParam1 > 0 ? @Montellese?

ulion

PLAYLIST_MUSIC is 0, default dwParam1 transfered in is (-1), but dwParam1 defined as DWORD which indeed is unsigned int

Sascha Montellese

Right, didn't know it was an unsigned integer. > 0 won't work because PLAYLIST_MUSIC is defined to 0 and PLAYLIST_NONE is defined to -1. So probably set dwParam1 to PLAYLIST_NONE and then do

if (pMsg->dwParam1 != PLAYLIST_NONE)

I'll look into it in a bit.

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