mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Moved the cEITScanner out of dvbapi.h/.c, into the new eitscan.h/.c
This commit is contained in:
parent
9f9d6a8a93
commit
0161197360
3
HISTORY
3
HISTORY
@ -1294,7 +1294,7 @@ Video Disk Recorder Revision History
|
||||
- Fixed the cutting mechanism to make it re-sync in case a frame is larger than the
|
||||
buffer (thanks to Sven Grothklags).
|
||||
|
||||
2002-05-19: Version 1.1.3
|
||||
2002-05-20: Version 1.1.3
|
||||
|
||||
- Improved the VDR Makefile to avoid a warning if the '.dependencies' file does
|
||||
not exist, and also using $(MAKE) to call recursive makes.
|
||||
@ -1314,3 +1314,4 @@ Video Disk Recorder Revision History
|
||||
- Completely moved OSD handling out of the cDvbApi class, into the new cOsd.
|
||||
- Implemented cStatusMonitor to allow plugins to set up a status monitor.
|
||||
See PLUGINS.html for details.
|
||||
- Moved the cEITScanner out of dvbapi.h/.c, into the new eitscan.h/.c.
|
||||
|
4
Makefile
4
Makefile
@ -4,7 +4,7 @@
|
||||
# See the main source file 'vdr.c' for copyright information and
|
||||
# how to reach the author.
|
||||
#
|
||||
# $Id: Makefile 1.37 2002/05/18 15:10:10 kls Exp $
|
||||
# $Id: Makefile 1.38 2002/05/20 10:56:37 kls Exp $
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
@ -21,7 +21,7 @@ INCLUDES = -I$(DVBDIR)/ost/include
|
||||
|
||||
DTVLIB = $(DTVDIR)/libdtv.a
|
||||
|
||||
OBJS = config.o dvbapi.o dvbosd.o eit.o font.o i18n.o interface.o menu.o\
|
||||
OBJS = config.o dvbapi.o dvbosd.o eit.o eitscan.o font.o i18n.o interface.o menu.o\
|
||||
menuitems.o osdbase.o osd.o plugin.o recording.o remote.o remux.o ringbuffer.o\
|
||||
status.o svdrp.o thread.o tools.o vdr.o videodir.o
|
||||
|
||||
|
79
dvbapi.c
79
dvbapi.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbapi.c 1.179 2002/05/19 14:46:38 kls Exp $
|
||||
* $Id: dvbapi.c 1.180 2002/05/20 10:58:33 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbapi.h"
|
||||
@ -2562,80 +2562,3 @@ void cDvbApi::SetAudioCommand(const char *Command)
|
||||
delete audioCommand;
|
||||
audioCommand = strdup(Command);
|
||||
}
|
||||
|
||||
// --- cEITScanner -----------------------------------------------------------
|
||||
|
||||
cEITScanner::cEITScanner(void)
|
||||
{
|
||||
lastScan = lastActivity = time(NULL);
|
||||
currentChannel = 0;
|
||||
lastChannel = 0;
|
||||
numTransponders = 0;
|
||||
transponders = NULL;
|
||||
}
|
||||
|
||||
cEITScanner::~cEITScanner()
|
||||
{
|
||||
delete 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 < MAXDVBAPI; i++) {
|
||||
cDvbApi *DvbApi = cDvbApi::GetDvbApi(i + 1, MAXPRIORITY + 1);
|
||||
if (DvbApi) {
|
||||
if (DvbApi != cDvbApi::PrimaryDvbApi || (cDvbApi::NumDvbApis == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
|
||||
if (!(DvbApi->Recording() || DvbApi->Replaying() || DvbApi->Transferring())) {
|
||||
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 <= MAXDVBAPI && !DvbApi->ProvidesCa(Channel->ca))
|
||||
break; // the channel says it explicitly needs a different card
|
||||
if (Channel->pnr && !TransponderScanned(Channel)) {
|
||||
if (DvbApi == cDvbApi::PrimaryDvbApi && !currentChannel)
|
||||
currentChannel = DvbApi->Channel();
|
||||
Channel->Switch(DvbApi, false);
|
||||
lastChannel = ch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ch++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lastScan = time(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
19
dvbapi.h
19
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.71 2002/05/19 10:13:34 kls Exp $
|
||||
* $Id: dvbapi.h 1.72 2002/05/20 10:58:20 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DVBAPI_H
|
||||
@ -280,21 +280,4 @@ public:
|
||||
static int CurrentVolume(void) { return PrimaryDvbApi ? PrimaryDvbApi->volume : 0; }
|
||||
};
|
||||
|
||||
class cEITScanner {
|
||||
private:
|
||||
enum { ActivityTimeout = 60,
|
||||
ScanTimeout = 20
|
||||
};
|
||||
time_t lastScan, lastActivity;
|
||||
int currentChannel, lastChannel;
|
||||
int numTransponders, *transponders;
|
||||
bool TransponderScanned(cChannel *Channel);
|
||||
public:
|
||||
cEITScanner(void);
|
||||
~cEITScanner();
|
||||
bool Active(void) { return currentChannel; }
|
||||
void Activity(void);
|
||||
void Process(void);
|
||||
};
|
||||
|
||||
#endif //__DVBAPI_H
|
||||
|
84
eitscan.c
Normal file
84
eitscan.c
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* eitscan.c: EIT scanner
|
||||
*
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: eitscan.c 1.1 2002/05/20 10:58:10 kls Exp $
|
||||
*/
|
||||
|
||||
#include "eitscan.h"
|
||||
|
||||
cEITScanner::cEITScanner(void)
|
||||
{
|
||||
lastScan = lastActivity = time(NULL);
|
||||
currentChannel = 0;
|
||||
lastChannel = 0;
|
||||
numTransponders = 0;
|
||||
transponders = NULL;
|
||||
}
|
||||
|
||||
cEITScanner::~cEITScanner()
|
||||
{
|
||||
delete 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 < MAXDVBAPI; i++) {
|
||||
cDvbApi *DvbApi = cDvbApi::GetDvbApi(i + 1, MAXPRIORITY + 1);
|
||||
if (DvbApi) {
|
||||
if (DvbApi != cDvbApi::PrimaryDvbApi || (cDvbApi::NumDvbApis == 1 && Setup.EPGScanTimeout && now - lastActivity > Setup.EPGScanTimeout * 3600)) {
|
||||
if (!(DvbApi->Recording() || DvbApi->Replaying() || DvbApi->Transferring())) {
|
||||
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 <= MAXDVBAPI && !DvbApi->ProvidesCa(Channel->ca))
|
||||
break; // the channel says it explicitly needs a different card
|
||||
if (Channel->pnr && !TransponderScanned(Channel)) {
|
||||
if (DvbApi == cDvbApi::PrimaryDvbApi && !currentChannel)
|
||||
currentChannel = DvbApi->Channel();
|
||||
Channel->Switch(DvbApi, false);
|
||||
lastChannel = ch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ch++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lastScan = time(NULL);
|
||||
}
|
||||
}
|
||||
}
|
33
eitscan.h
Normal file
33
eitscan.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* eitscan.h: EIT scanner
|
||||
*
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: eitscan.h 1.1 2002/05/20 11:00:05 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __EITSCAN_H
|
||||
#define __EITSCAN_H
|
||||
|
||||
#include <time.h>
|
||||
#include "config.h"
|
||||
|
||||
class cEITScanner {
|
||||
private:
|
||||
enum { ActivityTimeout = 60,
|
||||
ScanTimeout = 20
|
||||
};
|
||||
time_t lastScan, lastActivity;
|
||||
int currentChannel, lastChannel;
|
||||
int numTransponders, *transponders;
|
||||
bool TransponderScanned(cChannel *Channel);
|
||||
public:
|
||||
cEITScanner(void);
|
||||
~cEITScanner();
|
||||
bool Active(void) { return currentChannel; }
|
||||
void Activity(void);
|
||||
void Process(void);
|
||||
};
|
||||
|
||||
#endif //__EITSCAN_H
|
4
vdr.c
4
vdr.c
@ -22,7 +22,7 @@
|
||||
*
|
||||
* The project's page is at http://www.cadsoft.de/people/kls/vdr
|
||||
*
|
||||
* $Id: vdr.c 1.112 2002/05/18 14:03:22 kls Exp $
|
||||
* $Id: vdr.c 1.113 2002/05/20 11:02:10 kls Exp $
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@ -32,7 +32,7 @@
|
||||
#include <unistd.h>
|
||||
#include "config.h"
|
||||
#include "dvbapi.h"
|
||||
#include "eit.h"
|
||||
#include "eitscan.h"
|
||||
#include "i18n.h"
|
||||
#include "interface.h"
|
||||
#include "menu.h"
|
||||
|
Loading…
Reference in New Issue
Block a user