Skip to content

Commit

Permalink
add UnPause and real Pause method on ApplicationMessenger
Browse files Browse the repository at this point in the history
  • Loading branch information
ulion committed Mar 7, 2013
1 parent 1297e20 commit d2232df
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions xbmc/ApplicationMessenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,15 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
}
break;

case TMSG_MEDIA_PAUSE_IF_PLAYING:
if (g_application.IsPlaying() && !g_application.IsPaused())
{
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS();
g_application.m_pPlayer->Pause();
}
break;

case TMSG_SWITCHTOFULLSCREEN:
if( g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO )
g_application.SwitchToFullScreen();
Expand Down Expand Up @@ -929,6 +938,18 @@ void CApplicationMessenger::MediaPause()
SendMessage(tMsg, true);
}

void CApplicationMessenger::MediaUnPause()
{
ThreadMessage tMsg = {TMSG_MEDIA_UNPAUSE};
SendMessage(tMsg, true);
}

void CApplicationMessenger::MediaPauseIfPlaying()
{
ThreadMessage tMsg = {TMSG_MEDIA_PAUSE_IF_PLAYING};
SendMessage(tMsg, true);
}

void CApplicationMessenger::MediaRestart(bool bWait)
{
ThreadMessage tMsg = {TMSG_MEDIA_RESTART};
Expand Down
4 changes: 4 additions & 0 deletions xbmc/ApplicationMessenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ namespace MUSIC_INFO

#define TMSG_MEDIA_PLAY 200
#define TMSG_MEDIA_STOP 201
// the PAUSE is indeed a PLAYPAUSE
#define TMSG_MEDIA_PAUSE 202
#define TMSG_MEDIA_RESTART 203
#define TMSG_MEDIA_UNPAUSE 204
#define TMSG_MEDIA_PAUSE_IF_PLAYING 205

#define TMSG_PLAYLISTPLAYER_PLAY 210
#define TMSG_PLAYLISTPLAYER_NEXT 211
Expand Down Expand Up @@ -168,6 +170,8 @@ class CApplicationMessenger
void MediaPlay(int playlistid, int song = -1);
void MediaStop(bool bWait = true, int playlistid = -1);
void MediaPause();
void MediaUnPause();
void MediaPauseIfPlaying();
void MediaRestart(bool bWait);

void PlayListPlayerPlay();
Expand Down

2 comments on commit d2232df

@Memphiz
Copy link

@Memphiz Memphiz commented on d2232df Mar 8, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhh any reason we don't rename MEDIA_PAUSE to MEDIA_PLAYPAUSE and name the real pause MEDIA_PAUSE instead? Based on your comment this sounds logical.

@ulion
Copy link
Owner Author

@ulion ulion commented on d2232df Mar 8, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.