From 01bff47d1c94392905f6d538a9b0695c72880c7c Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 24 Nov 2001 11:42:43 +0100 Subject: [PATCH] Implemented DVB-T support; Removed the range limits for the Frequency and Srate parameters of channel definitions --- CONTRIBUTORS | 1 + FORMATS | 10 +++--- HISTORY | 5 ++- INSTALL | 25 ++++++++----- channels.conf.terr | 11 ++++++ dvbapi.c | 89 ++++++++++++++++++++-------------------------- dvbapi.h | 4 +-- menu.c | 6 ++-- 8 files changed, 82 insertions(+), 69 deletions(-) create mode 100644 channels.conf.terr diff --git a/CONTRIBUTORS b/CONTRIBUTORS index aaf28798..12154c81 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -59,6 +59,7 @@ Deti Fliegl Dave Chapman for implementing support for the teletext PID for his great support in switching to the NAPI + for implementing DVB-T support Hans-Peter Raschke for his support in adapting VDR to DVB-C diff --git a/FORMATS b/FORMATS index 9142fd70..2a99e6ef 100644 --- a/FORMATS +++ b/FORMATS @@ -20,10 +20,10 @@ Video Disk Recorder File Formats - Name: the channel's name (if the name originally contains a ':' character it has to be replaced by '|') - - Frequency in MHz (as an integer) + - Frequency in MHz for DVB-S and DVB-C, kHz for DVB-T (as an integer) - Polarization (one of 'h', 'H', 'v', 'V') ** - Diseqc number ** - - Symbol rate + - Symbol rate *** - Video PID - Audio PID (either one number, or two, separated by a comma) If this channel also carries Dolby Digital sound, the Dolby PIDs follow @@ -33,8 +33,10 @@ Video Disk Recorder File Formats DVB card, 2 = can be decrypted by the second DVB card) - Program Number - Fields marked with ** are only meaningful for DVB-S (satellite) receivers. - DVB-C receivers simply ignore these. + Fields marked with ** are only meaningful for DVB-S receivers. + DVB-C and DVB-T receivers simply ignore these. + Fields marked with *** are only meaningful for DVB-S and DVB-C receivers. + DVB-T receivers simply ignore these. * timers.conf diff --git a/HISTORY b/HISTORY index 0628970f..d37095b5 100644 --- a/HISTORY +++ b/HISTORY @@ -866,9 +866,12 @@ Video Disk Recorder Revision History - The device /dev/video is now opened only if necessary (to GRAB an image), allowing other programs (like 'kvdr', for instance) to use that device. -2001-11-10: Version 0.9.9 +2001-11-24: Version 0.9.9 - Changed version numbering scheme. - Fixed several channel definitions in 'channels.conf' (thanks to Thilo Wunderlich). - Added MPEG audio support for DVD (thanks to Andreas Schultz). +- Implemented DVB-T support (thanks to Dave Chapman). +- Removed the range limits for the Frequency and Srate parameters of channel + definitions. diff --git a/INSTALL b/INSTALL index d20bf1a1..d1650961 100644 --- a/INSTALL +++ b/INSTALL @@ -334,16 +334,23 @@ accessed using DiSEqC, you have to go to the "Setup" menu and set the "DiSEqC" parameter to "on". Also check the "DiSEqC" parameters for the various channels and set them to the necessary values. -Running VDR with DVB-C (cable): -------------------------------- +Running VDR with DVB-C (cable) or DVB-T (terrestrial): +------------------------------------------------------ -VDR automatically recognizes if the DVB card in use is a cable card. -The only things that needs to be different when using digital cable -is the 'channels.conf' file. The distribution archive contains a default -'channels.conf.cable', which cable users can rename or copy to 'channels.conf' -in order to receive cable channels. The format of this file is exactly the -same as for satellite channels (the fields containing "Polarization" and -"Diseqc" data are ignored in case of DVB-C). +VDR automatically recognizes if the DVB card in use is a cable or a +terrestrial card. The only thing that needs to be different when using digital +cable or terrestrial reception is the 'channels.conf' file. The distribution +archive contains a default 'channels.conf.cable' and 'channels.conf.terr', +respectively, which users of such cards can rename or copy to 'channels.conf' +in order to receive digital cable or terrestrial channels. The format of these +files is exactly the same as for satellite channels (the fields containing +"Polarization" and "Diseqc" data are ignored in case of DVB-C and DVB-T, and +the "Frequency" is in kHz in case of DVB-T). + +You can even use a mixture of DVB-S, DVB-C and DVB-T cards in the same system. +All you need to do is to put all the channel definitions into one big +'channels.conf' file and set the 'Ca' parameter of each channel to the number +of the card that can receive it. Learning the remote control keys: --------------------------------- diff --git a/channels.conf.terr b/channels.conf.terr new file mode 100644 index 00000000..bed1be8c --- /dev/null +++ b/channels.conf.terr @@ -0,0 +1,11 @@ +: UK channels +BBC ONE:505833:0:0:0:600:601:0:0:4164 +BBC TWO:505833:0:0:0:610:611:0:0:4228 +ITV 1:481833:0:0:0:512:650:0:0:8261 +Channel 4:481833:0:0:0:2827:2828:0:0:8384 +Channel 5:561833:0:0:0:6017:6018:0:0:12866 +ITV 2:481833:0:0:0:2818:2819:0:0:8325 +BBC CHOICE:505833:0:0:0:620:621:0:0:4351 +BBC NEWS 24:505833:0:0:0:640:641:0:0:4415 +BBC Knowledge:505833:0:0:0:630:631:0:0:4607 +Shop!:561833:0:0:0:6049:6050:0:0:13120 diff --git a/dvbapi.c b/dvbapi.c index 12ff9486..5f9b0641 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -7,7 +7,7 @@ * DVD support initially written by Andreas Schultz * based on dvdplayer-0.5 by Matjaz Thaler * - * $Id: dvbapi.c 1.138 2001/11/10 13:35:22 kls Exp $ + * $Id: dvbapi.c 1.139 2001/11/24 11:03:01 kls Exp $ */ //#define DVDDEBUG 1 @@ -3068,7 +3068,7 @@ bool cDvbApi::SetPids(bool ForRecording) SetDpid2(ForRecording ? dPid2 : 0, DMX_OUT_TS_TAP); } -eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid1, int Apid2, int Dpid1, int Dpid2, int Tpid, int Ca, int Pnr) +eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int Frequency, char Polarization, int Diseqc, int Srate, int Vpid, int Apid1, int Apid2, int Dpid1, int Dpid2, int Tpid, int Ca, int Pnr) { // Make sure the siProcessor won't access the device while switching cThreadLock ThreadLock(siProcessor); @@ -3110,14 +3110,14 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char SetDpid2(0x1FFF, DMX_OUT_DECODER); SetTpid( 0x1FFF, DMX_OUT_DECODER); - bool ChannelSynced = false; + FrontendParameters Frontend; switch (frontendType) { case FE_QPSK: { // DVB-S // Frequency offsets: - unsigned int freq = FrequencyMHz; + unsigned int freq = Frequency; int tone = SEC_TONE_OFF; if (freq < (unsigned int)Setup.LnbSLOF) { @@ -3129,7 +3129,6 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char tone = SEC_TONE_ON; } - FrontendParameters Frontend; Frontend.Frequency = freq * 1000UL; Frontend.Inversion = INVERSION_AUTO; Frontend.u.qpsk.SymbolRate = Srate * 1000UL; @@ -3154,58 +3153,32 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char scmds.commands = &scmd; CHECK(ioctl(fd_sec, SEC_SEND_SEQUENCE, &scmds)); - - // Tuning: - - CHECK(ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend)); - - // Wait for channel sync: - - if (cFile::FileReady(fd_frontend, 5000)) { - FrontendEvent event; - int res = ioctl(fd_frontend, FE_GET_EVENT, &event); - if (res >= 0) - ChannelSynced = event.type == FE_COMPLETION_EV; - else - esyslog(LOG_ERR, "ERROR %d in frontend get event", res); - } - else - esyslog(LOG_ERR, "ERROR: timeout while tuning"); } break; case FE_QAM: { // DVB-C // Frequency and symbol rate: - FrontendParameters Frontend; - Frontend.Frequency = FrequencyMHz * 1000000UL; + Frontend.Frequency = Frequency * 1000000UL; Frontend.Inversion = INVERSION_AUTO; Frontend.u.qam.SymbolRate = Srate * 1000UL; Frontend.u.qam.FEC_inner = FEC_AUTO; Frontend.u.qam.QAM = QAM_64; - - // Tuning: - - CHECK(ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend)); - - // Wait for channel sync: - - if (cFile::FileReady(fd_frontend, 5000)) { - FrontendEvent event; - int res = ioctl(fd_frontend, FE_GET_EVENT, &event); - if (res >= 0) - ChannelSynced = event.type == FE_COMPLETION_EV; - else - esyslog(LOG_ERR, "ERROR %d in frontend get event", res); - } - else - esyslog(LOG_ERR, "ERROR: timeout while tuning"); } break; case FE_OFDM: { // DVB-T - //XXX TODO: implement DVB-T tuning (anybody with a DVB-T card out there?) - esyslog(LOG_ERR, "ERROR: DVB-T tuning support not yet implemented"); - return scrFailed; + + // Frequency and OFDM paramaters: + + Frontend.Frequency = Frequency * 1000UL; + Frontend.Inversion = INVERSION_AUTO; + Frontend.u.ofdm.bandWidth=BANDWIDTH_8_MHZ; + Frontend.u.ofdm.HP_CodeRate=FEC_2_3; + Frontend.u.ofdm.LP_CodeRate=FEC_1_2; + Frontend.u.ofdm.Constellation=QAM_64; + Frontend.u.ofdm.TransmissionMode=TRANSMISSION_MODE_2K; + Frontend.u.ofdm.guardInterval=GUARD_INTERVAL_1_32; + Frontend.u.ofdm.HierarchyInformation=HIERARCHY_NONE; } break; default: @@ -3213,12 +3186,28 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char return scrFailed; } - if (!ChannelSynced) { - esyslog(LOG_ERR, "ERROR: channel %d not sync'ed on DVB card %d!", ChannelNumber, CardIndex() + 1); - if (this == PrimaryDvbApi) - cThread::RaisePanic(); - return scrFailed; + // Tuning: + + CHECK(ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend)); + + // Wait for channel sync: + + if (cFile::FileReady(fd_frontend, 5000)) { + FrontendEvent event; + int res = ioctl(fd_frontend, FE_GET_EVENT, &event); + if (res >= 0) { + if (event.type != FE_COMPLETION_EV) { + esyslog(LOG_ERR, "ERROR: channel %d not sync'ed on DVB card %d!", ChannelNumber, CardIndex() + 1); + if (this == PrimaryDvbApi) + cThread::RaisePanic(); + return scrFailed; + } + } + else + esyslog(LOG_ERR, "ERROR %d in frontend get event", res); } + else + esyslog(LOG_ERR, "ERROR: timeout while tuning"); // PID settings: @@ -3242,7 +3231,7 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char if (NeedsTransferMode) { cDvbApi *CaDvbApi = GetDvbApi(Ca, 0); if (CaDvbApi && !CaDvbApi->Recording()) { - if ((Result = CaDvbApi->SetChannel(ChannelNumber, FrequencyMHz, Polarization, Diseqc, Srate, Vpid, Apid1, Apid2, Dpid1, Dpid2, Tpid, Ca, Pnr)) == scrOk) { + if ((Result = CaDvbApi->SetChannel(ChannelNumber, Frequency, Polarization, Diseqc, Srate, Vpid, Apid1, Apid2, Dpid1, Dpid2, Tpid, Ca, Pnr)) == scrOk) { SetModeReplay(); transferringFromDvbApi = CaDvbApi->StartTransfer(fd_video); } diff --git a/dvbapi.h b/dvbapi.h index 01bb2dd9..aa4a5feb 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.58 2001/11/04 11:39:42 kls Exp $ + * $Id: dvbapi.h 1.59 2001/11/24 11:03:16 kls Exp $ */ #ifndef __DVBAPI_H @@ -187,7 +187,7 @@ public: private: int currentChannel; public: - eSetChannelResult SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid1, int Apid2, int Dpid1, int Dpid2, int Tpid, int Ca, int Pnr); + eSetChannelResult SetChannel(int ChannelNumber, int Frequency, char Polarization, int Diseqc, int Srate, int Vpid, int Apid1, int Apid2, int Dpid1, int Dpid2, int Tpid, int Ca, int Pnr); static int CurrentChannel(void) { return PrimaryDvbApi ? PrimaryDvbApi->currentChannel : 0; } int Channel(void) { return currentChannel; } diff --git a/menu.c b/menu.c index 154f66cf..e3762ca1 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.139 2001/11/04 10:37:18 kls Exp $ + * $Id: menu.c 1.140 2001/11/24 11:16:31 kls Exp $ */ #include "menu.h" @@ -546,10 +546,10 @@ cMenuEditChannel::cMenuEditChannel(int Index) if (channel) { data = *channel; Add(new cMenuEditStrItem( tr("Name"), data.name, sizeof(data.name), FileNameChars)); - Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency, 10000, 13000)); //TODO exact limits??? + Add(new cMenuEditIntItem( tr("Frequency"), &data.frequency)); Add(new cMenuEditChrItem( tr("Polarization"), &data.polarization, "hv")); Add(new cMenuEditIntItem( tr("DiSEqC"), &data.diseqc, 0, 10)); //TODO exact limits??? - Add(new cMenuEditIntItem( tr("Srate"), &data.srate, 22000, 30000)); //TODO exact limits - toggle??? + Add(new cMenuEditIntItem( tr("Srate"), &data.srate)); Add(new cMenuEditIntItem( tr("Vpid"), &data.vpid, 0, 0xFFFE)); Add(new cMenuEditIntItem( tr("Apid1"), &data.apid1, 0, 0xFFFE)); Add(new cMenuEditIntItem( tr("Apid2"), &data.apid2, 0, 0xFFFE));