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

Fixed handling DVB card indexes when using only one card in a multi-card system

This commit is contained in:
Klaus Schmidinger 2001-08-10 15:18:07 +02:00
parent 4ea2daeebe
commit 232f410569
4 changed files with 17 additions and 22 deletions

View File

@ -629,3 +629,5 @@ Video Disk Recorder Revision History
- Updated channels.conf.cable (thanks to Uwe Scheffler). - Updated channels.conf.cable (thanks to Uwe Scheffler).
- Updated French OSD texts (thanks to Jean-Claude Repetto). - Updated French OSD texts (thanks to Jean-Claude Repetto).
- Improved AC3 decoding when replaying DVDs (thanks to Matjaz Thaler). - 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.

View File

@ -7,7 +7,7 @@
* DVD support initially written by Andreas Schultz <aschultz@warp10.net> * DVD support initially written by Andreas Schultz <aschultz@warp10.net>
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si> * 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 //#define DVDDEBUG 1
@ -2311,6 +2311,7 @@ cDvbApi::cDvbApi(int n)
transferringFromDvbApi = NULL; transferringFromDvbApi = NULL;
ca = 0; ca = 0;
priority = -1; priority = -1;
cardIndex = n;
// Devices that are only present on DVB-C or DVB-S cards: // 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; int index = Ca - 1;
for (int i = 0; i < MAXDVBAPI; i++) { for (int i = 0; i < MAXDVBAPI; i++) {
if (dvbApi[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]; d = dvbApi[i];
break; break;
} }
@ -2445,15 +2446,6 @@ cDvbApi *cDvbApi::GetDvbApi(int Ca, int Priority)
? d : NULL; ? 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) bool cDvbApi::Probe(const char *FileName)
{ {
if (access(FileName, F_OK) == 0) { if (access(FileName, F_OK) == 0) {
@ -2951,7 +2943,7 @@ int cDvbApi::SetModeRecord(void)
SetPids(true); SetPids(true);
if (fd_dvr >= 0) if (fd_dvr >= 0)
close(fd_dvr); 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) if (fd_dvr < 0)
LOG_ERROR; LOG_ERROR;
return fd_dvr; 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 // If this card can't receive this channel, we must not actually switch
// the channel here, because that would irritate the driver when we // the channel here, because that would irritate the driver when we
// start replaying in Transfer Mode immediately after switching the channel: // 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) { if (!NeedsTransferMode) {
@ -3500,7 +3492,7 @@ void cEITScanner::Process(void)
if (Setup.EPGScanTimeout && Channels.MaxNumber() > 1) { if (Setup.EPGScanTimeout && Channels.MaxNumber() > 1) {
time_t now = time(NULL); time_t now = time(NULL);
if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) { 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); cDvbApi *DvbApi = cDvbApi::GetDvbApi(i + 1, MAXPRIORITY);
if (DvbApi) { if (DvbApi) {
if (DvbApi != cDvbApi::PrimaryDvbApi || (cDvbApi::NumDvbApis == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) { if (DvbApi != cDvbApi::PrimaryDvbApi || (cDvbApi::NumDvbApis == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {

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: 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 #ifndef __DVBAPI_H
@ -93,6 +93,7 @@ public:
private: private:
static cDvbApi *dvbApi[MAXDVBAPI]; static cDvbApi *dvbApi[MAXDVBAPI];
static int useDvbApi; static int useDvbApi;
int cardIndex;
public: public:
static cDvbApi *PrimaryDvbApi; static cDvbApi *PrimaryDvbApi;
static void SetUseDvbApi(int n); static void SetUseDvbApi(int n);
@ -111,8 +112,8 @@ public:
// will be returned. // will be returned.
// The caller must check whether the returned DVB device is actually // The caller must check whether the returned DVB device is actually
// recording and stop recording if necessary. // recording and stop recording if necessary.
int Index(void); int CardIndex(void) { return cardIndex; }
// Returns the index of this DvbApi. // Returns the card index of this DvbApi (0 ... MAXDVBAPI - 1).
static bool Probe(const char *FileName); static bool Probe(const char *FileName);
// Probes for existing DVB devices. // Probes for existing DVB devices.
static bool Init(void); static bool Init(void);

10
menu.c
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: 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" #include "menu.h"
@ -2070,14 +2070,14 @@ cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer)
timer = new cTimer(true); timer = new cTimer(true);
Timers.Add(timer); Timers.Add(timer);
Timers.Save(); 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); timer->SetRecording(true);
if (Channels.SwitchTo(timer->channel, dvbApi)) { if (Channels.SwitchTo(timer->channel, dvbApi)) {
cRecording Recording(timer); cRecording Recording(timer);
if (dvbApi->StartRecord(Recording.FileName(), Channels.GetByNumber(timer->channel)->ca, timer->priority)) if (dvbApi->StartRecord(Recording.FileName(), Channels.GetByNumber(timer->channel)->ca, timer->priority))
Recording.WriteSummary(); Recording.WriteSummary();
Interface->DisplayRecording(dvbApi->Index(), true); Interface->DisplayRecording(dvbApi->CardIndex(), true);
} }
else else
cThread::EmergencyExit(true); cThread::EmergencyExit(true);
@ -2102,7 +2102,7 @@ void cRecordControl::Stop(bool KeepInstant)
Timers.Save(); Timers.Save();
} }
timer = NULL; 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++) { for (int i = 0; i < MAXDVBAPI; i++) {
if (RecordControls[i]) { if (RecordControls[i]) {
if (RecordControls[i]->Uses(DvbApi)) { 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); RecordControls[i]->Stop(true);
} }
} }