diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-10-16 14:02:34 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-10-16 14:02:34 +0200 |
commit | a964269fe9080463cc87aba7b454b6b06b7f8677 (patch) | |
tree | cbfcd3974a56f48241a9de3f68893c5f0c69715b /device.c | |
parent | ae8627e6fc646ae66e9da67066800a6cdf7e9302 (diff) | |
download | vdr-a964269fe9080463cc87aba7b454b6b06b7f8677.tar.gz vdr-a964269fe9080463cc87aba7b454b6b06b7f8677.tar.bz2 |
Implemented 'occupied' for devices
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.42 2011/08/26 12:56:00 kls Exp $ + * $Id: device.c 2.43 2011/10/16 14:01:30 kls Exp $ */ #include "device.h" @@ -95,6 +95,8 @@ cDevice::cDevice(void) camSlot = NULL; startScrambleDetection = 0; + occupiedTimeout = 0; + player = NULL; isPlayingVideo = false; ClrAvailableTracks(); @@ -645,7 +647,7 @@ bool cDevice::IsTunedToTransponder(const cChannel *Channel) bool cDevice::MaySwitchTransponder(void) { - return !Receiving(true) && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid); + return time(NULL) > occupiedTimeout && !Receiving(true) && !(pidHandles[ptAudio].pid || pidHandles[ptVideo].pid || pidHandles[ptDolby].pid); } bool cDevice::SwitchChannel(const cChannel *Channel, bool LiveView) @@ -786,6 +788,18 @@ void cDevice::ForceTransferMode(void) } } +int cDevice::Occupied(void) const +{ + int Seconds = occupiedTimeout - time(NULL); + return Seconds > 0 ? Seconds : 0; +} + +void cDevice::SetOccupied(int Seconds) +{ + if (Seconds >= 0) + occupiedTimeout = time(NULL) + min(Seconds, MAXOCCUPIEDTIMEOUT); +} + bool cDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) { return false; |