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

Fixed selecting the device, because sometimes an FTA recording terminated a CA recording

This commit is contained in:
Klaus Schmidinger 2003-08-02 11:52:29 +02:00
parent a021b0f1bf
commit 44992533f0
3 changed files with 29 additions and 14 deletions

View File

@ -566,6 +566,8 @@ Clemens Kirchgatterer <clemens@thf.ath.cx>
Emil Naepflein <Emil.Naepflein@philosys.de>
for suggesting to take an active SVDRP connection into account when doing shutdown or
housekeeping
for fixing selecting the device, because sometimes an FTA recording terminated a
CA recording
Gerald Berwolf <genka@genka.de>
for suggesting to deactivate some templates in tools.h in case some plugin needs to

View File

@ -2275,3 +2275,5 @@ Video Disk Recorder Revision History
Steiner for reporting this one).
- Fixed checking CA capabilities with the dvb-kernel driver (thanks to Kenneth
Aafløy).
- Fixed selecting the device, because sometimes an FTA recording terminated a
CA recording (thanks to Emil Naepflein).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.c 1.45 2003/06/08 09:19:59 kls Exp $
* $Id: device.c 1.46 2003/08/02 11:44:28 kls Exp $
*/
#include "device.h"
@ -142,23 +142,34 @@ cDevice *cDevice::GetDevice(int Index)
cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers)
{
cDevice *d = NULL;
int select = 7, pri;
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
&& (!d // we don't have a device yet, or...
|| (device[i]->Receiving() && !ndr) // ...this one is already receiving and allows additional receivers, or...
|| !d->Receiving() // ...the one we have is not receiving...
&& (device[i]->Priority() < d->Priority() // ...this one has an even lower Priority, or...
|| device[i]->Priority() == d->Priority() // ...same Priority...
&& device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()) // ...but this one provides fewer Ca values
)
)
) {
if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job
if (device[i]->Receiving() && !ndr)
pri = 0; // receiving and allows additional receivers
else if (d && !device[i]->Receiving() && device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()))
pri = 1; // free and fewer Ca's
else if (!device[i]->Receiving() && !device[i]->IsPrimaryDevice())
pri = 2; // free and not the primary device
else if (!device[i]->Receiving())
pri = 3; // free
else if (d && device[i]->Priority() < d->Priority())
pri = 4; // receiving but priority is lower
else if (d && device[i]->Priority() == d->Priority() && device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()))
pri = 5; // receiving with same priority but fewer Ca's
else
pri = 6; // all others
if (pri < select) {
select = pri;
d = device[i];
if (NeedsDetachReceivers)
*NeedsDetachReceivers = ndr;
}
}
}
/*XXX+ too complex with multiple recordings per device
if (!d && Ca > MAXDEVICES) {
// We didn't find one the easy way, so now we have to try harder: