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

No longer explicitly waiting for a tuner lock when switching channels

This commit is contained in:
Klaus Schmidinger 2004-10-30 15:10:50 +02:00
parent d5018de4fe
commit 664df0902e
5 changed files with 19 additions and 17 deletions

View File

@ -3083,3 +3083,6 @@ Video Disk Recorder Revision History
- Fixed some typos in the Makefile's 'font' target (thanks to Uwe Hanke). - Fixed some typos in the Makefile's 'font' target (thanks to Uwe Hanke).
- Added more checks and polling when getting frontend events (based on a patch - Added more checks and polling when getting frontend events (based on a patch
from Werner Fink). from Werner Fink).
- No longer explicitly waiting for a tuner lock when switching channels
(apparently setting "live" PIDs before the tuner is locked doesn't hurt).
Moved the wait into cDevice::AttachReceiver() instead.

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.61 2004/10/23 10:15:31 kls Exp $ * $Id: device.c 1.62 2004/10/30 14:53:38 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -23,6 +23,7 @@
// The default priority for non-primary devices: // The default priority for non-primary devices:
#define DEFAULTPRIORITY -1 #define DEFAULTPRIORITY -1
#define TUNER_LOCK_TIMEOUT 5000 // ms
int cDevice::numDevices = 0; int cDevice::numDevices = 0;
int cDevice::useDevice = 0; int cDevice::useDevice = 0;
@ -467,7 +468,7 @@ bool cDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
return false; return false;
} }
bool cDevice::HasLock(void) bool cDevice::HasLock(int TimeoutMs)
{ {
return true; return true;
} }
@ -765,6 +766,10 @@ bool cDevice::AttachReceiver(cReceiver *Receiver)
return false; return false;
if (Receiver->device == this) if (Receiver->device == this)
return true; return true;
if (!HasLock(TUNER_LOCK_TIMEOUT)) {
esyslog("ERROR: device %d has no lock, can't attach receiver!", CardIndex() + 1);
return false;
}
for (int i = 0; i < MAXRECEIVERS; i++) { for (int i = 0; i < MAXRECEIVERS; i++) {
if (!receiver[i]) { if (!receiver[i]) {
for (int n = 0; n < MAXRECEIVEPIDS; n++) { for (int n = 0; n < MAXRECEIVEPIDS; n++) {

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.h 1.45 2004/09/24 14:07:22 kls Exp $ * $Id: device.h 1.46 2004/10/30 14:49:56 kls Exp $
*/ */
#ifndef __DEVICE_H #ifndef __DEVICE_H
@ -187,10 +187,12 @@ protected:
public: public:
static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; } static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; }
///< Returns the number of the current channel on the primary device. ///< Returns the number of the current channel on the primary device.
virtual bool HasLock(void);//XXX PLUGINS.html virtual bool HasLock(int TimeoutMs = 0);//XXX PLUGINS.html
///< Returns true if the device has a lock on the requested transponder. ///< Returns true if the device has a lock on the requested transponder.
///< Default is true, a specific device implementation may return false ///< Default is true, a specific device implementation may return false
///< to indicate that it is not ready yet. ///< to indicate that it is not ready yet.
///< If TimeoutMs is not zero, waits for the given number of milliseconds
///< before returning false.
virtual bool HasProgramme(void); virtual bool HasProgramme(void);
///< Returns true if the device is currently showing any programme to ///< Returns true if the device is currently showing any programme to
///< the user, either through replaying or live. ///< the user, either through replaying or live.

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: dvbdevice.c 1.101 2004/10/30 14:18:53 kls Exp $ * $Id: dvbdevice.c 1.102 2004/10/30 14:53:30 kls Exp $
*/ */
#include "dvbdevice.h" #include "dvbdevice.h"
@ -35,7 +35,6 @@ extern "C" {
#define DO_REC_AND_PLAY_ON_PRIMARY_DEVICE 1 #define DO_REC_AND_PLAY_ON_PRIMARY_DEVICE 1
#define DO_MULTIPLE_RECORDINGS 1 #define DO_MULTIPLE_RECORDINGS 1
#define TUNER_LOCK_TIMEOUT 5000 // ms
#define DEV_VIDEO "/dev/video" #define DEV_VIDEO "/dev/video"
#define DEV_DVB_ADAPTER "/dev/dvb/adapter" #define DEV_DVB_ADAPTER "/dev/dvb/adapter"
@ -795,13 +794,6 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
if (EITScanner.UsesDevice(this)) if (EITScanner.UsesDevice(this))
return true; return true;
// Wait for a lock:
if (!dvbTuner->Locked(TUNER_LOCK_TIMEOUT)) {
esyslog("ERROR: no lock for channel %d on device %d", Channel->Number(), CardIndex() + 1);
return false;
}
// PID settings: // PID settings:
if (TurnOnLivePIDs) { if (TurnOnLivePIDs) {
@ -824,9 +816,9 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
return true; return true;
} }
bool cDvbDevice::HasLock(void) bool cDvbDevice::HasLock(int TimeoutMs)
{ {
return dvbTuner ? dvbTuner->Locked() : false; return dvbTuner ? dvbTuner->Locked(TimeoutMs) : false;
} }
void cDvbDevice::SetVolumeDevice(int Volume) void cDvbDevice::SetVolumeDevice(int Volume)

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: dvbdevice.h 1.28 2004/06/19 08:51:33 kls Exp $ * $Id: dvbdevice.h 1.29 2004/10/30 14:48:27 kls Exp $
*/ */
#ifndef __DVBDEVICE_H #ifndef __DVBDEVICE_H
@ -64,7 +64,7 @@ public:
protected: protected:
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView); virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView);
public: public:
virtual bool HasLock(void); virtual bool HasLock(int TimeoutMs = 0);
// PID handle facilities // PID handle facilities