summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY3
-rw-r--r--Makefile4
-rw-r--r--dvbapi.c79
-rw-r--r--dvbapi.h19
-rw-r--r--eitscan.c84
-rw-r--r--eitscan.h33
-rw-r--r--vdr.c4
7 files changed, 125 insertions, 101 deletions
diff --git a/HISTORY b/HISTORY
index 35377201..5b5afdb8 100644
--- a/HISTORY
+++ b/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.
diff --git a/Makefile b/Makefile
index 8d59074c..25a4f61e 100644
--- a/Makefile
+++ b/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
diff --git a/dvbapi.c b/dvbapi.c
index e4295060..aa4f50e3 100644
--- a/dvbapi.c
+++ b/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);
- }
- }
-}
-
diff --git a/dvbapi.h b/dvbapi.h
index 0b3f963a..036ded85 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.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
diff --git a/eitscan.c b/eitscan.c
new file mode 100644
index 00000000..88271822
--- /dev/null
+++ b/eitscan.c
@@ -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);
+ }
+ }
+}
diff --git a/eitscan.h b/eitscan.h
new file mode 100644
index 00000000..7dacb822
--- /dev/null
+++ b/eitscan.h
@@ -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
diff --git a/vdr.c b/vdr.c
index 03aba4ef..afad5ffa 100644
--- a/vdr.c
+++ b/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"