Skip to content

Commit

Permalink
Fixed transponder handling to make it work with satellites that provi…
Browse files Browse the repository at this point in the history
…de two transponders on the same frequency, with different polarization
  • Loading branch information
Klaus Schmidinger committed Feb 13, 2004
1 parent 30d262f commit 06d5342
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -933,3 933,5 @@ Andreas Regel <[email protected]>
Thomas Bergwinkl <[email protected]>
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
4 changes: 4 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
Expand Up @@ -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.
32 changes: 30 additions & 2 deletions channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)
Expand All @@ -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;
}

Expand Down
8 changes: 5 additions & 3 deletions channels.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,6 61,7 @@ struct tChannelID {
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;
Expand Down Expand Up @@ -129,7 130,8 @@ class cChannel : public cListObject {
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; }
Expand Down Expand Up @@ -187,7 189,7 @@ class cChannels : public cRwLock, public cConfig<cChannel> {
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--; }
Expand Down
4 changes: 2 additions & 2 deletions nit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
}
Expand Down
4 changes: 2 additions & 2 deletions timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion vdr.5
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 06d5342

Please sign in to comment.