Logo Search packages:      
Sourcecode: vdr version File versions

bool cDvbDevice::ProvidesChannel ( const cChannel *  Channel,
int  Priority = -1,
bool *  NeedsDetachReceivers = NULL 
) const [virtual]

Returns true if this device can provide the given channel. In case the device has cReceivers attached to it or it is the primary device, Priority is used to decide whether the caller's request can be honored. The special Priority value -1 will tell the caller whether this device is principally able to provide the given Channel, regardless of any attached cReceivers. If NeedsDetachReceivers is given, the resulting value in it will tell the caller whether or not it will have to detach any currently attached receivers from this device before calling SwitchChannel. Note that the return value in NeedsDetachReceivers is only meaningful if the function itself actually returns true. The default implementation always returns false, so a derived cDevice class that can provide channels must implement this function.

Reimplemented from cDevice.

Definition at line 649 of file dvbdevice.c.

References cDevice::Ca(), cDevice::HasPid(), cDevice::Priority(), cDevice::ProvidesCa(), ProvidesSource(), and cDevice::Receiving().

{
  bool result = false;
  bool hasPriority = Priority < 0 || Priority > this->Priority();
  bool needsDetachReceivers = false;

  if (ProvidesSource(Channel->Source()) && ProvidesCa(Channel->Ca())) {
     result = hasPriority;
     if (Priority >= 0 && Receiving()) {
        if (dvbTuner->IsTunedTo(Channel)) {
           if (!HasPid(Channel->Vpid())) {
#ifdef DO_MULTIPLE_RECORDINGS
              if (Channel->Ca() > CACONFBASE)
                 needsDetachReceivers = !ciHandler // only LL-firmware can do non-live CA channels
                                        || Ca() != Channel->Ca();
              else if (!IsPrimaryDevice())
                 result = true;
#ifdef DO_REC_AND_PLAY_ON_PRIMARY_DEVICE
              else
                 result = Priority >= Setup.PrimaryLimit;
#endif
#endif
              }
           else
              result = !IsPrimaryDevice() || Priority >= Setup.PrimaryLimit;
           }
        else
           needsDetachReceivers = true;
        }
     }
  if (NeedsDetachReceivers)
     *NeedsDetachReceivers = needsDetachReceivers;
  return result;
}


Generated by  Doxygen 1.6.0   Back to index