From 2c311093babab83b93dfdd64826b6a2e82462440 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 26 Oct 2002 09:43:11 +0200 Subject: [PATCH] Fixed checking the Ca() status of a cDevice --- CONTRIBUTORS | 1 + HISTORY | 1 + device.c | 13 +++++++++++-- device.h | 7 +++---- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index aa3d27de..289e4a94 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -154,6 +154,7 @@ Stefan Huelswitt be switched or has actually been switched successfully for adding a missing StripAudioPackets() to cDvbPlayer::Action() for improving skipping channels that are (currently) not available + for fixing checking the Ca() status of a cDevice Ulrich Röder for pointing out that there are channels that have a symbol rate higher than diff --git a/HISTORY b/HISTORY index d554f9a0..48db9a18 100644 --- a/HISTORY +++ b/HISTORY @@ -1633,3 +1633,4 @@ Video Disk Recorder Revision History now be given either in MHz, kHz or Hz. The actual value given will be multiplied by 1000 until it is larger than 1000000. - Fixed skipping unavailable channels when zapping downwards. +- Fixed checking the Ca() status of a cDevice (thanks to Stefan Huelswitt). diff --git a/device.c b/device.c index eccacaa3..c7e5b350 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.29 2002/10/20 16:05:51 kls Exp $ + * $Id: device.c 1.30 2002/10/26 09:43:11 kls Exp $ */ #include "device.h" @@ -52,7 +52,6 @@ cDevice::cDevice(void) for (int i = 0; i < MAXRECEIVERS; i++) receiver[i] = NULL; - ca = -1; if (numDevices < MAXDEVICES) { device[numDevices++] = this; @@ -531,6 +530,16 @@ int cDevice::PlayAudio(const uchar *Data, int Length) return -1; } +int cDevice::Ca(void) const +{ + int ca = 0; + for (int i = 0; i < MAXRECEIVERS; i++) { + if (receiver[i] && (ca = receiver[i]->ca) != 0) + break; // all receivers have the same ca + } + return ca; +} + int cDevice::Priority(void) const { int priority = IsPrimaryDevice() ? Setup.PrimaryLimit - 1 : DEFAULTPRIORITY; diff --git a/device.h b/device.h index 54dc41e0..f4744d71 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.23 2002/10/12 11:15:13 kls Exp $ + * $Id: device.h 1.24 2002/10/26 09:35:20 kls Exp $ */ #ifndef __DEVICE_H @@ -324,7 +324,6 @@ public: private: cReceiver *receiver[MAXRECEIVERS]; - int ca; int CanShift(int Ca, int Priority, int UsedCards = 0) const; protected: int Priority(void) const; @@ -344,8 +343,8 @@ protected: // false in case of a non recoverable error, otherwise it returns true, // even if Data is NULL. public: - int Ca(void) const { return ca; } - // Returns the ca of the current receiving session. + int Ca(void) const; + // Returns the ca of the current receiving session(s). bool Receiving(void) const; // Returns true if we are currently receiving. bool AttachReceiver(cReceiver *Receiver);