// Now check with the player if action can be handled.
if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
- (g_windowManager.GetActiveWindow() == WINDOW_DIALOG_VIDEO_OSD && (action.GetID() == ACTION_NEXT_ITEM || action.GetID() == ACTION_PREV_ITEM || action.GetID() == ACTION_CHANNEL_UP || action.GetID() == ACTION_CHANNEL_DOWN)))
+ (g_windowManager.GetActiveWindow() == WINDOW_DIALOG_VIDEO_OSD && (action.GetID() == ACTION_NEXT_ITEM || action.GetID() == ACTION_PREV_ITEM || action.GetID() == ACTION_CHANNEL_UP || action.GetID() == ACTION_CHANNEL_DOWN)) ||
+ action.GetID() == ACTION_STOP)
{
if (m_pPlayer->OnAction(action))
return true;
#include "Application.h"
#include "dialogs/GUIDialogBusy.h"
#include "guilib/GUIWindowManager.h"
+#include "guilib/Key.h"
+#include "dialogs/GUIDialogYesNo.h"
NPT_SET_LOCAL_LOGGER("xbmc.upnp.player")
, m_control(NULL)
, m_delegate(NULL)
, m_started(false)
+, m_stopremote(false)
{
m_control = CUPnP::GetInstance()->m_MediaController;
, m_delegate), failed);
}
+ m_stopremote = true;
m_started = true;
m_callback.OnPlayBackStarted();
NPT_CHECK_LABEL_SEVERE(m_control->GetPositionInfo(m_delegate->m_device
bool CUPnPPlayer::CloseFile(bool reopen)
{
NPT_CHECK_POINTER_LABEL_SEVERE(m_delegate, failed);
- NPT_CHECK_LABEL(m_control->Stop(m_delegate->m_device
- , m_delegate->m_instance
- , m_delegate), failed);
- if(!m_delegate->m_resevent.WaitMSec(10000)) goto failed;
- NPT_CHECK_LABEL(m_delegate->m_resstatus, failed);
- m_callback.OnPlayBackStopped();
+ if(m_stopremote)
+ {
+ NPT_CHECK_LABEL(m_control->Stop(m_delegate->m_device
+ , m_delegate->m_instance
+ , m_delegate), failed);
+ if(!m_delegate->m_resevent.WaitMSec(10000)) goto failed;
+ NPT_CHECK_LABEL(m_delegate->m_resstatus, failed);
+ }
+
+ if(m_started)
+ {
+ m_started = false;
+ m_callback.OnPlayBackStopped();
+ }
+
return true;
failed:
CLog::Log(LOGERROR, "UPNP: CUPnPPlayer::CloseFile - unable to stop playback");
return "";
};
+bool CUPnPPlayer::OnAction(const CAction &action)
+{
+ switch (action.GetID())
+ {
+ case ACTION_STOP:
+ if(IsPlaying())
+ {
+ if(CGUIDialogYesNo::ShowAndGetInput(37022, 37023, 0, 0)) /* stop on remote system */
+ m_stopremote = true;
+ else
+ m_stopremote = false;
+ return false; /* let normal code handle the action */
+ }
+ default:
+ return false;
+ }
+}
+
} /* namespace UPNP */
virtual bool IsCaching() const {return false;};
virtual int GetCacheLevel() const {return -1;};
virtual void DoAudioWork();
-
+ virtual bool OnAction(const CAction &action);
virtual CStdString GetPlayingTitle();
CStdString m_current_uri;
CStdString m_current_meta;
bool m_started;
+ bool m_stopremote;
};
} /* namespace UPNP */