summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-06-18 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-06-18 18:00:00 +0200
commit90bc2f18e3fb72bba792226dfd2a6e245464d2f5 (patch)
tree91c7685580e639523ffd3f79c4993b6b48451e91 /device.c
parent2bb325135433521694b0a387a60225d7727a980e (diff)
downloadvdr-patch-lnbsharing-90bc2f18e3fb72bba792226dfd2a6e245464d2f5.tar.gz
vdr-patch-lnbsharing-90bc2f18e3fb72bba792226dfd2a6e245464d2f5.tar.bz2
Version 1.4.1-1vdr-1.4.1-1
- Added "-fPIC" to the compiler options in Make.config.template when compiling plugins (thanks to Udo Richter). If you use your own Make.config file, you may want to add these lines there, too. - Added some comment to cDevice::GetDevice() to explain how the individual conditions are put together to make a decision on which device to use. - Updated 'S13E' in 'sources.conf' (thanks to Antti Hartikainen). - Now making sure VPS timers don't get stuck with outdated events, and that the actual device isn't used for updating a VPS timer's event as long as other free devices are available. - Modified rcu.c to better handle RC5 codes. - Added a missing variable initialization in cRingBufferLinear::cRingBufferLinear() (thanks to Prakash Punnoor). - Fixed handling relative link targets in the ReadLink() function (reported by Patrick Cernko). - Now making sure a VPS timer has a schedule in case the epg.data file didn't contain one when VDR was started.
Diffstat (limited to 'device.c')
-rw-r--r--device.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/device.c b/device.c
index 7d0fe12..25c09f6 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 1.130 2006/05/27 11:14:42 kls Exp $
+ * $Id: device.c 1.131 2006/06/15 09:59:40 kls Exp $
*/
#include "device.h"
@@ -281,19 +281,26 @@ cDevice *cDevice::GetDevice(int Index)
cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers)
{
cDevice *d = NULL;
- uint Impact = 0xFFFFFFFF;
+ uint Impact = 0xFFFFFFFF; // we're looking for a device with the least impact
for (int i = 0; i < numDevices; i++) {
bool ndr;
if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job
+ // Put together an integer number that reflects the "impact" using
+ // this device would have on the overall system. Each condition is represented
+ // by one bit in the number (or several bits, if the condition is actually
+ // a numeric value). The sequence in which the conditions are listed corresponds
+ // to their individual severity, where the one listed first will make the most
+ // difference, because it results in the most significant bit of the result.
uint imp = 0;
- imp <<= 1; imp |= !device[i]->Receiving() || ndr;
- imp <<= 1; imp |= device[i]->Receiving();
- imp <<= 1; imp |= device[i] == ActualDevice();
- imp <<= 1; imp |= device[i]->IsPrimaryDevice();
- imp <<= 1; imp |= device[i]->HasDecoder();
- imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF);
- imp <<= 8; imp |= min(max(device[i]->ProvidesCa(Channel), 0), 0xFF);
+ imp <<= 1; imp |= !device[i]->Receiving() || ndr; // use receiving devices if we don't need to detach existing receivers
+ imp <<= 1; imp |= device[i]->Receiving(); // avoid devices that are receiving
+ imp <<= 1; imp |= device[i] == ActualDevice(); // avoid the actual device (in case of Transfer Mode)
+ imp <<= 1; imp |= device[i]->IsPrimaryDevice(); // avoid the primary device
+ imp <<= 1; imp |= device[i]->HasDecoder(); // avoid full featured cards
+ imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
+ imp <<= 8; imp |= min(max(device[i]->ProvidesCa(Channel), 0), 0xFF); // use the device that provides the lowest number of conditional access methods
if (imp < Impact) {
+ // This device has less impact than any previous one, so we take it.
Impact = imp;
d = device[i];
if (NeedsDetachReceivers)