1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Modifed the device selection to better handle timer conflicts

This commit is contained in:
Klaus Schmidinger 2006-05-27 09:43:37 +02:00
parent 6b3376f4de
commit d1617c84ca
4 changed files with 17 additions and 26 deletions

View File

@ -1763,6 +1763,7 @@ Christian Wieninger <cwieninger@gmx.de>
for his idea of going directly into the "Edit timer" menu for a timer created for his idea of going directly into the "Edit timer" menu for a timer created
from the "Schedule" menu in case it starts withing the next two minutes from the "Schedule" menu in case it starts withing the next two minutes
for reporting a problem with a format string in recording.c on 64bit systems for reporting a problem with a format string in recording.c on 64bit systems
for reporting a problem with the device selection in case of timer conflicts
Thiemo Gehrke <tgehrke@reel-multimedia.com> Thiemo Gehrke <tgehrke@reel-multimedia.com>
for suggesting to add a setup option to turn off the automatic timeout of the for suggesting to add a setup option to turn off the automatic timeout of the

View File

@ -4736,3 +4736,5 @@ Video Disk Recorder Revision History
- Fixed handling VPS timers in case the EPG event hasn't been 'seen' in a while. - Fixed handling VPS timers in case the EPG event hasn't been 'seen' in a while.
- Fixed calculating the cache size in cUnbufferedFile::Read() (thanks to Artur Skawina). - Fixed calculating the cache size in cUnbufferedFile::Read() (thanks to Artur Skawina).
- Removed -fPIC from VDR's and libsi's Makefile (suggested by Prakash Punnoor). - Removed -fPIC from VDR's and libsi's Makefile (suggested by Prakash Punnoor).
- Modifed the device selection to better handle timer conflicts (reported by
Christian Wieninger).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.c 1.128 2006/04/14 14:34:43 kls Exp $ * $Id: device.c 1.129 2006/05/27 09:43:37 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -281,32 +281,20 @@ cDevice *cDevice::GetDevice(int Index)
cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers)
{ {
cDevice *d = NULL; cDevice *d = NULL;
int select = INT_MAX; uint Impact = 0xFFFFFFFF;
for (int i = 0; i < numDevices; i++) { for (int i = 0; i < numDevices; i++) {
bool ndr; bool ndr;
if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job
int pri; uint imp = 0;
if (device[i]->Receiving() && !ndr) imp <<= 1; imp |= !device[i]->Receiving() || ndr;
pri = 0; // receiving and allows additional receivers imp <<= 1; imp |= device[i]->Receiving();
else if (!device[i]->Receiving(true) && d && device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channel)) imp <<= 1; imp |= device[i] == ActualDevice();
pri = 1; // free and fewer Ca's imp <<= 1; imp |= device[i]->IsPrimaryDevice();
else if (!device[i]->Receiving() && !device[i]->HasDecoder()) imp <<= 1; imp |= device[i]->HasDecoder();
pri = 2; // free and not a full featured card imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF);
else if (!device[i]->Receiving() && device[i] != ActualDevice()) imp <<= 8; imp |= min(max(device[i]->ProvidesCa(Channel), 0), 0xFF);
pri = 3; // free and not the actual device if (imp < Impact) {
else if (!device[i]->Receiving() && !device[i]->IsPrimaryDevice()) Impact = imp;
pri = 4; // free and not the primary device
else if (!device[i]->Receiving())
pri = 5; // free
else if (d && device[i]->Priority() < d->Priority())
pri = 6; // receiving but priority is lower
else if (d && device[i]->Priority() == d->Priority() && device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channel))
pri = 7; // receiving with same priority but fewer Ca's
else
pri = 8; // all others
if (pri <= select) {
select = pri;
d = device[i]; d = device[i];
if (NeedsDetachReceivers) if (NeedsDetachReceivers)
*NeedsDetachReceivers = ndr; *NeedsDetachReceivers = ndr;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: receiver.h 1.3 2005/01/16 14:05:10 kls Exp $ * $Id: receiver.h 1.4 2006/05/27 09:04:22 kls Exp $
*/ */
#ifndef __RECEIVER_H #ifndef __RECEIVER_H
@ -44,7 +44,7 @@ public:
///< Pids1...Pids3 are pointers to zero terminated lists of PIDs. ///< Pids1...Pids3 are pointers to zero terminated lists of PIDs.
///< If any of these PIDs are 0, they will be silently ignored. ///< If any of these PIDs are 0, they will be silently ignored.
///< The total number of non-zero PIDs must not exceed MAXRECEIVEPIDS. ///< The total number of non-zero PIDs must not exceed MAXRECEIVEPIDS.
///< Priority may be any value in the range 0..99. Negative values indicate ///< Priority may be any value in the range -99..99. Negative values indicate
///< that this cReceiver may be detached at any time (without blocking the ///< that this cReceiver may be detached at any time (without blocking the
///< cDevice it is attached to). ///< cDevice it is attached to).
virtual ~cReceiver(); virtual ~cReceiver();