Fixed transponder handling to make it work with satellites that provide two transponders on the same frequency, with different polarization

This commit is contained in:
Klaus Schmidinger 2004-02-13 15:50:26 +01:00
parent 30d262fa88
commit 06d5342393
7 changed files with 53 additions and 10 deletions

View File

@ -933,3 +933,5 @@ Andreas Regel <andreas.regel@gmx.de>
Thomas Bergwinkl <Thomas.Bergwinkl@t-online.de>
for fixing the validity check for channel IDs, because some providers use TIDs
with value 0
for pointing out that transponder handling didn't work with satellites that provide
two transponders on the same frequency, with different polarization

View File

@ -2659,3 +2659,7 @@ Video Disk Recorder Revision History
a video nor an audio PID.
- Fixed editing channels (SID now range checked) and creating new channels (NID,
TID and RID are now set to 0).
- Fixed transponder handling to make it work with satellites that provide two
transponders on the same frequency, with different polarization, like Hispasat
at S30.0W (thanks to Thomas Bergwinkl for pointing this out). See man vdr(5)
for details about the enhanced channel ID format.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.c 1.23 2004/02/08 11:05:22 kls Exp $
* $Id: channels.c 1.24 2004/02/13 15:37:42 kls Exp $
*/
#include "channels.h"
@ -153,6 +153,13 @@ const char *tChannelID::ToString(void)
return buffer;
}
tChannelID &tChannelID::ClrPolarization(void)
{
while (tid > 100000)
tid -= 100000;
return *this;
}
// -- cChannel ---------------------------------------------------------------
char *cChannel::buffer = NULL;
@ -220,11 +227,25 @@ cChannel& cChannel::operator= (const cChannel &Channel)
return *this;
}
int cChannel::Transponder(int Frequency, char Polarization)
{
// some satellites have transponders at the same frequency, just with different polarization:
switch (tolower(Polarization)) {
case 'h': Frequency += 100000; break;
case 'v': Frequency += 200000; break;
case 'l': Frequency += 300000; break;
case 'r': Frequency += 400000; break;
}
return Frequency;
}
int cChannel::Transponder(void) const
{
int tf = frequency;
while (tf > 20000)
tf /= 1000;
if (IsSat())
tf = Transponder(tf, polarization);
return tf;
}
@ -803,7 +824,7 @@ cChannel *cChannels::GetByServiceID(int Source, int Transponder, unsigned short
return NULL;
}
cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid)
cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid, bool TryWithoutPolarization)
{
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep() && channel->GetChannelID() == ChannelID)
@ -816,6 +837,13 @@ cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid)
return channel;
}
}
if (TryWithoutPolarization) {
ChannelID.ClrPolarization();
for (cChannel *channel = First(); channel; channel = Next(channel)) {
if (!channel->GroupSep() && channel->GetChannelID().ClrPolarization() == ChannelID)
return channel;
}
}
return NULL;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: channels.h 1.15 2004/02/08 12:20:22 kls Exp $
* $Id: channels.h 1.16 2004/02/13 15:16:36 kls Exp $
*/
#ifndef __CHANNELS_H
@ -61,6 +61,7 @@ public:
bool operator== (const tChannelID &arg) const;
bool Valid(void) { return (nid || tid) && sid; } // rid is optional and source may be 0//XXX source may not be 0???
tChannelID &ClrRid(void) { rid = 0; return *this; }
tChannelID &ClrPolarization(void);
static tChannelID FromString(const char *s);
const char *ToString(void);
static const tChannelID InvalidID;
@ -129,7 +130,8 @@ public:
bool Save(FILE *f);
const char *Name(void) const { return name; }
int Frequency(void) const { return frequency; } ///< Returns the actual frequency, as given in 'channels.conf'
int Transponder(void) const; ///< Returns the transponder frequency in MHz
int Transponder(void) const; ///< Returns the transponder frequency in MHz, plus the polarization in case of sat
static int Transponder(int Frequency, char Polarization); ///< builds the transponder from the given Frequency and Polarization
int Source(void) const { return source; }
int Srate(void) const { return srate; }
int Vpid(void) const { return vpid; }
@ -187,7 +189,7 @@ public:
void ReNumber(void); // Recalculate 'number' based on channel type
cChannel *GetByNumber(int Number, int SkipGap = 0);
cChannel *GetByServiceID(int Source, int Transponder, unsigned short ServiceID);
cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false);
cChannel *GetByChannelID(tChannelID ChannelID, bool TryWithoutRid = false, bool TryWithoutPolarization = false);
int BeingEdited(void) { return beingEdited; }
void IncBeingEdited(void) { beingEdited++; }
void DecBeingEdited(void) { beingEdited--; }

4
nit.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: nit.c 1.5 2004/01/18 16:32:45 kls Exp $
* $Id: nit.c 1.6 2004/02/13 14:41:36 kls Exp $
*/
#include "nit.h"
@ -106,7 +106,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
int CodeRate = CodeRates[sd->getFecInner()];
int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10;
if (ThisNIT >= 0) {
if (ISTRANSPONDER(Frequency, Transponder())) {
if (ISTRANSPONDER(cChannel::Transponder(Frequency, Polarization), Transponder())) {
nits[ThisNIT].hasTransponder = true;
//printf("has transponder %d\n", Transponder());
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 1.8 2003/12/27 13:10:04 kls Exp $
* $Id: timers.c 1.9 2004/02/13 15:37:49 kls Exp $
*/
#include "timers.h"
@ -219,7 +219,7 @@ bool cTimer::Parse(const char *s)
if (isnumber(channelbuffer))
channel = Channels.GetByNumber(atoi(channelbuffer));
else
channel = Channels.GetByChannelID(tChannelID::FromString(channelbuffer), true);
channel = Channels.GetByChannelID(tChannelID::FromString(channelbuffer), true, true);
if (!channel) {
esyslog("ERROR: channel %s not defined", channelbuffer);
result = false;

9
vdr.5
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
.\" $Id: vdr.5 1.23 2004/01/25 14:44:59 kls Exp $
.\" $Id: vdr.5 1.24 2004/02/13 14:55:09 kls Exp $
.\"
.TH vdr 5 "1 Jun 2003" "1.2.0" "Video Disk Recorder Files"
.SH NAME
@ -178,6 +178,13 @@ so the above example could also be written as S19.2E-1-1089-12003).
.br
The \fBchannel\ ID\fR is used in the \fItimers.conf\fR and \fIepg.data\fR
files to properly identify the channels.
If a channel has both \fBNID\fR and \fBTID\fR set to 0, the \fBchannel\ ID\fR
will use the \fBFrequency\fR instead of the \fBTID\fR. For satellite channels
an additional offset of 100000, 200000, 300000 or 400000 is added to that
number, depending on the \fBPolarization\fR (\fBH\fR, \fBV\fR, \fBL\fR or \fBR\fR,
respectively). This is necessary because on some satellites the same frequency is
used for two different transponders, with opposite polarization.
.SS TIMERS
The file \fItimers.conf\fR contains the timer setup.
Each line contains one timer definition, with individual fields