if (state == S_PLAY) return;
lock();
bool doUnlock = false;
- if (state == S_PAUSE) doUnlock = true;
+ if (state == S_PAUSE_P) doUnlock = true;
switchState(S_PLAY);
if (doUnlock) unLock();
}
{
if (!initted) return;
lock();
- if (state == S_PAUSE) switchState(S_PLAY);
- else switchState(S_PAUSE);
+
+ if ((state == S_FFWD) || (state == S_FBWD))
+ {
+ switchState(S_PAUSE_I);
+ }
+ else if ((state == S_PAUSE_I) || (state == S_PAUSE_P))
+ {
+ switchState(S_PLAY);
+ }
+ else
+ {
+ switchState(S_PAUSE_P);
+ }
+
unLock();
}
{
return;
}
- case S_PAUSE: // to S_PAUSE
+ case S_PAUSE_P: // to S_PAUSE_P
{
video->pause();
audio->pause();
- state = S_PAUSE;
+ state = S_PAUSE_P;
+ return;
+ }
+ case S_PAUSE_I: // to S_PAUSE_I
+ {
+ // can't occur
return;
}
case S_FFWD: // to S_FFWD
}
}
}
- case S_PAUSE: // from S_PAUSE -----------------------------------
+ case S_PAUSE_P: // from S_PAUSE_P -----------------------------------
{
switch(toState)
{
case S_PLAY: // to S_PLAY
{
- if (threadIsActive())
- {
- video->unPause();
- audio->unPause();
- state = S_PLAY;
- }
- else
- {
- state = S_PLAY;
- restartAtFrame(currentFrameNumber);
- }
-
+ video->unPause();
+ audio->unPause();
+ state = S_PLAY;
+ return;
+ }
+ case S_PAUSE_P: // to S_PAUSE_P
+ {
return;
}
- case S_PAUSE: // to S_PAUSE
+ case S_PAUSE_I: // to S_PAUSE_I
{
return;
}
audio->systemMuteOn();
vfeed.stop();
afeed.stop();
- if (threadIsActive()) threadStop();
+ threadStop();
video->unPause();
audio->unPause();
state = S_FFWD;
audio->systemMuteOn();
vfeed.stop();
afeed.stop();
- if (threadIsActive()) threadStop();
+ threadStop();
video->unPause();
audio->unPause();
state = S_FBWD;
{
vfeed.stop();
afeed.stop();
- if (threadIsActive()) threadStop();
+ threadStop();
video->stop();
video->blank();
audio->stop();
audio->unPause();
demuxer->reset();
audio->systemMuteOff();
- state = S_FFWD;
+ state = S_STOP;
return;
}
case S_JUMP: // to S_JUMP
}
}
}
+ case S_PAUSE_I: // from S_PAUSE_I -----------------------------------
+ {
+ switch(toState)
+ {
+ case S_PLAY: // to S_PLAY
+ {
+ state = S_PLAY;
+ restartAtFrame(currentFrameNumber);
+ return;
+ }
+ case S_PAUSE_P: // to S_PAUSE_P
+ {
+ return;
+ }
+ case S_PAUSE_I: // to S_PAUSE_I
+ {
+ return;
+ }
+ case S_FFWD: // to S_FFWD
+ {
+ state = S_FFWD;
+ threadStart();
+ return;
+ }
+ case S_FBWD: // to S_FBWD
+ {
+ state = S_FBWD;
+ threadStart();
+ return;
+ }
+ case S_STOP: // to S_STOP
+ {
+ video->stop();
+ video->blank();
+ audio->stop();
+ video->reset();
+ demuxer->reset();
+ audio->systemMuteOff();
+ state = S_STOP;
+ return;
+ }
+ case S_JUMP: // to S_JUMP
+ {
+ state = S_PLAY;
+ restartAtFrame(jumpFrame);
+ return;
+ }
+ }
+ }
case S_FFWD: // from S_FFWD -----------------------------------
{
switch(toState)
restartAtFrame(currentFrameNumber);
return;
}
- case S_PAUSE: // to S_PAUSE
+ case S_PAUSE_P: // to S_PAUSE_P
+ {
+ // can't occur
+ return;
+ }
+ case S_PAUSE_I: // to S_PAUSE_I
{
threadStop();
- state = S_PAUSE;
+ state = S_PAUSE_I;
return;
}
case S_FFWD: // to S_FFWD
restartAtFrame(currentFrameNumber);
return;
}
- case S_PAUSE: // to S_PAUSE
+ case S_PAUSE_P: // to S_PAUSE_P
+ {
+ // can't occur
+ return;
+ }
+ case S_PAUSE_I: // to S_PAUSE_I
{
threadStop();
- state = S_PAUSE;
+ state = S_PAUSE_I;
return;
}
case S_FFWD: // to S_FFWD
}
return;
}
- case S_PAUSE: // to S_PAUSE
+ case S_PAUSE_P: // to S_PAUSE_P
+ {
+ return;
+ }
+ case S_PAUSE_I: // to S_PAUSE_I
{
return;
}
logger->log("Player", Log::DEBUG, "LOCKED");
#else
- WaitForSingleObject(mutex, INFINITE );
+ WaitForSingleObject(mutex, INFINITE);
#endif
}
void call(void*); // for callback interface
const static UCHAR S_PLAY = 1;
- const static UCHAR S_PAUSE = 2;
- const static UCHAR S_FFWD = 3;
- const static UCHAR S_FBWD = 4;
- const static UCHAR S_STOP = 5;
- const static UCHAR S_JUMP = 6;
+ const static UCHAR S_PAUSE_P = 2;
+ const static UCHAR S_PAUSE_I = 3;
+ const static UCHAR S_FFWD = 4;
+ const static UCHAR S_FBWD = 5;
+ const static UCHAR S_STOP = 6;
+ const static UCHAR S_JUMP = 7;
#ifdef DEV
void test1();
Play, Pause, FFwd, FBwd, (Stop), [Jump]
- Possible Working
-
-Play -> Pause * *
- -> FFwd * *
- -> FBwd * *
- -> Stop * *
- -> Jump * *
-
- From prev.play / prev.fast
-
-Pause -> Play * * *
- -> FFwd * * *
- -> FBwd * * *
- -> Stop * * *
- -> Jump * * *
-
-FFwd -> Play * *
- -> Pause * *
- -> FBwd * *
- -> Stop * *
- -> Jump * *
-
-FBwd -> Play * *
- -> Pause * *
- -> FFwd * *
- -> Stop * *
- -> Jump * *
-
-Stop -> Play * *
- -> Pause
- -> FFwd
- -> FBwd
- -> Jump
-
-Jump -> Play
- -> Pause
- -> FFwd
- -> FBwd
- -> Stop
+ Possible Working
+
+Play -> PauseP * *
+ -> PauseI
+ -> FFwd * *
+ -> FBwd * *
+ -> Stop * *
+ -> Jump * *
+
+PauseP -> Play * *
+ -> PauseI
+ -> FFwd * *
+ -> FBwd * *
+ -> Stop * *
+ -> Jump * *
+
+PauseI -> Play * *
+ -> PauseP
+ -> FFwd * *
+ -> FBwd * *
+ -> Stop * *
+ -> Jump * *
+
+FFwd -> Play * *
+ -> PauseP
+ -> PauseI * *
+ -> FBwd * *
+ -> Stop * *
+ -> Jump * *
+
+FBwd -> Play * *
+ -> PauseP
+ -> PauseI * *
+ -> FFwd * *
+ -> Stop * *
+ -> Jump * *
+
+Stop -> Play * *
+ -> PauseP
+ -> PauseI
+ -> FFwd
+ -> FBwd
+ -> Jump
+
+Jump -> Play
+ -> PauseP
+ -> PauseI
+ -> FFwd
+ -> FBwd
+ -> Stop
*/
else
{
UCHAR playerState = player->getState();
- if (playerState == Player::S_PAUSE) w.nextSymbol = WSymbol::PAUSE;
- else if (playerState == Player::S_FFWD) w.nextSymbol = WSymbol::FFWD;
- else if (playerState == Player::S_FBWD) w.nextSymbol = WSymbol::FBWD;
- else w.nextSymbol = WSymbol::PLAY;
+ if (playerState == Player::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
+ else if (playerState == Player::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
+ else if (playerState == Player::S_FFWD) w.nextSymbol = WSymbol::FFWD;
+ else if (playerState == Player::S_FBWD) w.nextSymbol = WSymbol::FBWD;
+ else w.nextSymbol = WSymbol::PLAY;
}
w.draw();