mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
The EPG scan now scans newly found transponders together with already existing ones
This commit is contained in:
parent
12d9883261
commit
004b82d3d4
2
HISTORY
2
HISTORY
@ -2592,3 +2592,5 @@ Video Disk Recorder Revision History
|
|||||||
- Channels with a zero VPID no longer write a PPID into channels.conf.
|
- Channels with a zero VPID no longer write a PPID into channels.conf.
|
||||||
- Short channel names are now only stored if they actually differ from the
|
- Short channel names are now only stored if they actually differ from the
|
||||||
full name.
|
full name.
|
||||||
|
- The EPG scan now scans newly found transponders together with already existing
|
||||||
|
ones.
|
||||||
|
59
eitscan.c
59
eitscan.c
@ -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: eitscan.c 1.18 2004/01/11 15:50:59 kls Exp $
|
* $Id: eitscan.c 1.19 2004/01/17 13:13:47 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "eitscan.h"
|
#include "eitscan.h"
|
||||||
@ -16,46 +16,35 @@
|
|||||||
|
|
||||||
class cScanData : public cListObject {
|
class cScanData : public cListObject {
|
||||||
private:
|
private:
|
||||||
int source;
|
cChannel channel;
|
||||||
int transponder;
|
|
||||||
public:
|
public:
|
||||||
cScanData(int Source, int Transponder);
|
cScanData(const cChannel *Channel);
|
||||||
virtual bool operator< (const cListObject &ListObject);
|
virtual bool operator< (const cListObject &ListObject);
|
||||||
int Source(void) { return source; }
|
int Source(void) { return channel.Source(); }
|
||||||
int Transponder(void) { return transponder; }
|
int Transponder(void) { return channel.Transponder(); }
|
||||||
cChannel *GetChannel(cList<cChannel> *Channels);
|
const cChannel *GetChannel(void) { return &channel; }
|
||||||
};
|
};
|
||||||
|
|
||||||
cScanData::cScanData(int Source, int Transponder)
|
cScanData::cScanData(const cChannel *Channel)
|
||||||
{
|
{
|
||||||
source = Source;
|
channel = *Channel;
|
||||||
transponder = Transponder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cScanData::operator< (const cListObject &ListObject)
|
bool cScanData::operator< (const cListObject &ListObject)
|
||||||
{
|
{
|
||||||
cScanData *sd = (cScanData *)&ListObject;
|
cScanData *sd = (cScanData *)&ListObject;
|
||||||
return source < sd->source || source == sd->source && transponder < sd->transponder;
|
return Source() < sd->Source() || Source() == sd->Source() && Transponder() < sd->Transponder();
|
||||||
}
|
|
||||||
|
|
||||||
cChannel *cScanData::GetChannel(cList<cChannel> *Channels)
|
|
||||||
{
|
|
||||||
for (cChannel *Channel = Channels->First(); Channel; Channel = Channels->Next(Channel)) {
|
|
||||||
if (!Channel->GroupSep() && Channel->Source() == source && ISTRANSPONDER(Channel->Transponder(), transponder))
|
|
||||||
return Channel;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- cScanList -------------------------------------------------------------
|
// --- cScanList -------------------------------------------------------------
|
||||||
|
|
||||||
class cScanList : public cList<cScanData> {
|
class cScanList : public cList<cScanData> {
|
||||||
public:
|
public:
|
||||||
cScanList(cList<cChannel> *Channels);
|
void AddTransponders(cList<cChannel> *Channels);
|
||||||
void AddTransponder(const cChannel *Channel);
|
void AddTransponder(const cChannel *Channel);
|
||||||
};
|
};
|
||||||
|
|
||||||
cScanList::cScanList(cList<cChannel> *Channels)
|
void cScanList::AddTransponders(cList<cChannel> *Channels)
|
||||||
{
|
{
|
||||||
for (cChannel *ch = Channels->First(); ch; ch = Channels->Next(ch))
|
for (cChannel *ch = Channels->First(); ch; ch = Channels->Next(ch))
|
||||||
AddTransponder(ch);
|
AddTransponder(ch);
|
||||||
@ -64,11 +53,13 @@ cScanList::cScanList(cList<cChannel> *Channels)
|
|||||||
|
|
||||||
void cScanList::AddTransponder(const cChannel *Channel)
|
void cScanList::AddTransponder(const cChannel *Channel)
|
||||||
{
|
{
|
||||||
|
if (Channel->Source() && Channel->Transponder()) {
|
||||||
for (cScanData *sd = First(); sd; sd = Next(sd)) {
|
for (cScanData *sd = First(); sd; sd = Next(sd)) {
|
||||||
if (sd->Source() == Channel->Source() && ISTRANSPONDER(sd->Transponder(), Channel->Transponder()))
|
if (sd->Source() == Channel->Source() && ISTRANSPONDER(sd->Transponder(), Channel->Transponder()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Add(new cScanData(Channel->Source(), Channel->Transponder()));
|
Add(new cScanData(Channel));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- cTransponderList ------------------------------------------------------
|
// --- cTransponderList ------------------------------------------------------
|
||||||
@ -98,7 +89,6 @@ cEITScanner::cEITScanner(void)
|
|||||||
lastScan = lastActivity = time(NULL);
|
lastScan = lastActivity = time(NULL);
|
||||||
currentDevice = NULL;
|
currentDevice = NULL;
|
||||||
currentChannel = 0;
|
currentChannel = 0;
|
||||||
numScan = 0;
|
|
||||||
scanList = NULL;
|
scanList = NULL;
|
||||||
transponderList = NULL;
|
transponderList = NULL;
|
||||||
}
|
}
|
||||||
@ -131,11 +121,15 @@ void cEITScanner::Process(void)
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) {
|
if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) {
|
||||||
if (Channels.Lock(false, 10)) {
|
if (Channels.Lock(false, 10)) {
|
||||||
cList<cChannel> *ChannelList = &Channels;
|
if (!scanList) {
|
||||||
if (numScan % 2 == 0 && transponderList) // switch between the list of new transponders and the actual channels in case there are transponders w/o any channels
|
scanList = new cScanList;
|
||||||
ChannelList = transponderList;
|
scanList->AddTransponders(&Channels);
|
||||||
if (!scanList)
|
if (transponderList) {
|
||||||
scanList = new cScanList(ChannelList);
|
scanList->AddTransponders(transponderList);
|
||||||
|
delete transponderList;
|
||||||
|
transponderList = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (bool AnyDeviceSwitched = false; !AnyDeviceSwitched; ) {
|
for (bool AnyDeviceSwitched = false; !AnyDeviceSwitched; ) {
|
||||||
cScanData *ScanData = NULL;
|
cScanData *ScanData = NULL;
|
||||||
for (int i = 0; i < cDevice::NumDevices(); i++) {
|
for (int i = 0; i < cDevice::NumDevices(); i++) {
|
||||||
@ -144,7 +138,7 @@ void cEITScanner::Process(void)
|
|||||||
if (Device) {
|
if (Device) {
|
||||||
if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
|
if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
|
||||||
if (!(Device->Receiving(true) || Device->Replaying())) {
|
if (!(Device->Receiving(true) || Device->Replaying())) {
|
||||||
cChannel *Channel = ScanData->GetChannel(ChannelList);
|
const cChannel *Channel = ScanData->GetChannel();
|
||||||
if (Channel) {
|
if (Channel) {
|
||||||
//XXX if (Device->ProvidesTransponder(Channel)) {
|
//XXX if (Device->ProvidesTransponder(Channel)) {
|
||||||
if ((!Channel->Ca() || Channel->Ca() == Device->DeviceNumber() + 1 || Channel->Ca() >= 0x0100) && Device->ProvidesTransponder(Channel)) { //XXX temporary for the 'sky' plugin
|
if ((!Channel->Ca() || Channel->Ca() == Device->DeviceNumber() + 1 || Channel->Ca() >= 0x0100) && Device->ProvidesTransponder(Channel)) { //XXX temporary for the 'sky' plugin
|
||||||
@ -172,11 +166,6 @@ void cEITScanner::Process(void)
|
|||||||
if (!scanList->Count()) {
|
if (!scanList->Count()) {
|
||||||
delete scanList;
|
delete scanList;
|
||||||
scanList = NULL;
|
scanList = NULL;
|
||||||
numScan++;
|
|
||||||
if (ChannelList == transponderList) {
|
|
||||||
delete transponderList;
|
|
||||||
transponderList = NULL;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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: eitscan.h 1.6 2004/01/11 14:11:25 kls Exp $
|
* $Id: eitscan.h 1.7 2004/01/17 13:13:47 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EITSCAN_H
|
#ifndef __EITSCAN_H
|
||||||
@ -24,7 +24,6 @@ private:
|
|||||||
time_t lastScan, lastActivity;
|
time_t lastScan, lastActivity;
|
||||||
cDevice *currentDevice;
|
cDevice *currentDevice;
|
||||||
int currentChannel;
|
int currentChannel;
|
||||||
int numScan;
|
|
||||||
cScanList *scanList;
|
cScanList *scanList;
|
||||||
cTransponderList *transponderList;
|
cTransponderList *transponderList;
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user