diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2004-01-04 12:30:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2004-01-04 12:30:00 +0100 |
commit | 8976ebcec5ca1ac03c54209b7cc12e9d14915c6b (patch) | |
tree | 8562202f489ee585c1252b2cb4a9e61b3e200efe /device.c | |
parent | 3a1058fe1fca6d10cea42786aa54abf3d0bd0b94 (diff) | |
download | vdr-8976ebcec5ca1ac03c54209b7cc12e9d14915c6b.tar.gz vdr-8976ebcec5ca1ac03c54209b7cc12e9d14915c6b.tar.bz2 |
Implemented automatic PID switching and channel detection
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 42 |
1 files changed, 25 insertions, 17 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.50 2003/12/22 10:53:45 kls Exp $ + * $Id: device.c 1.51 2004/01/04 11:30:05 kls Exp $ */ #include "device.h" @@ -47,6 +47,7 @@ cDevice::cDevice(void) sectionHandler = NULL; eitFilter = NULL; patFilter = NULL; + sdtFilter = NULL; ciHandler = NULL; player = NULL; @@ -68,8 +69,9 @@ cDevice::~cDevice() for (int i = 0; i < MAXRECEIVERS; i++) Detach(receiver[i]); delete ciHandler; - delete eitFilter; + delete sdtFilter; delete patFilter; + delete eitFilter; delete sectionHandler; } @@ -157,7 +159,7 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDe 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())) + else if (d && !device[i]->Receiving() && device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channel)) pri = 1; // free and fewer Ca's else if (!device[i]->Receiving() && !device[i]->IsPrimaryDevice()) pri = 2; // free and not the primary device @@ -165,7 +167,7 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDe 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())) + else if (d && device[i]->Priority() == d->Priority() && device[i]->ProvidesCa(Channel) < d->ProvidesCa(Channel)) pri = 5; // receiving with same priority but fewer Ca's else pri = 6; // all others @@ -325,6 +327,7 @@ void cDevice::StartSectionHandler(void) sectionHandler = new cSectionHandler(this); AttachFilter(eitFilter = new cEitFilter); AttachFilter(patFilter = new cPatFilter); + AttachFilter(sdtFilter = new cSdtFilter(patFilter)); sectionHandler->SetStatus(true); } } @@ -349,6 +352,11 @@ bool cDevice::ProvidesSource(int Source) const return false; } +bool cDevice::ProvidesTransponder(const cChannel *Channel) const +{ + return false; +} + bool cDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const { return false; @@ -431,6 +439,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) Result = scrNotAvailable; } else { + Channels.Lock(false); cStatus::MsgChannelSwitch(this, 0); // only report status if we are actually going to switch the channel // Stop section handling: if (sectionHandler) { @@ -440,12 +449,13 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) if (SetChannelDevice(Channel, LiveView)) { // Start section handling: if (sectionHandler) { - sectionHandler->SetSource(Channel->Source(), Channel->Frequency()); + sectionHandler->SetSource(Channel->Source(), Channel->Transponder()); sectionHandler->SetStatus(true); } } else Result = scrFailed; + Channels.Unlock(); } if (Result == scrOk) { @@ -462,6 +472,11 @@ bool cDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) return false; } +bool cDevice::HasLock(void) +{ + return true; +} + bool cDevice::HasProgramme(void) { return Replaying() || pidHandles[ptAudio].pid || pidHandles[ptVideo].pid; @@ -651,6 +666,7 @@ int cDevice::Priority(void) const int cDevice::CanShift(int Ca, int Priority, int UsedCards) const { return -1;//XXX+ too complex with multiple recordings per device + /*XXX // Test whether a receiver on this device can be shifted to another one // in order to perform a new receiving with the given Ca and Priority on this device: int ShiftLevel = -1; // default means this device can't be shifted @@ -681,25 +697,17 @@ int cDevice::CanShift(int Ca, int Priority, int UsedCards) const else if (Priority > this->Priority()) ShiftLevel = 0; // no shifting necessary, this device can do the job return ShiftLevel; + XXX*/ } -int cDevice::ProvidesCa(int Ca) const +int cDevice::ProvidesCa(const cChannel *Channel) const { + int Ca = Channel->Ca(); if (Ca == CardIndex() + 1) return 1; // exactly _this_ card was requested if (Ca && Ca <= MAXDEVICES) return 0; // a specific card was requested, but not _this_ one - int result = Ca ? 0 : 1; // by default every card can provide FTA - int others = Ca ? 1 : 0; - for (int i = 0; i < MAXCACAPS; i++) { - if (caCaps[i]) { - if (caCaps[i] == Ca) - result = 1; - else - others++; - } - } - return result ? result + others : 0; + return !Ca; // by default every card can provide FTA } bool cDevice::Receiving(bool CheckAny) const |