summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-09-03 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-09-03 18:00:00 +0200
commit48fea259ae5ed3ac19bcc4152341252b9df39128 (patch)
tree244597d3af4bc89bc1997e7cceb91745e23ea811
parent9b405778674d5325b225b32ab694d9216b099527 (diff)
downloadvdr-patch-lnbsharing-48fea259ae5ed3ac19bcc4152341252b9df39128.tar.gz
vdr-patch-lnbsharing-48fea259ae5ed3ac19bcc4152341252b9df39128.tar.bz2
Version 0.62vdr-0.62
- The Makefile now defines DVBDIR to easily point to where the DVB driver source is located. - When switching channels the current/next information is now displayed if available (thanks to Robert Schneider). Since there is now more information to read when switching channels, the timeout for displaying it has been increased from 2 to 5 seconds (remember that this info can always be recalled by pressing the "Ok" button). For this feature to work it is necessary that the 'Pnr' parameter in the channel setup ('channels.conf') is set to the proper value. This has been done for some of the channels in the default 'channels.conf'. Some other parameters in the default 'channels.conf' have also been updated, so please make sure your timers still use the correct channels!
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY15
-rw-r--r--INSTALL3
-rw-r--r--Makefile14
-rw-r--r--channels.conf79
-rw-r--r--config.c9
-rw-r--r--config.h4
-rw-r--r--dvbapi.h4
-rw-r--r--eit.c530
-rw-r--r--eit.h92
-rw-r--r--interface.c23
-rw-r--r--svdrp.c4
-rw-r--r--timers.conf16
13 files changed, 733 insertions, 63 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 74390cf..07f9d16 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -16,3 +16,6 @@ Heino Goldenstein <heino.goldenstein@microplex.de>
Guido Fiala <gfiala@s.netic.de>
for implementing slow forward/back
+
+Robert Schneider <Robert.Schneider@lotus.com>
+ for implementing EIT support for displaying the current/next info
diff --git a/HISTORY b/HISTORY
index 04cc2d5..f5c3cb9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -123,3 +123,18 @@ Video Disk Recorder Revision History
doesn't yet exist).
- New version of the 'epg2timers' tool (with a modified channel list).
- Bugfix in closing window in DEBUG_OSD mode.
+
+2000-09-03: Version 0.62
+
+- The Makefile now defines DVBDIR to easily point to where the DVB driver
+ source is located.
+- When switching channels the current/next information is now displayed if
+ available (thanks to Robert Schneider). Since there is now more information
+ to read when switching channels, the timeout for displaying it has been
+ increased from 2 to 5 seconds (remember that this info can always be recalled
+ by pressing the "Ok" button).
+ For this feature to work it is necessary that the 'Pnr' parameter in the
+ channel setup ('channels.conf') is set to the proper value. This has been
+ done for some of the channels in the default 'channels.conf'. Some other
+ parameters in the default 'channels.conf' have also been updated, so please
+ make sure your timers still use the correct channels!
diff --git a/INSTALL b/INSTALL
index 938487c..1ebffa1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -11,6 +11,9 @@ http://linuxtv.org/dvb/siemens_dvb.html for more information
about that driver). For example, if the DVB driver was
extracted into the directory /home/kls/vdr/DVB, then this
package should be extracted into /home/kls/vdr/VDR.
+If you have the DVB driver source in a different location
+you will have to change the definition of DVBDIR in the
+Makefile.
This program requires the card driver version 0.05 or higher
to work properly.
diff --git a/Makefile b/Makefile
index f71236b..9868ddb 100644
--- a/Makefile
+++ b/Makefile
@@ -4,9 +4,12 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
-# $Id: Makefile 1.6 2000/07/28 14:37:44 kls Exp $
+# $Id: Makefile 1.7 2000/09/03 09:26:24 kls Exp $
-OBJS = config.o dvbapi.o interface.o menu.o osd.o recording.o remote.o svdrp.o tools.o vdr.o videodir.o
+DVBDIR = ../DVB
+
+INCLUDES = -I$(DVBDIR)/driver
+OBJS = config.o dvbapi.o eit.o interface.o menu.o osd.o recording.o remote.o svdrp.o tools.o vdr.o videodir.o
ifndef REMOTE
REMOTE = KBD
@@ -19,13 +22,14 @@ DEFINES += -DDEBUG_OSD
endif
%.o: %.c
- g++ -g -O2 -Wall -c $(DEFINES) $<
+ g++ -g -O2 -Wall -c $(DEFINES) $(INCLUDES) $<
all: vdr
-config.o : config.c config.h dvbapi.h interface.h tools.h
+config.o : config.c config.h dvbapi.h eit.h interface.h tools.h
dvbapi.o : dvbapi.c config.h dvbapi.h interface.h tools.h videodir.h
-interface.o: interface.c config.h dvbapi.h interface.h remote.h tools.h
+eit.o : eit.c eit.h
+interface.o: interface.c config.h dvbapi.h eit.h interface.h remote.h tools.h
menu.o : menu.c config.h dvbapi.h interface.h menu.h osd.h recording.h tools.h
osd.o : osd.c config.h dvbapi.h interface.h osd.h tools.h
vdr.o : vdr.c config.h dvbapi.h interface.h menu.h osd.h recording.h svdrp.h tools.h videodir.h
diff --git a/channels.conf b/channels.conf
index eefaf52..6e6d016 100644
--- a/channels.conf
+++ b/channels.conf
@@ -1,53 +1,56 @@
-RTL:12188:h:1:27500:163:104:0:0
-Sat.1:12480:v:1:27500:1791:1792:0:0
-Pro-7:12480:v:1:27500:255:256:0:0
-RTL2:12188:h:1:27500:166:128:0:0
-ARD:11837:h:1:27500:101:102:0:0
-BR3:11837:h:1:27500:201:202:0:0
-Hessen-3:11837:h:1:27500:301:302:0:0
-N3:11837:h:1:27500:401:402:0:0
-SR3:11837:h:1:27500:501:502:0:0
-WDR:11837:h:1:27500:601:602:0:0
-BR-alpha:11837:h:1:27500:701:702:0:0
-SWR BW:11837:h:1:27500:801:802:0:0
-Phoenix:11837:h:1:27500:901:902:0:0
-ZDF:11954:h:1:27500:110:120:0:0
-3sat:11954:h:1:27500:210:220:0:0
-Kinderkanal:11954:h:1:27500:310:320:0:0
-arte:11954:h:1:27500:360:370:0:0
-phoenix:11954:h:1:27500:410:420:0:0
-ORF Sat:11954:h:1:27500:506:507:0:0
-ZDF Infobox:11954:h:1:27500:610:620:0:0
+RTL:12188:h:1:27500:163:104:0:12003
+Sat.1:12480:v:1:27500:1791:1792:0:46
+Pro-7:12480:v:1:27500:255:256:0:898
+RTL2:12188:h:1:27500:166:128:0:12020
+ARD:11837:h:1:27500:101:102:0:28106
+BR3:11837:h:1:27500:201:202:0:28107
+Hessen-3:11837:h:1:27500:301:302:0:28108
+N3:12110:h:1:27500:2401:2402:0:28224
+SR3:11837:h:1:27500:501:502:0:28110
+WDR:11837:h:1:27500:601:602:0:28111
+BR-alpha:11837:h:1:27500:701:702:0:28112
+SWR BW:11837:h:1:27500:801:802:0:28110
+Phoenix:11837:h:1:27500:901:902:0:28114
+ZDF:11954:h:1:27500:110:120:0:28006
+3sat:11954:h:1:27500:210:220:0:28007
+KiKa:11954:h:1:27500:310:320:0:28008
+arte:11836:h:1:27500:401:402:0:28109
+Eurosport:11954:h:1:27500:410:420:0:28009
+ORF Sat:11954:h:1:27500:506:507:0:28010
+ZDF.info:11954:h:1:27500:610:620:0:28011
CNN:12168:v:1:27500:165:100:0:0
-Super RTL:12188:h:1:27500:165:120:0:0
-VOX:12188:h:1:27500:167:136:0:0
-DW TV:12363:v:1:27500:305:306:0:0
-Kabel 1:12480:v:1:27500:511:512:0:0
+Super RTL:12188:h:1:27500:165:120:0:12040
+VOX:12188:h:1:27500:167:136:0:12060
+DW TV:12363:v:1:27500:305:306:0:8905
+Kabel 1:12480:v:1:27500:511:512:0:899
TM3:12480:v:1:27500:767:768:0:0
DSF:12480:v:1:27500:1023:1024:0:0
HOT:12480:v:1:27500:1279:1280:0:0
BloombergTV:12552:v:1:22000:162:99:0:0
-Sky News:12552:v:1:22000:305:306:0:0
+Sky News:12552:v:1:22000:305:306:0:3995
KinderNet:12574:h:1:22000:163:92:0:0
Alice:12610:v:1:22000:162:96:0:0
n-tv:12670:v:1:22000:162:96:0:0
Grand Tourisme:12670:v:1:22000:289:290:0:0
-TW1:12692:h:1:22000:166:167:0:0
-Eins Extra:12722:h:1:22000:101:102:0:0
-Eins Festival:12722:h:1:22000:201:202:0:0
-Eins MuXx:12722:h:1:22000:301:302:0:0
-MDR:12110:h:1:27500:401:402:0:0
-ORB:12722:h:1:22000:501:502:0:0
-B1:12722:h:1:22000:601:602:0:0
+TW1:12692:h:1:22000:166:167:0:13013
+Eurosport:11954:h:1:27500:410:420:0:28009
+EinsExtra:12110:H:1:27500:101:102:0:28201
+EinsFestival:12110:H:1:27500:201:202:0:28202
+EinsMuXx:12110:H:1:27500:301:302:0:28203
+ZDF Theaterkanal:11954:H:1:27500:1110:1120:0:28016
+ZDF.doku:11954:H:1:27500:660:670:0:28014
+MDR:12110:h:1:27500:401:402:0:28204
+ORB:12110:h:1:27500:501:502:0:28205
+B1:12110:h:1:27500:601:602:0:28206
ARD Online-Kanal:12722:h:1:22000:8191:701:0:0
Premiere World Promo:11798:h:1:27500:255:256:0:0
Premiere:11798:h:1:27500:511:512:2:10
Star Kino:11798:h:1:27500:767:768:2:9
-Cine Action:11798:h:1:27500:1023:1024:1:20
-Cine Comedy:11798:h:1:27500:1279:1280:1:29
-Sci Fantasy:11798:h:1:27500:1535:1536:1:41
-Romantic Movies:11798:h:1:27500:1791:1792:1:11
-Studio Universal:11798:h:1:27500:2047:2048:1:21
+Cine Action:11798:h:1:27500:1023:1024:2:20
+Cine Comedy:11798:h:1:27500:1279:1280:2:29
+Sci Fantasy:11798:h:1:27500:1535:1536:2:41
+Romantic Movies:11798:h:1:27500:1791:1792:2:11
+Studio Universal:11798:h:1:27500:2047:2048:2:21
TV Niepokalanow:11876:h:1:27500:305:321:0:0
Mosaico:11934:v:1:27500:165:100:0:0
Andalucia TV:11934:v:1:27500:166:104:0:0
@@ -110,6 +113,6 @@ Astra Vision 1:12552:v:1:22000:168:150:0:0
RTL Tele Letzebuerg:12552:v:1:22000:168:144:0:0
Astra Mosaic:12552:v:1:22000:175:176:0:0
MHP test:12604:h:1:22000:5632:8191:0:0
-Bloomberg TV Spain:12610:v:1:22000:45:49:0:0
+Bloomberg TV Germany:12552:v:1:22000:162:99:0:12160
Video Italia:12610:v:1:22000:121:122:0:0
AC 3 promo:12670:v:1:22000:308:256:0:0
diff --git a/config.c b/config.c
index c144d6c..af5be87 100644
--- a/config.c
+++ b/config.c
@@ -4,15 +4,18 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.17 2000/08/06 12:27:38 kls Exp $
+ * $Id: config.c 1.18 2000/09/03 09:20:22 kls Exp $
*/
#include "config.h"
#include <ctype.h>
#include <stdlib.h>
#include "dvbapi.h"
+#include "eit.h"
#include "interface.h"
+extern cEIT EIT;
+
// -- cKeys ------------------------------------------------------------------
tKey keyTable[] = { // "Up" and "Down" must be the first two keys!
@@ -231,8 +234,10 @@ bool cChannel::Switch(cDvbApi *DvbApi)
isyslog(LOG_INFO, "switching to channel %d", Index() + 1);
CurrentChannel = Index();
for (int i = 3; i--;) {
- if (DvbApi->SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr))
+ if (DvbApi->SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr)) {
+ EIT.SetProgramNumber(pnr);
return true;
+ }
esyslog(LOG_ERR, "retrying");
}
return false;
diff --git a/config.h b/config.h
index 1b21d34..15e9050 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h 1.14 2000/08/06 12:22:52 kls Exp $
+ * $Id: config.h 1.15 2000/09/03 09:37:30 kls Exp $
*/
#ifndef __CONFIG_H
@@ -17,7 +17,7 @@
#include "dvbapi.h"
#include "tools.h"
-#define VDRVERSION "0.61"
+#define VDRVERSION "0.62"
#define MaxBuffer 10000
diff --git a/dvbapi.h b/dvbapi.h
index 25452cf..9f95430 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.12 2000/07/30 15:01:01 kls Exp $
+ * $Id: dvbapi.h 1.13 2000/09/03 09:25:53 kls Exp $
*/
#ifndef __DVBAPI_H
@@ -19,7 +19,7 @@ typedef unsigned char __u8;
#include <ncurses.h>
#endif
#include <stdio.h>
-#include "../DVB/driver/dvb.h"
+#include <dvb.h>
#define MenuLines 15
#define MenuColumns 40
diff --git a/eit.c b/eit.c
new file mode 100644
index 0000000..c4c1200
--- /dev/null
+++ b/eit.c
@@ -0,0 +1,530 @@
+/***************************************************************************
+ eit.c - description
+ -------------------
+ begin : Fri Aug 25 2000
+ copyright : (C) 2000 by Robert Schneider
+ email : Robert.Schneider@web.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * $Id: eit.c 1.1 2000/09/03 10:22:25 kls Exp $
+ ***************************************************************************/
+
+#include "eit.h"
+#include <iostream.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <sys/ioctl.h>
+#include <dvb_comcode.h>
+#include "tools.h"
+
+typedef struct {
+ u_char table_id : 8;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char section_syntax_indicator : 1;
+ u_char : 3;
+ u_char section_length_hi : 4;
+#else
+ u_char section_length_hi : 4;
+ u_char : 3;
+ u_char section_syntax_indicator : 1;
+#endif
+
+ u_char section_length_lo : 8;
+
+ u_char service_id_hi : 8;
+ u_char service_id_lo : 8;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char : 2;
+ u_char version_number : 5;
+ u_char current_next_indicator : 1;
+#else
+ u_char current_next_indicator : 1;
+ u_char version_number : 5;
+ u_char : 2;
+#endif
+
+ u_char section_number : 8;
+ u_char last_section_number : 8;
+ u_char transport_stream_id_hi : 8;
+ u_char transport_stream_id_lo : 8;
+ u_char original_network_id_hi : 8;
+ u_char original_network_id_lo : 8;
+ u_char segment_last_section_number : 8;
+ u_char segment_last_table_id : 8;
+} eit_t;
+
+#define EIT_SIZE 14
+
+struct eit_loop_struct1 {
+ u_char event_id_hi : 8;
+ u_char event_id_lo : 8;
+
+ u_char date_hi : 8;
+ u_char date_lo : 8;
+ u_char time_hour : 4;
+ u_char time_hour_ten : 4;
+ u_char time_minute : 4;
+ u_char time_minute_ten : 4;
+ u_char time_second : 4;
+ u_char time_second_ten : 4;
+
+ u_char dur_hour_ten : 4;
+ u_char dur_hour : 4;
+ u_char dur_minute_ten : 4;
+ u_char dur_minute : 4;
+ u_char dur_second_ten : 4;
+ u_char dur_second : 4;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char running_status : 3;
+ u_char free_ca_mode : 1;
+ u_char descriptors_loop_length_hi : 4;
+#else
+ u_char descriptors_loop_length_hi : 4;
+ u_char free_ca_mode : 1;
+ u_char running_status : 3;
+#endif
+
+ u_char descriptors_loop_length_lo : 8;
+};
+
+#define EIT_SHORT_EVENT_DESCRIPTOR 0x4d
+#define EIT_SHORT_EVENT_DESCRIPTOR_SIZE 6
+
+struct eit_short_event_descriptor_struct {
+ u_char descriptor_tag : 8;
+ u_char descriptor_length : 8;
+
+ u_char language_code_1 : 8;
+ u_char language_code_2 : 8;
+ u_char language_code_3 : 8;
+
+ u_char event_name_length : 8;
+};
+
+#define EIT_EXTENDED_EVENT_DESCRIPOR 0x4e
+
+#define EIT_DESCRIPTOR_SIZE
+
+typedef struct eit_event_struct {
+ u_char event_id_hi : 8;
+ u_char event_id_lo : 8;
+
+ u_char start_time_1 : 8;
+ u_char start_time_2 : 8;
+ u_char start_time_3 : 8;
+ u_char start_time_4 : 8;
+ u_char start_time_5 : 8;
+
+ u_char duration_1 : 8;
+ u_char duration_2 : 8;
+ u_char duration_3 : 8;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char running_status : 3;
+ u_char free_CA_mode : 1;
+ u_char descriptors_loop_length_hi : 4;
+#else
+ u_char descriptors_loop_length_hi : 4;
+ u_char free_CA_mode : 1;
+ u_char running_status : 3;
+#endif
+
+ u_char descriptors_loop_length_lo : 8;
+
+} eit_event_t;
+#define EIT_LOOP_SIZE 12
+
+
+typedef struct tot_t {
+ u_char table_id : 8;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char section_syntax_indicator : 1;
+ u_char : 3;
+ u_char section_length_hi : 4;
+#else
+ u_char section_length_hi : 4;
+ u_char : 3;
+ u_char section_syntax_indicator : 1;
+#endif
+
+ u_char date_hi : 8;
+ u_char date_lo : 8;
+ u_char time_hour : 4;
+ u_char time_hour_ten : 4;
+ u_char time_minute : 4;
+ u_char time_minute_ten : 4;
+ u_char time_second : 4;
+ u_char time_second_ten : 4;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ u_char : 4;
+ u_char descriptor_loop_length_hi : 4;
+#else
+ u_char descriptor_loop_length_hi : 4;
+ u_char : 4;
+#endif
+
+ u_char descriptor_loop_length_lo : 8;
+} tot_t;
+
+typedef struct local_time_offset {
+
+ u_char descriptor_tag : 8;
+ u_char descriptor_length : 8;
+
+ u_char language_code_1 : 8;
+ u_char language_code_2 : 8;
+ u_char language_code_3 : 8;
+
+ u_char : 8;
+
+ u_char offset_hour : 4;
+ u_char offset_hour_ten : 4;
+ u_char offset_minute : 4;
+ u_char offset_minute_ten : 4;
+
+ u_char change_date_hi : 8;
+ u_char change_date_lo : 8;
+ u_char change_time_hour : 4;
+ u_char change_time_hour_ten : 4;
+ u_char change_time_minute : 4;
+ u_char change_time_minute_ten : 4;
+ u_char change_time_second : 4;
+ u_char change_time_second_ten : 4;
+
+ u_char next_offset_hour : 4;
+ u_char next_offset_hour_ten : 4;
+ u_char next_offset_minute : 4;
+ u_char next_offset_minute_ten : 4;
+} local_time_offset;
+
+cEIT::cEIT()
+{
+ cszBitFilter = "/dev/vbi";
+ if((fsvbi = open(cszBitFilter, O_RDWR))<0)
+ {
+ fsvbi = 0;
+ esyslog(LOG_ERR, "Failed to open DVB bitfilter device: %s", cszBitFilter);
+ return;
+ }
+}
+
+cEIT::~cEIT()
+{
+ if (fsvbi != 0)
+ close(fsvbi);
+ fsvbi = 0;
+}
+
+/** Set the bitfilter in vbi device to return
+correct tables */
+int cEIT::SetBitFilter(unsigned short pid, unsigned short section, unsigned short mode)
+{
+ struct bitfilter filt = {
+ pid,
+ { section, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
+ mode,0,
+ FILTER_MEM,
+ {},
+ };
+
+ if (ioctl(fsvbi, VIDIOCSBITFILTER, &filt) < 0)
+ return 0xffff;
+ return 0;
+}
+/** */
+int cEIT::GetSection(unsigned char *buf, ushort PID, unsigned char sec)
+{
+ int seclen=0;
+ unsigned short handle, pid;
+ unsigned char section, sectionnum=0xff, maxsec=0;
+ struct pollfd pfd;
+
+ if ((handle = SetBitFilter(PID, (sec<<8)|0x00ff, SECTION_CONTINUOS))==0xffff)
+ return -1;
+
+ seclen=0;
+ pfd.fd=fsvbi;
+ pfd.events=POLLIN;
+ if (poll(&pfd, 1, 20000)==0)
+ {
+ //cerr << "Timeout\n";
+ return -1;
+ }
+
+ read(fsvbi, buf, 8);
+ seclen=(buf[6]<<8)|buf[7];
+ pid=(buf[4]<<8)|buf[5];
+
+ read(fsvbi, buf, seclen);
+ section=buf[0];
+ sectionnum=buf[6];
+ maxsec=buf[7];
+
+ //cerr << "secnum: " << HEX(2) << (int)sectionnum
+ // << ", secmax: " << HEX(2) << (int) msecnum << "\n";
+
+ CloseFilter(handle);
+
+ return seclen;
+}
+
+/** */
+int cEIT::CloseFilter(unsigned short handle)
+{
+ if (ioctl(fsvbi, VIDIOCSSHUTDOWNFILTER, &handle)<0)
+ return -1;
+ return 0;
+}
+
+/** */
+char * cEIT::mjd2string(unsigned short mjd)
+{
+ int y, m, d, k;
+ static char buf[20];
+
+ y = (int) ((mjd - 15078.2) / 365.25);
+ m = (int) ((mjd - 14956.1 - (int)(y * 365.25)) / 30.6001);
+ d = (int) (mjd - 14956 - (int)(y * 365.25) - (int)(m * 30.6001));
+ k = (m == 14 || m == 15) ? 1 : 0;
+ y = y + k;
+ m = m - 1 - k * 12;
+ sprintf(buf, "%d.%d.%4d", d, m, y + 1900);
+
+ return(buf);
+}
+
+/** */
+int cEIT::GetEIT()
+{
+ unsigned char buf[1024];
+ eit_t *eit;
+ struct eit_loop_struct1 *eitloop;
+ struct eit_short_event_descriptor_struct *eitevt;
+ int seclen;
+ unsigned short handle, pid;
+ struct pollfd pfd;
+ eit_event * pevt = (eit_event *)0;
+ time_t tstart;
+
+ if ((handle = SetBitFilter(0x12, (0x4e << 8) | 0x00ff, SECTION_CONTINUOS))==0xffff)
+ {
+ return -1;
+ }
+/*
+ pid_t process = fork();
+ if (process < 0)
+ {
+ cerr << "GetEIT -1" << endl;
+ return -1;
+ }
+
+ if (process != 0)
+ {
+ cerr << "GetEIT 0" << endl;
+ return 0;
+ }
+*/
+ int nReceivedEITs = 0;
+ tstart = time(NULL);
+ while ((!evtRunning.bIsValid || !evtNext.bIsValid) && nReceivedEITs < 20 && difftime(time(NULL), tstart) < 4)
+ {
+ pfd.fd=fsvbi;
+ pfd.events=POLLIN;
+ if (poll(&pfd, 1, 5000)==0)
+ {
+ //cerr << "Timeout\n";
+ CloseFilter(handle);
+ return -1;
+ }
+
+ read(fsvbi, buf, 8);
+ seclen=(buf[6]<<8)|buf[7];
+ pid=(buf[4]<<8)|buf[5];
+
+ read(fsvbi, buf, seclen);
+
+ if (seclen < (int)(sizeof(eit_t)
+ + sizeof(struct eit_loop_struct1)
+ + sizeof(struct eit_short_event_descriptor_struct)))
+ continue;
+
+ eit = (eit_t *)buf;
+ eitloop = (struct eit_loop_struct1 *)&eit[1];
+ eitevt = (struct eit_short_event_descriptor_struct *)&eitloop[1];
+
+ if (eitevt->descriptor_tag != EIT_SHORT_EVENT_DESCRIPTOR)
+ {
+ // printf("Tag = '%c'\n", eitevt->descriptor_tag);
+ continue;
+ }
+
+ if (((eit->service_id_hi << 8) | eit->service_id_lo) != uProgramNumber)
+ {
+ // printf("Wrong program %04x need %04x\n", (eit->service_id_hi << 8) | eit->service_id_lo, uProgramNumber);
+ continue;
+ }
+
+ nReceivedEITs++;
+
+ pevt = (eit_event *)0;
+ if (eitloop->running_status == 4 | eitloop->running_status == 3)
+ pevt = (eit_event *)&evtRunning;
+ else if (eitloop->running_status == 1 || eitloop->running_status == 2 || eitloop->running_status == 0)
+ pevt = (eit_event *)&evtNext;
+
+ if (pevt)
+ {
+ unsigned char *p = (unsigned char *)&eitevt[1];
+ strdvbcpy((unsigned char *)pevt->szTitle, p, eitevt->event_name_length);
+ pevt->szSubTitle[0] = 0;
+ strdvbcpy((unsigned char *)pevt->szSubTitle, &p[eitevt->event_name_length+1], (int)p[eitevt->event_name_length]);
+ strcpy(pevt->szDate, mjd2string((eitloop->date_hi << 8) + eitloop->date_lo));
+ int hr = eitloop->time_hour + (eitloop->time_hour_ten * 10);
+ hr += 2;
+ if (hr >=24)
+ {
+ hr -= 24;
+ // need to switch date one day ahead here
+ }
+ sprintf(pevt->szTime, "%d:%c%c", hr,
+ eitloop->time_minute_ten + '0',
+ eitloop->time_minute + '0');
+ pevt->bIsValid = true;
+ }
+ }
+
+ CloseFilter(handle);
+
+ return 1;
+}
+
+/** */
+int cEIT::SetProgramNumber(unsigned short pnr)
+{
+ if (pnr == 0)
+ {
+ evtRunning.bIsValid = false;
+ evtNext.bIsValid = false;
+ return -1;
+ }
+
+ if (pnr != uProgramNumber)
+ {
+ evtRunning.bIsValid = false;
+ evtNext.bIsValid = false;
+ uProgramNumber = pnr;
+ return GetEIT();
+ }
+ return (IsValid() ? 1 : -1);
+}
+
+/** retrieves the string for the running title */
+char * cEIT::GetRunningTitle()
+{
+ if (evtRunning.bIsValid)
+ return evtRunning.szTitle;
+ else
+ return "---";
+}
+/** Retrieves the string for the running subtitle */
+char * cEIT::GetRunningSubtitle()
+{
+ if (evtRunning.bIsValid)
+ return evtRunning.szSubTitle;
+ else
+ return "---";
+}
+/** Retrieves the string representing the
+date of the current event
+ */
+char * cEIT::GetRunningDate()
+{
+ if (evtRunning.bIsValid)
+ return evtRunning.szDate;
+ else
+ return "---";
+}
+/** Retrieves the string representing the
+time of the current event */
+char * cEIT::GetRunningTime()
+{
+ if (evtRunning.bIsValid)
+ return evtRunning.szTime;
+ else
+ return "---";
+}
+/** retrieves the string for the running title */
+char * cEIT::GetNextTitle()
+{
+ if (evtNext.bIsValid)
+ return evtNext.szTitle;
+ else
+ return "---";
+}
+/** Retrieves the string for the running subtitle */
+char * cEIT::GetNextSubtitle()
+{
+ if (evtNext.bIsValid)
+ return evtNext.szSubTitle;
+ else
+ return "---";
+}
+/** Retrieves the string representing the
+date of the current event
+ */
+char * cEIT::GetNextDate()
+{
+ if (evtNext.bIsValid)
+ return evtNext.szDate;
+ else
+ return "---";
+}
+/** Retrieves the string representing the
+time of the current event */
+char * cEIT::GetNextTime()
+{
+ if (evtNext.bIsValid)
+ return evtNext.szTime;
+ else
+ return "---";
+}
+
+/** */
+bool cEIT::IsValid()
+{
+ return (evtRunning.bIsValid && evtNext.bIsValid);
+}
+
+/** */
+int cEIT::strdvbcpy(unsigned char *dst, unsigned char *src, int max)
+{
+ int a;
+ for (a = 0; a < max; a++)
+ {
+ if (*src == 0)
+ break;
+
+ if ((*src >= ' ' && *src <= '~') || (*src >= 0xa0 && *src <= 0xff))
+ *dst++ = *src++;
+ else
+ src++;
+ }
+ *dst = 0;
+ return a;
+}
diff --git a/eit.h b/eit.h
new file mode 100644
index 0000000..28329f4
--- /dev/null
+++ b/eit.h
@@ -0,0 +1,92 @@
+/***************************************************************************
+ eit.h - description
+ -------------------
+ begin : Fri Aug 25 2000
+ copyright : (C) 2000 by Robert Schneider
+ email : Robert.Schneider@web.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * $Id: eit.h 1.1 2000/09/03 10:23:24 kls Exp $
+ ***************************************************************************/
+
+#ifndef __EIT_H
+#define __EIT_H
+
+#include <dvb_v4l.h>
+
+typedef struct eit_event {
+
+ bool bIsValid;
+ char szTitle[512];
+ char szSubTitle[512];
+ char szDate[12];
+ char szTime[12];
+
+}eit_event;
+
+/**
+ *@author Robert Schneider
+ */
+
+class cEIT {
+public:
+ cEIT();
+ ~cEIT();
+ /** */
+ int GetEIT();
+ /** */
+ int SetProgramNumber(unsigned short pnr);
+ /** Retrieves the string representing the time of the current event */
+ char * GetRunningTime();
+ /** Retrieves the string representing the date of the current event */
+ char * GetRunningDate();
+ /** Retrieves the string for the running subtitle */
+ char * GetRunningSubtitle();
+ /** retrieves the string for the running title */
+ char * GetRunningTitle();
+ /** Retrieves the string representing the time of the next event */
+ char * GetNextTime();
+ /** Retrieves the string representing the date of the next event */
+ char * GetNextDate();
+ /** Retrieves the string for the next subtitle */
+ char * GetNextSubtitle();
+ /** retrieves the string for the next title */
+ char * GetNextTitle();
+ /** */
+ bool IsValid();
+
+protected: // Protected attributes
+ /** Device name of VBI device */
+ const char * cszBitFilter;
+protected: // Protected attributes
+ /** handle to VBI device (usually /dev/vbi) */
+ int fsvbi;
+ /** Describes the event next on */
+ eit_event evtNext;
+ /** Describes the running event */
+ eit_event evtRunning;
+protected: // Protected methods
+ /** Set the bitfilter in vbi device to return
+correct tables */
+ int SetBitFilter(unsigned short pid, unsigned short section, unsigned short mode);
+ /** */
+ int GetSection(unsigned char *buf, ushort PID, unsigned char sec);
+ /** */
+ int CloseFilter(unsigned short handle);
+ /** */
+ char * mjd2string(unsigned short mjd);
+ /** */
+ int strdvbcpy(unsigned char *dst, unsigned char *src, int max);
+public: // Public attributes
+ /** */
+ unsigned short uProgramNumber;
+};
+
+#endif
diff --git a/interface.c b/interface.c
index 244488a..2ae49c3 100644
--- a/interface.c
+++ b/interface.c
@@ -4,13 +4,16 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: interface.c 1.10 2000/07/15 12:39:20 kls Exp $
+ * $Id: interface.c 1.11 2000/09/03 10:17:21 kls Exp $
*/
#include "interface.h"
#include <unistd.h>
+#include "eit.h"
#include "remote.h"
+cEIT EIT;
+
#if defined(REMOTE_RCU)
cRcIoRCU RcIo("/dev/ttyS1");
#elif defined(REMOTE_LIRC)
@@ -316,7 +319,7 @@ void cInterface::DisplayChannel(int Number, const char *Name)
{
RcIo.Number(Number);
if (Name && !Recording()) {
- Open(MenuColumns, 1);
+ Open(MenuColumns, EIT.IsValid() ? 5 : 1);
char buffer[MenuColumns + 1];
snprintf(buffer, sizeof(buffer), "%d %s", Number, Name ? Name : "");
Write(0, 0, buffer);
@@ -324,7 +327,21 @@ void cInterface::DisplayChannel(int Number, const char *Name)
struct tm *now = localtime(&t);
snprintf(buffer, sizeof(buffer), "%02d:%02d", now->tm_hour, now->tm_min);
Write(-5, 0, buffer);
- if (Wait(2, true) == kOk)
+ if (EIT.IsValid()) {
+ const int t = 7;
+ int w = MenuColumns - t;
+ Write(0, 1, EIT.GetRunningTime(), clrYellow, clrBackground);
+ snprintf(buffer, sizeof(buffer), "%.*s", w, EIT.GetRunningTitle());
+ Write(t, 1, buffer, clrCyan, clrBackground);
+ snprintf(buffer, sizeof(buffer), "%.*s", w, EIT.GetRunningSubtitle());
+ Write(t, 2, buffer, clrCyan, clrBackground);
+ Write(0, 3, EIT.GetNextTime(), clrYellow, clrBackground);
+ snprintf(buffer, sizeof(buffer), "%.*s", w, EIT.GetNextTitle());
+ Write(t, 3, buffer, clrCyan, clrBackground);
+ snprintf(buffer, sizeof(buffer), "%.*s", w, EIT.GetNextSubtitle());
+ Write(t, 4, buffer, clrCyan, clrBackground);
+ }
+ if (Wait(5, true) == kOk)
GetKey();
Close();
}
diff --git a/svdrp.c b/svdrp.c
index 9fef184..01e9fb7 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.4 2000/08/06 12:52:04 kls Exp $
+ * $Id: svdrp.c 1.5 2000/08/26 12:51:51 kls Exp $
*/
#define _GNU_SOURCE
@@ -639,7 +639,7 @@ void cSVDRP::Process(void)
//TODO how can we get the *full* hostname?
gethostname(buffer, sizeof(buffer));
time_t now = time(NULL);
- Reply(220, "%s SVDRP VideoDiskRecorder %s; %s", VDRVERSION, buffer, ctime(&now));
+ Reply(220, "%s SVDRP VideoDiskRecorder %s; %s", buffer, VDRVERSION, ctime(&now));
}
int rbytes = readstring(filedes, buffer, sizeof(buffer) - 1);
if (rbytes > 0) {
diff --git a/timers.conf b/timers.conf
index 47b4067..733fb9c 100644
--- a/timers.conf
+++ b/timers.conf
@@ -1,13 +1,11 @@
-0:10:-T-----:2058:2202:99:10:Quarks:
-0:5:-T-----:2100:2205:99:10:RudisSuchmaschine:
-1:10:---T---:2158:2250:99:99:DiePlaneten:
+1:10:-T-----:2058:2202:99:10:Quarks:
+1:26:-T-----:2203:0015:99:99:UFO:
0:3:---T---:2211:2300:99:10:Switch:
+1:2:----F--:2140:2225:10:10:WWW:
1:15:-----S-:1358:1435:99:7:Neues:
1:1:-----S-:1445:1610:99:30:Hammerman:
-0:2:-----S-:2200:2350:99:30:Wochenshow:
+0:11:-----S-:2158:2235:99:99:Computer:
+1:2:-----S-:2213:2320:99:30:Wochenshow:
1:11:------S:2058:2120:99:10:Centauri:
-0:15:MTWTF--:1828:1901:10:5:nano:
-1:1:-TWTF--:0858:0940:99:99:Ellen:
-1:2:----F--:2140:2225:10:10:WWW:
-1:11:-----S-:2158:2235:99:99:Computer:
-1:23:-----S-:2200:0020:99:99:BBC special:
+1:15:MTWTF--:1828:1901:10:5:nano:
+1:1:-TWTF--:0855:0945:99:99:Ellen: