vdr-plugin-streamdev/server/suspend.c
schmirl 84f994384a - use cThread::Running()/Active() instead of private members
- replaced the last usleep by cCondWait
thanks to Rolf Ahrenberg (#383)
Modified Files:
 Tag: v0_4
	CONTRIBUTORS HISTORY server/server.c server/server.h
	server/streamer.c server/streamer.h server/suspend.c
	server/suspend.h
2008-10-22 11:59:35 +00:00

58 lines
981 B
C

/*
* $Id: suspend.c,v 1.2.2.1 2008/10/22 11:59:37 schmirl Exp $
*/
#include "server/suspend.h"
#include "server/suspend.dat"
#include "common.h"
cSuspendLive::cSuspendLive(void)
: cThread("Streamdev: server suspend")
{
}
cSuspendLive::~cSuspendLive() {
Stop();
Detach();
}
void cSuspendLive::Activate(bool On) {
Dprintf("Activate cSuspendLive %d\n", On);
if (On)
Start();
else
Stop();
}
void cSuspendLive::Stop(void) {
if (Running())
Cancel(3);
}
void cSuspendLive::Action(void) {
while (Running()) {
DeviceStillPicture(suspend_mpg, sizeof(suspend_mpg));
cCondWait::SleepMs(100);
}
}
bool cSuspendCtl::m_Active = false;
cSuspendCtl::cSuspendCtl(void):
cControl(m_Suspend = new cSuspendLive) {
m_Active = true;
}
cSuspendCtl::~cSuspendCtl() {
m_Active = false;
DELETENULL(m_Suspend);
}
eOSState cSuspendCtl::ProcessKey(eKeys Key) {
if (!m_Suspend->Active() || Key == kBack) {
DELETENULL(m_Suspend);
return osEnd;
}
return osContinue;
}