mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
- Adapted VDR to the NEWSTRUCT driver. To use the new driver, compile VDR with 'make NEWSTRUCT=1' (thanks to Holger Wächtler for some valuable advice). By default it currently still uses the old driver. - Added some missing #includes (thanks to Martin Hammerschmid). - Changed the log error message "can't record MPEG1!" to "error in data stream!", since the mentioning of MPEG1 has irritated many people. - Consistently using malloc/free and new/delete (thanks to Andreas Schultz). - Temporarily made cDevice::ProvidesCa() virtual (Andreas Schultz needs this in his DXR3 plugin). - cDevice no longer exposes a file handle to cPlayer. A derived cPlayer class can now call DevicePoll() to see whether the replay device is ready for further data. A derived cDevice class must implement Poll() and shall check if any of its file handles is ready for data. - Implemented several replay modes to allow players that play only audio (thanks to Stefan Huelswitt). - Improved cCondVar::Wait() and implemented cCondVar::TimedWait() (thanks to Stefan Huelswitt). - VDR no longer gives up if there is no DVB device. It continues to work if there is at least one device, either a DVB device found by the core VDR code itself, or a device implemented by a plugin.
86 lines
2.7 KiB
C
86 lines
2.7 KiB
C
/*
|
|
* eitscan.c: EIT scanner
|
|
*
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
* how to reach the author.
|
|
*
|
|
* $Id: eitscan.c 1.5 2002/08/11 11:11:39 kls Exp $
|
|
*/
|
|
|
|
#include "eitscan.h"
|
|
#include <stdlib.h>
|
|
|
|
cEITScanner::cEITScanner(void)
|
|
{
|
|
lastScan = lastActivity = time(NULL);
|
|
currentChannel = 0;
|
|
lastChannel = 0;
|
|
numTransponders = 0;
|
|
transponders = NULL;
|
|
}
|
|
|
|
cEITScanner::~cEITScanner()
|
|
{
|
|
free(transponders);
|
|
}
|
|
|
|
bool cEITScanner::TransponderScanned(cChannel *Channel)
|
|
{
|
|
for (int i = 0; i < numTransponders; i++) {
|
|
if (transponders[i] == Channel->frequency)
|
|
return true;
|
|
}
|
|
transponders = (int *)realloc(transponders, ++numTransponders * sizeof(int));
|
|
transponders[numTransponders - 1] = Channel->frequency;
|
|
return false;
|
|
}
|
|
|
|
void cEITScanner::Activity(void)
|
|
{
|
|
if (currentChannel) {
|
|
Channels.SwitchTo(currentChannel);
|
|
currentChannel = 0;
|
|
}
|
|
lastActivity = time(NULL);
|
|
}
|
|
|
|
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 < MAXDEVICES; i++) {
|
|
cDevice *Device = cDevice::GetDevice(i + 1, MAXPRIORITY + 1);
|
|
if (Device) {
|
|
if (Device != cDevice::PrimaryDevice() || (cDevice::NumDevices() == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
|
|
if (!(Device->Receiving() || Device->Replaying())) {
|
|
int oldCh = lastChannel;
|
|
int ch = oldCh + 1;
|
|
while (ch != oldCh) {
|
|
if (ch > Channels.MaxNumber()) {
|
|
ch = 1;
|
|
numTransponders = 0;
|
|
}
|
|
cChannel *Channel = Channels.GetByNumber(ch);
|
|
if (Channel) {
|
|
if (Channel->ca <= MAXDEVICES && !Device->ProvidesCa(Channel->ca))
|
|
break; // the channel says it explicitly needs a different card
|
|
if (Channel->pnr && !TransponderScanned(Channel)) {
|
|
if (Device == cDevice::PrimaryDevice() && !currentChannel)
|
|
currentChannel = Device->Channel();
|
|
Channel->Switch(Device, false);
|
|
lastChannel = ch;
|
|
break;
|
|
}
|
|
}
|
|
ch++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
lastScan = time(NULL);
|
|
}
|
|
}
|
|
}
|