summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-03-02 10:43:26 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-03-02 10:43:26 +0100
commitc8808a854b58a6370baba41a8a0de97f1d4f73fd (patch)
tree4e89f2fbf16e43374ae38db6986b852a7bc46d02
parent28bc34b245ffdf0c205f0c5f2624e5c7d94d3c54 (diff)
downloadvdr-c8808a854b58a6370baba41a8a0de97f1d4f73fd.tar.gz
vdr-c8808a854b58a6370baba41a8a0de97f1d4f73fd.tar.bz2
Added a Query parameter to cDevice::GetDevice(), so that devices can be queried without side effects when zapping
-rw-r--r--HISTORY2
-rw-r--r--device.c8
-rw-r--r--device.h8
-rw-r--r--menu.c4
4 files changed, 14 insertions, 8 deletions
diff --git a/HISTORY b/HISTORY
index 611f0c42..fbcc0760 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6944,3 +6944,5 @@ Video Disk Recorder Revision History
attached to the device. Its boolean parameter has no meaning any more.
+ The default value for the Priority parameter of the function cDevice::ProvidesChannel()
has been changed to IDLEPRIORITY.
+- Added a Query parameter to cDevice::GetDevice(), so that devices can be queried
+ without side effects when zapping.
diff --git a/device.c b/device.c
index 7fefbf26..9a0e4f6b 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.c 2.52 2012/03/02 10:18:44 kls Exp $
+ * $Id: device.c 2.53 2012/03/02 10:33:35 kls Exp $
*/
#include "device.h"
@@ -226,7 +226,7 @@ static int GetClippedNumProvidedSystems(int AvailableBits, cDevice *Device)
return NumProvidedSystems;
}
-cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView)
+cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView, bool Query)
{
cDevice *AvoidDevice = avoidDevice;
avoidDevice = NULL;
@@ -301,7 +301,7 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView
if (!NumUsableSlots)
break; // no CAM necessary, so just one loop over the devices
}
- if (d) {
+ if (d && !Query) {
if (NeedsDetachReceivers)
d->DetachAllReceivers();
if (s) {
@@ -687,7 +687,7 @@ bool cDevice::SwitchChannel(int Direction)
cChannel *channel;
while ((channel = Channels.GetByNumber(n, Direction)) != NULL) {
// try only channels which are currently available
- if (GetDevice(channel, LIVEPRIORITY, true))
+ if (GetDevice(channel, LIVEPRIORITY, true, true))
break;
n = channel->Number() + Direction;
}
diff --git a/device.h b/device.h
index e01ede3c..23aea970 100644
--- a/device.h
+++ b/device.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.h 2.35 2012/02/29 12:19:28 kls Exp $
+ * $Id: device.h 2.36 2012/03/02 10:23:13 kls Exp $
*/
#ifndef __DEVICE_H
@@ -139,7 +139,7 @@ public:
///< Gets the device with the given Index.
///< \param Index must be in the range 0..numDevices-1.
///< \return A pointer to the device, or NULL if the Index was invalid.
- static cDevice *GetDevice(const cChannel *Channel, int Priority, bool LiveView);
+ static cDevice *GetDevice(const cChannel *Channel, int Priority, bool LiveView, bool Query = false);
///< Returns a device that is able to receive the given Channel at the
///< given Priority, with the least impact on active recordings and
///< live viewing. The LiveView parameter tells whether the device will
@@ -153,6 +153,10 @@ public:
///< after detaching any receivers because the channel can't be decrypted,
///< this device/CAM combination will be skipped in the next call to
///< GetDevice().
+ ///< If Query is true, no actual CAM assignments or receiver detachments will
+ ///< be done, so that this function can be called without any side effects
+ ///< in order to just determine whether a device is available for the given
+ ///< Channel.
///< See also ProvidesChannel().
static void SetAvoidDevice(cDevice *Device) { avoidDevice = Device; }
///< Sets the given Device to be temporarily avoided in the next call to
diff --git a/menu.c b/menu.c
index 053e4e74..7866bc3d 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 2.38 2012/02/25 13:50:49 kls Exp $
+ * $Id: menu.c 2.39 2012/03/02 10:33:17 kls Exp $
*/
#include "menu.h"
@@ -3653,7 +3653,7 @@ cChannel *cDisplayChannel::NextAvailableChannel(cChannel *Channel, int Direction
Channel = Direction > 0 ? Channels.Next(Channel) : Channels.Prev(Channel);
if (!Channel && Setup.ChannelsWrap)
Channel = Direction > 0 ? Channels.First() : Channels.Last();
- if (Channel && !Channel->GroupSep() && cDevice::GetDevice(Channel, LIVEPRIORITY, true))
+ if (Channel && !Channel->GroupSep() && cDevice::GetDevice(Channel, LIVEPRIORITY, true, true))
return Channel;
}
}