summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-08-10 15:18:07 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-08-10 15:18:07 +0200
commit232f4105691952042e8668f4706cb5ca6a55c8a0 (patch)
tree892fdc8f08db02f8fe857bf6ee394b28acdd2dc4
parent4ea2daeebec3b37e34882d4aa84a9eb6a128ae0d (diff)
downloadvdr-232f4105691952042e8668f4706cb5ca6a55c8a0.tar.gz
vdr-232f4105691952042e8668f4706cb5ca6a55c8a0.tar.bz2
Fixed handling DVB card indexes when using only one card in a multi-card system
-rw-r--r--HISTORY2
-rw-r--r--dvbapi.c20
-rw-r--r--dvbapi.h7
-rw-r--r--menu.c10
4 files changed, 17 insertions, 22 deletions
diff --git a/HISTORY b/HISTORY
index a44ec755..6e9baec3 100644
--- a/HISTORY
+++ b/HISTORY
@@ -629,3 +629,5 @@ Video Disk Recorder Revision History
- Updated channels.conf.cable (thanks to Uwe Scheffler).
- Updated French OSD texts (thanks to Jean-Claude Repetto).
- Improved AC3 decoding when replaying DVDs (thanks to Matjaz Thaler).
+- Fixed handling DVB card indexes when using only one card in a multi-card
+ system.
diff --git a/dvbapi.c b/dvbapi.c
index b637b5f8..744eaf41 100644
--- a/dvbapi.c
+++ b/dvbapi.c
@@ -7,7 +7,7 @@
* DVD support initially written by Andreas Schultz <aschultz@warp10.net>
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
*
- * $Id: dvbapi.c 1.102 2001/08/10 12:37:03 kls Exp $
+ * $Id: dvbapi.c 1.103 2001/08/10 14:54:21 kls Exp $
*/
//#define DVDDEBUG 1
@@ -2311,6 +2311,7 @@ cDvbApi::cDvbApi(int n)
transferringFromDvbApi = NULL;
ca = 0;
priority = -1;
+ cardIndex = n;
// Devices that are only present on DVB-C or DVB-S cards:
@@ -2418,7 +2419,7 @@ cDvbApi *cDvbApi::GetDvbApi(int Ca, int Priority)
int index = Ca - 1;
for (int i = 0; i < MAXDVBAPI; i++) {
if (dvbApi[i]) {
- if (i == index) { // means we need exactly _this_ device
+ if (dvbApi[i]->CardIndex() == index) { // means we need exactly _this_ device
d = dvbApi[i];
break;
}
@@ -2445,15 +2446,6 @@ cDvbApi *cDvbApi::GetDvbApi(int Ca, int Priority)
? d : NULL;
}
-int cDvbApi::Index(void)
-{
- for (int i = 0; i < MAXDVBAPI; i++) {
- if (dvbApi[i] == this)
- return i;
- }
- return -1;
-}
-
bool cDvbApi::Probe(const char *FileName)
{
if (access(FileName, F_OK) == 0) {
@@ -2951,7 +2943,7 @@ int cDvbApi::SetModeRecord(void)
SetPids(true);
if (fd_dvr >= 0)
close(fd_dvr);
- fd_dvr = OstOpen(DEV_OST_DVR, Index(), O_RDONLY | O_NONBLOCK);
+ fd_dvr = OstOpen(DEV_OST_DVR, CardIndex(), O_RDONLY | O_NONBLOCK);
if (fd_dvr < 0)
LOG_ERROR;
return fd_dvr;
@@ -3061,7 +3053,7 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization,
// If this card can't receive this channel, we must not actually switch
// the channel here, because that would irritate the driver when we
// start replaying in Transfer Mode immediately after switching the channel:
- bool NeedsTransferMode = (this == PrimaryDvbApi && Ca && Ca != Index() + 1);
+ bool NeedsTransferMode = (this == PrimaryDvbApi && Ca && Ca != CardIndex() + 1);
if (!NeedsTransferMode) {
@@ -3500,7 +3492,7 @@ void cEITScanner::Process(void)
if (Setup.EPGScanTimeout && Channels.MaxNumber() > 1) {
time_t now = time(NULL);
if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) {
- for (int i = 0; i < cDvbApi::NumDvbApis; i++) {
+ for (int i = 0; i < MAXDVBAPI; i++) {
cDvbApi *DvbApi = cDvbApi::GetDvbApi(i + 1, MAXPRIORITY);
if (DvbApi) {
if (DvbApi != cDvbApi::PrimaryDvbApi || (cDvbApi::NumDvbApis == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
diff --git a/dvbapi.h b/dvbapi.h
index 41193ae7..d51005a4 100644
--- a/dvbapi.h
+++ b/dvbapi.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbapi.h 1.44 2001/08/05 15:57:45 kls Exp $
+ * $Id: dvbapi.h 1.45 2001/08/10 14:56:40 kls Exp $
*/
#ifndef __DVBAPI_H
@@ -93,6 +93,7 @@ public:
private:
static cDvbApi *dvbApi[MAXDVBAPI];
static int useDvbApi;
+ int cardIndex;
public:
static cDvbApi *PrimaryDvbApi;
static void SetUseDvbApi(int n);
@@ -111,8 +112,8 @@ public:
// will be returned.
// The caller must check whether the returned DVB device is actually
// recording and stop recording if necessary.
- int Index(void);
- // Returns the index of this DvbApi.
+ int CardIndex(void) { return cardIndex; }
+ // Returns the card index of this DvbApi (0 ... MAXDVBAPI - 1).
static bool Probe(const char *FileName);
// Probes for existing DVB devices.
static bool Init(void);
diff --git a/menu.c b/menu.c
index a8f51da2..6ac0a35d 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.96 2001/08/07 16:36:37 kls Exp $
+ * $Id: menu.c 1.97 2001/08/10 14:57:17 kls Exp $
*/
#include "menu.h"
@@ -2070,14 +2070,14 @@ cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer)
timer = new cTimer(true);
Timers.Add(timer);
Timers.Save();
- asprintf(&instantId, cDvbApi::NumDvbApis > 1 ? "%s - %d" : "%s", Channels.GetChannelNameByNumber(timer->channel), dvbApi->Index() + 1);
+ asprintf(&instantId, cDvbApi::NumDvbApis > 1 ? "%s - %d" : "%s", Channels.GetChannelNameByNumber(timer->channel), dvbApi->CardIndex() + 1);
}
timer->SetRecording(true);
if (Channels.SwitchTo(timer->channel, dvbApi)) {
cRecording Recording(timer);
if (dvbApi->StartRecord(Recording.FileName(), Channels.GetByNumber(timer->channel)->ca, timer->priority))
Recording.WriteSummary();
- Interface->DisplayRecording(dvbApi->Index(), true);
+ Interface->DisplayRecording(dvbApi->CardIndex(), true);
}
else
cThread::EmergencyExit(true);
@@ -2102,7 +2102,7 @@ void cRecordControl::Stop(bool KeepInstant)
Timers.Save();
}
timer = NULL;
- Interface->DisplayRecording(dvbApi->Index(), false);
+ Interface->DisplayRecording(dvbApi->CardIndex(), false);
}
}
@@ -2158,7 +2158,7 @@ void cRecordControls::Stop(cDvbApi *DvbApi)
for (int i = 0; i < MAXDVBAPI; i++) {
if (RecordControls[i]) {
if (RecordControls[i]->Uses(DvbApi)) {
- isyslog(LOG_INFO, "stopping recording on DVB device %d due to higher priority", DvbApi->Index() + 1);
+ isyslog(LOG_INFO, "stopping recording on DVB device %d due to higher priority", DvbApi->CardIndex() + 1);
RecordControls[i]->Stop(true);
}
}