From b420457467ad0c8ae71f8b985914e85b7a0ff5aa Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 25 Nov 2001 18:00:00 +0100 Subject: Version 0.99pre1 - 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). This currently works only for UK channels. - Removed the range limits for the Frequency and Srate parameters of channel definitions. - Changed the maximum value for PIDs in channels.conf from 0xFFFE to 0x1FFF. - Fixed DVD audio sync problems (thanks to Andreas Schultz). - Fixed external AC3 replay for DVDs (thanks to Andreas Schultz). --- CONTRIBUTORS | 4 ++ FORMATS | 10 ++-- HISTORY | 13 +++++ INSTALL | 27 ++++++---- ac3dec/ac3.h | 6 +++ ac3dec/decode.c | 8 +++ channels.conf | 51 +++++++++---------- channels.conf.terr | 11 +++++ config.h | 4 +- dvbapi.c | 141 ++++++++++++++++++++--------------------------------- dvbapi.h | 4 +- dvd.c | 23 ++++++++- dvd.h | 11 ++++- menu.c | 18 +++---- 14 files changed, 188 insertions(+), 143 deletions(-) create mode 100644 channels.conf.terr diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2fdfcc1..12154c8 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 @@ -162,3 +163,6 @@ Thomas Heiligenmann Norbert Schmidt for filling in some missing teletext PIDs + +Thilo Wunderlich + for his help in keeping 'channels.conf' up to date diff --git a/FORMATS b/FORMATS index 9142fd7..2a99e6e 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 c9d404e..3f00cb1 100644 --- a/HISTORY +++ b/HISTORY @@ -865,3 +865,16 @@ Video Disk Recorder Revision History will now need to use kvdr 0.4 or later. - 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-25: Version 0.99 + +- 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). + This currently works only for UK channels. +- Removed the range limits for the Frequency and Srate parameters of channel + definitions. +- Changed the maximum value for PIDs in channels.conf from 0xFFFE to 0x1FFF. +- Fixed DVD audio sync problems (thanks to Andreas Schultz). +- Fixed external AC3 replay for DVDs (thanks to Andreas Schultz). diff --git a/INSTALL b/INSTALL index d20bf1a..0ab7eda 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): -------------------------------- - -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). +Running VDR with DVB-C (cable) or DVB-T (terrestrial): +------------------------------------------------------ + +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 +'channel.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/ac3dec/ac3.h b/ac3dec/ac3.h index d325f3b..8f268fb 100644 --- a/ac3dec/ac3.h +++ b/ac3dec/ac3.h @@ -19,7 +19,11 @@ * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * + *------------------------------------------------------------ * + * 24 Nov 2001 + * Andreas Schultz + * Added ac3_buffersize() */ #define AC3_BUFFER_SIZE (6*1024*16) @@ -55,4 +59,6 @@ size_t ac3dec_decode_data (plugin_output_audio_t *output, uint8_t *data_start, u size_t ac3dec_decode_data (uint8_t *data_start ,uint8_t *data_end, int ac3reset, int *input_pointer, int *output_pointer, char *ac3_data); #endif +uint32_t ac3_buffersize(); + #endif diff --git a/ac3dec/decode.c b/ac3dec/decode.c index fb85205..1ff517c 100644 --- a/ac3dec/decode.c +++ b/ac3dec/decode.c @@ -31,6 +31,9 @@ * Matjaz Thaler * Added support for DVB-s PCI card * + * 24 Nov 2001 + * Andreas Schultz + * Added ac3_buffersize() */ #ifdef HAVE_CONFIG_H @@ -96,6 +99,11 @@ static uint32_t buffer_size = 0;; // for error handling jmp_buf error_jmp_mark; +uint32_t ac3_buffersize() +{ + return buffer_size; +} + static uint32_t decode_buffer_syncframe (syncinfo_t *syncinfo, uint8_t **start, uint8_t *end) { uint8_t *cur = *start; diff --git a/channels.conf b/channels.conf index c9bf996..2cc3975 100644 --- a/channels.conf +++ b/channels.conf @@ -28,10 +28,10 @@ Neun Live:12480:v:0:27500:767:768:0:0:897 DSF:12480:v:0:27500:1023:1024:0:0:900 HOT:12480:v:0:27500:1279:1280:0:0:40 Bloomberg TV Germany:12551:v:0:22000:162:99:0:0:12160 -BLOOMBERG TV:11817:v:0:27500:163:92:0:0:8004 -Bloomberg:12168:v:0:27500:167:112:0:0:12721 +Bloomberg TV France:11817:v:0:27500:163:92:0:0:8004 +Bloomberg TV Spain:12168:v:0:27500:167:112:0:0:12721 Sky News:12552:v:0:22000:305:306:0:0:3995 -KinderNet:12574:h:0:22000:163:92:0:0:5020 +Fox Kids Netherlands:12574:h:0:22000:163:92:0:0:5020 Alice:12610:v:0:22000:162:96:0:0:12200 n-tv:12669:v:0:22000:162:96:55:0:12730 Grand Tourisme:12670:v:0:22000:289:290:0:0:17300 @@ -97,7 +97,7 @@ Cinedom 5B:11720:h:0:27500:1791:1792:0:3:177 Cinedom 5C:12070:h:0:27500:1023:1024:0:3:186 :Beta Digital N24:11914:H:0:27500:255:256:8191:3:52 -CNBC:12148:h:0:27500:255:256:0:3:35 +CNBC:11954:h:0:27500:510:520:0:0:28010 Liberty TV.com:12610:V:0:22000:941:943,942:0:0:12199 :PW Erotic Beate-Uhse.TV:11758:h:0:27500:3839:3840:0:3:21 @@ -105,9 +105,9 @@ Blue Movie 1:11758:h:0:27500:1791:1792:0:3:513 Blue Movie 2:11758:h:0:27500:2047:2048:0:3:514 Blue Movie 3:11758:h:0:27500:2303:2304:0:3:515 :Sportsworld -Premiere Sport 1:11719:h:0:27500:255:256:0:3:17 -Premiere Sport 2:11719:h:0:27500:3327:3328:0:3:27 -Premiere Sport 3:11758:h:0:27500:2815:2816:0:3:18 +Premiere Sport 1:11720:h:0:27500:255:256,257:0:3:17 +Premiere Sport 2:12070:h:0:27500:3839:3840:0:3:27 +Premiere Sport 3:12070:h:0:27500:255:256:0:3:26 :Formel 1 Infokanal:11720:h:0:27500:3071:3072:0:3:244 Multikanal:11720:h:0:27500:2815:2816:0:3:243 @@ -118,12 +118,12 @@ Boxengasse:11720:h:0:27500:2047:2048:0:3:240 :Premiere World Bundesliga Superdom:11758:h:0:27500:2815:8192:0:3:18 BuLi-Konferenz:11758:h:0:27500:3327:3328,3329:0:3:215 -BuLi-Spiel 1:11719:h:0:27500:255:256,257:0:3:17 -BuLi-Spiel 2:11719:h:0:27500:2047:2048,2049:0:3:240 -BuLi-Spiel 3:11719:h:0:27500:2303:2304,2305:0:3:241 -BuLi-Spiel 4:11719:h:0:27500:2559:2560,2561:0:3:242 -BuLi-Spiel 5:11719:h:0:27500:2815:2816,2817:0:3:243 -BuLi-Spiel 6:11719:h:0:27500:3071:3072,3073:0:3:244 +BuLi-Spiel 1:11720:h:0:27500:255:256,257:0:3:17 +BuLi-Spiel 2:11720:h:0:27500:2047:2048,2049:0:3:240 +BuLi-Spiel 3:11720:h:0:27500:2303:2304,2305:0:3:241 +BuLi-Spiel 4:11720:h:0:27500:2559:2560,2561:0:3:242 +BuLi-Spiel 5:11720:h:0:27500:2815:2816,2817:0:3:243 +BuLi-Spiel 6:11720:h:0:27500:3071:3072,3073:0:3:244 BuLi-Spiel 7:11758:h:0:27500:3071:3072,3073:0:3:214 : TV Niepokalanow:11876:h:0:27500:305:321:0:0:20601 @@ -132,12 +132,12 @@ Andalucia TV:11934:v:0:27500:166:104:0:0:29011 TVC Internacional:11934:v:0:27500:167:108:0:0:0 Nasza TV:11992:h:0:27500:165:98:0:0:0 WishLine test:12012:v:0:27500:163:90:0:0:0 -Pro 7 Austria:12051:v:0:27500:161:84:0:0:0 -Kabel 1 Schweiz:12051:v:0:27500:162:163:0:0:0 -Kabel 1 Austria:12051:v:0:27500:166:167:0:0:0 -Pro 7 Schweiz:12051:v:0:27500:289:290:0:0:0 +Pro 7 Austria:12051:v:0:27500:161:84:0:0:20002 +Kabel 1 Schweiz:12051:v:0:27500:162:163:0:0:20003 +Kabel 1 Austria:12051:v:0:27500:166:167:0:0:20004 +Pro 7 Schweiz:12051:v:0:27500:289:290:0:0:20001 Kiosque:12129:v:0:27500:160:80:0:0:0 -KTO:12129:v:0:27500:170:120:0:0:0 +KTO:11739:v:0:27500:163:90:0:0:8304 TCM:12168:v:0:27500:160:80:0:0:0 Cartoon Network France & Spain:12168:v:0:27500:161:84:0:0:0 TVBS Europe:12168:v:0:27500:162:88:0:0:0 @@ -147,14 +147,14 @@ TCM Espania:12168:v:0:27500:164:96:0:0:0 MTV Spain:12168:v:0:27500:167:112:0:0:0 TCM France:12168:v:0:27500:169:64:0:0:0 RTL2 CH:12188:h:0:27500:164:112:0:0:0 -La Cinquieme:12207:v:0:27500:160:80:0:0:0 -ARTE:12207:v:0:27500:165:100:0:0:0 +La Cinquieme:12207:v:0:27500:160:80:0:0:8501 +LCP:12207:v:0:27500:165:100:0:0:8506 Post Filial TV:12226:h:0:27500:255:256:0:0:0 Canal Canaris:12246:v:0:27500:160:80:0:0:0 Canal Canaris:12246:v:0:27500:160:81:0:0:0 Canal Canaris:12246:v:0:27500:160:82:0:0:0 Canal Canaris:12246:v:0:27500:160:83:0:0:0 -AB Sat Passion promo:12266:h:0:27500:160:80:0:0:0 +AB Moteurs:12266:h:0:27500:160:80:0:0:17000 AB Channel 1:12266:h:0:27500:161:84:0:0:0 Taquilla 0:12285:v:0:27500:165:100:0:0:0 CSAT:12324:v:0:27500:160:80:0:0:0 @@ -174,7 +174,7 @@ Fashion TV:12402:v:0:27500:163:92:0:0:0 VideoService:12422:h:0:27500:255:256:0:0:0 Beta Research promo:12422:h:0:27500:1023:1024:0:0:0 Canal Canarias:12441:v:0:27500:160:80:0:0:0 -TVC International:12441:v:0:27500:512:660:0:0:0 +TVC International:12441:v:0:27500:512:660:0:0:29701 Fitur:12441:v:0:27500:514:662:0:0:0 Astra Info 1:12552:v:0:22000:164:112:0:0:0 Astra Info 2:12552:v:0:22000:165:120:0:0:0 @@ -185,17 +185,18 @@ Astra Vision 1:12552:v:0:22000:168:147:0:0:0 Astra Vision 1:12552:v:0:22000:168:148:0:0:0 Astra Vision 1:12552:v:0:22000:168:149:0:0:0 Astra Vision 1:12552:v:0:22000:168:150:0:0:0 -RTL Tele Letzebuerg:12552:v:0:22000:168:144:0:0:0 +RTL Tele Letzebuerg:12552:v:0:22000:168:144,146:0:0:3994 Astra Mosaic:12552:v:0:22000:175:176:0:0:0 MHP test:12604:h:0:22000:5632:0:0:0:0 VERONICA:12574:h:0:22000:161:84:0:0:5010 VH1 Classic:12699:v:0:22000:3071:3072:0:0:28647 -VH-1 Germany:12699:v:0:22000:3081:3082:0:0:28648 +MTV 2 Pop:12699:v:0:22000:3081:3082:0:0:28648 Via 1 - Schöner Reisen:12148:h:0:27500:511:512:0:0:44 Video Italia:12610:v:0:22000:121:122:0:0:12220 AC 3 promo:12670:v:0:22000:308:256:0:0:0 ORF/ZDF:12699:h:0:22000:506:507:0:0:13012 VIVA:12670:v:0:22000:309:310:0:0:12732 VIVA2:12552:v:0:22000:171:172:0:0:12120 -MTV Central Europe:12699:v:0:22000:3031:3032:0:0:28643 +MTV German:12699:v:0:22000:3031:3032:0:0:28643 IFA-TV:10832:h:0:22000:132:133:32:0:7251 +QVC Germany:12552:v:0:22000:165:166:0:0:12100 diff --git a/channels.conf.terr b/channels.conf.terr new file mode 100644 index 0000000..bed1be8 --- /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/config.h b/config.h index 5744969..018d00e 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.85 2001/10/27 09:56:04 kls Exp $ + * $Id: config.h 1.86 2001/11/25 15:57:08 kls Exp $ */ #ifndef __CONFIG_H @@ -18,7 +18,7 @@ #include "eit.h" #include "tools.h" -#define VDRVERSION "0.98" +#define VDRVERSION "0.99" #define MAXPRIORITY 99 #define MAXLIFETIME 99 diff --git a/dvbapi.c b/dvbapi.c index f72782b..707db0d 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.137 2001/11/04 12:05:36 kls Exp $ + * $Id: dvbapi.c 1.141 2001/11/25 16:38:09 kls Exp $ */ //#define DVDDEBUG 1 @@ -710,6 +710,7 @@ protected: int readIndex, writeIndex; bool canDoTrickMode; bool canToggleAudioTrack; + bool skipAC3bytes; uchar audioTrack; void TrickSpeed(int Increment); virtual void Empty(bool Block = false); @@ -752,6 +753,7 @@ cPlayBuffer::cPlayBuffer(cDvbApi *DvbApi, int VideoDev, int AudioDev) readIndex = writeIndex = -1; canDoTrickMode = false; canToggleAudioTrack = false; + skipAC3bytes = false; audioTrack = 0xC0; if (cDvbApi::AudioCommand()) { if (!dolbyDev.Open(cDvbApi::AudioCommand(), "w")) @@ -769,7 +771,7 @@ void cPlayBuffer::PlayExternalDolby(const uchar *b, int MaxLength) if (b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01) { if (b[3] == 0xBD) { // dolby int l = b[4] * 256 + b[5] + 6; - int written = b[8] + 9; // skips the PES header + int written = b[8] + (skipAC3bytes ? 13 : 9); // skips the PES header int n = min(l - written, MaxLength); while (n > 0) { int w = fwrite(&b[written], 1, n, dolbyDev); @@ -1348,9 +1350,6 @@ bool cReplayBuffer::NextFile(uchar FileNumber, int FileOffset) #define cOUTPACK 5 #define cOUTFRAMES 6 -#define aAC3 0x80 -#define aLPCM 0xA0 - // --- cAC3toPCM ------------------------------------------------------------- class cAC3toPCM { @@ -1406,22 +1405,16 @@ cFrame *cAC3toPCM::Get(int size, uchar PTSflags, uchar *PTSdata) int p_size = (size > MAXSIZE) ? MAXSIZE : size; int length = 10; // default header bytes int header = 0; - int stuffb = 0; switch (PTSflags) { case 2: header = 5; // additional header bytes - stuffb = 1; break; case 3: header = 10; break; default: header = 0; } - // header = 0; //XXX ??? - stuffb = 0; //XXX ??? - length += header; - length += stuffb; buffer[0] = 0x00; buffer[1] = 0x00; @@ -1430,19 +1423,13 @@ cFrame *cAC3toPCM::Get(int size, uchar PTSflags, uchar *PTSdata) buffer[6] = 0x80; buffer[7] = PTSflags << 6; - buffer[8] = header + stuffb; + buffer[8] = header; if (header) memcpy(&buffer[9], (void *)PTSdata, header); - // add stuffing - data = buffer + 9 + header; - for (int cnt = 0; cnt < stuffb; cnt++) - data[cnt] = 0xff; - length += stuffb; - // add data - data = buffer + 9 + header + stuffb + 7; + data = buffer + 9 + header + 7; int cnt = 0; while (p_size) { if (ac3outp != ac3inp) { // data in the buffer @@ -1456,7 +1443,7 @@ cFrame *cAC3toPCM::Get(int size, uchar PTSflags, uchar *PTSdata) break; } - data = buffer + 9 + header + stuffb; + data = buffer + 9 + header; data[0] = aLPCM; // substream ID data[1] = 0x00; // other stuff (see DVB specs), ignored by driver data[2] = 0x00; @@ -1560,6 +1547,7 @@ cDVDplayBuffer::cDVDplayBuffer(cDvbApi *DvbApi, int VideoDev, int AudioDev, cDVD canToggleAudioTrack = true;//XXX determine from cDVD! data = new uchar[1024 * DVD_VIDEO_LB_LEN]; canDoTrickMode = true; + skipAC3bytes = true; dvbApi->SetModeReplay(); Start(); } @@ -1574,28 +1562,12 @@ cDVDplayBuffer::~cDVDplayBuffer() unsigned int cDVDplayBuffer::getAudioStream(unsigned int StreamId) { - unsigned int trackID; - - if ((cyclestate < cOPENCHAPTER) || (StreamId > 7)) + if (cyclestate < cOPENCHAPTER || StreamId > 7) return 0; if (!(cur_pgc->audio_control[StreamId] & 0x8000)) return 0; int track = (cur_pgc->audio_control[StreamId] >> 8) & 0x07; - switch (vts_file->vtsi_mat->vts_audio_attr[track].audio_format) { - case 0: // ac3 - trackID = aAC3; - break; - case 2: // mpeg1 - case 3: // mpeg2ext - case 4: // lpcm - case 6: // dts - trackID = aLPCM; - break; - default: esyslog(LOG_ERR, "ERROR: unknown Audio stream info"); - return 0; - } - trackID |= track; - return trackID; + return dvd->getAudioTrack(track) | track; } void cDVDplayBuffer::ToggleAudioTrack(void) @@ -2033,8 +2005,10 @@ void cDVDplayBuffer::handleAC3(unsigned char *sector, int length, uchar PTSflags #define PCM_FRAME_SIZE 1536 AC3toPCM.Put(sector, length); cFrame *frame; - if ((frame = AC3toPCM.Get(PCM_FRAME_SIZE, PTSflags, PTSdata)) != NULL) - putFrame(frame); + if (ac3_buffersize() <= 100) { + if ((frame = AC3toPCM.Get(PCM_FRAME_SIZE, PTSflags, PTSdata)) != NULL) + putFrame(frame); + } while ((frame = AC3toPCM.Get(PCM_FRAME_SIZE)) != NULL) putFrame(frame); } @@ -3087,7 +3061,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); @@ -3129,14 +3103,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) { @@ -3148,7 +3122,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; @@ -3173,58 +3146,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: @@ -3232,12 +3179,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: @@ -3261,7 +3224,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 01bb2dd..aa4a5fe 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/dvd.c b/dvd.c index 841e998..e061b14 100644 --- a/dvd.c +++ b/dvd.c @@ -6,7 +6,7 @@ * * Initially written by Andreas Schultz * - * $Id: dvd.c 1.3 2001/08/06 16:07:44 kls Exp $ + * $Id: dvd.c 1.4 2001/11/10 13:38:50 kls Exp $ */ #ifdef DVDSUPPORT @@ -21,6 +21,7 @@ #include #include "dvd.h" +#include "tools.h" // --- cDVD ---------------------------------------------------------------------------- @@ -145,4 +146,24 @@ dvd_file_t *cDVD::openTitle(int Title, dvd_read_domain_t domain) return title; } +int cDVD::getAudioTrack(int stream) +{ + if (getVTS()) { + switch (getVTS()->vtsi_mat->vts_audio_attr[stream].audio_format) { + case 0: // ac3 + return aAC3; + case 2: // mpeg1 + case 3: // mpeg2ext + return aMPEG; + case 4: // lpcm + return aLPCM; + case 6: // dts + return aDTS; + default: + esyslog(LOG_ERR, "ERROR: unknown Audio stream info"); + } + } + return 0; +} + #endif //DVDSUPPORT diff --git a/dvd.h b/dvd.h index 68fc1d3..5ac1454 100644 --- a/dvd.h +++ b/dvd.h @@ -6,7 +6,7 @@ * * Initially written by Andreas Schultz * - * $Id: dvd.h 1.3 2001/08/05 16:00:57 kls Exp $ + * $Id: dvd.h 1.4 2001/11/10 13:38:25 kls Exp $ */ #ifndef __DVD_H @@ -21,6 +21,11 @@ #include #include +#define aAC3 0x80 +#define aDTS 0x88 +#define aLPCM 0xA0 +#define aMPEG 0xC0 + class cDVD { private: static cDVD *dvdInstance; @@ -44,8 +49,12 @@ public: bool isValid(void) { return (dvd != NULL); } ifo_handle_t *openVMG(void); ifo_handle_t *openVTS(int TitleSet); + ifo_handle_t *getVTS() { return vts_file; } dvd_file_t *openTitle(int Title, dvd_read_domain_t domain); static cDVD *getDVD(void); + int getAudioNrOfTracks() { return getVTS() ? getVTS()->vtsi_mat->nr_of_vts_audio_streams : 0; } + int getAudioLanguage(int stream) { return getVTS() ? getVTS()->vtsi_mat->vts_audio_attr[stream].lang_code : 0; } + int getAudioTrack(int stream); }; #endif //DVDSUPPORT diff --git a/menu.c b/menu.c index 154f66c..45899b1 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.141 2001/11/24 13:20:37 kls Exp $ */ #include "menu.h" @@ -546,16 +546,16 @@ 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("Vpid"), &data.vpid, 0, 0xFFFE)); - Add(new cMenuEditIntItem( tr("Apid1"), &data.apid1, 0, 0xFFFE)); - Add(new cMenuEditIntItem( tr("Apid2"), &data.apid2, 0, 0xFFFE)); - Add(new cMenuEditIntItem( tr("Dpid1"), &data.dpid1, 0, 0xFFFE)); - Add(new cMenuEditIntItem( tr("Dpid2"), &data.dpid2, 0, 0xFFFE)); - Add(new cMenuEditIntItem( tr("Tpid"), &data.tpid, 0, 0xFFFE)); + Add(new cMenuEditIntItem( tr("Srate"), &data.srate)); + Add(new cMenuEditIntItem( tr("Vpid"), &data.vpid, 0, 0x1FFF)); + Add(new cMenuEditIntItem( tr("Apid1"), &data.apid1, 0, 0x1FFF)); + Add(new cMenuEditIntItem( tr("Apid2"), &data.apid2, 0, 0x1FFF)); + Add(new cMenuEditIntItem( tr("Dpid1"), &data.dpid1, 0, 0x1FFF)); + Add(new cMenuEditIntItem( tr("Dpid2"), &data.dpid2, 0, 0x1FFF)); + Add(new cMenuEditIntItem( tr("Tpid"), &data.tpid, 0, 0x1FFF)); Add(new cMenuEditIntItem( tr("CA"), &data.ca, 0, cDvbApi::NumDvbApis)); Add(new cMenuEditIntItem( tr("Pnr"), &data.pnr, 0)); } -- cgit v1.2.3