fix bug that demo can't play when demo pause and use start_video

This commit is contained in:
sirius 2020-03-26 15:51:09 +08:00
parent fb81000351
commit 3c085b53ed
5 changed files with 9 additions and 6 deletions

View file

@ -3314,6 +3314,9 @@ void CClient::Con_StartVideo(IConsole::IResult *pResult, void *pUserData)
{
new CVideo((CGraphics_Threaded*)pSelf->m_pGraphics, pSelf->Storage(), pSelf->m_pConsole, pSelf->Graphics()->ScreenWidth(), pSelf->Graphics()->ScreenHeight(), "");
IVideo::Current()->start();
bool paused = pSelf->m_DemoPlayer.Info()->m_Info.m_Paused;
if(paused)
IVideo::Current()->pause(true);
}
else
pSelf->m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "videorecorder", "Videorecorder already running.");

View file

@ -167,10 +167,10 @@ void CVideo::start()
m_vframe = 0;
}
void CVideo::pause()
void CVideo::pause(bool p)
{
if(ms_pCurrentVideo)
m_Recording ^= true;
m_Recording = !p;
}
void CVideo::stop()

View file

@ -59,7 +59,7 @@ public:
virtual void start();
virtual void stop();
virtual void pause();
virtual void pause(bool p);
virtual void nextVideoFrame();
virtual void nextVideoFrame_thread();

View file

@ -681,7 +681,7 @@ void CDemoPlayer::Pause()
m_Info.m_Info.m_Paused = 1;
#if defined(CONF_VIDEORECORDER)
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
IVideo::Current()->pause();
IVideo::Current()->pause(true);
#endif
}
@ -695,7 +695,7 @@ void CDemoPlayer::Unpause()
}
#if defined(CONF_VIDEORECORDER)
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
IVideo::Current()->pause();
IVideo::Current()->pause(false);
#endif
}

View file

@ -10,7 +10,7 @@ public:
virtual void start() = 0;
virtual void stop() = 0;
virtual void pause() = 0;
virtual void pause(bool p) = 0;
virtual void nextVideoFrame() = 0;
virtual bool frameRendered() = 0;