vdr  1.7.27
sourceparams.c
Go to the documentation of this file.
00001 /*
00002  * sourceparams.c: Source parameter handling
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: sourceparams.c 1.2 2010/03/06 11:13:39 kls Exp $
00008  */
00009 
00010 #include "sourceparams.h"
00011 #include "sources.h"
00012 
00013 // --- cSourceParam ----------------------------------------------------------
00014 
00015 cSourceParam::cSourceParam(char Source, const char *Description)
00016 {
00017   source = Source;
00018   if ('A' <= source && source <= 'Z') {
00019      if (SourceParams.Get(source)) {
00020         esyslog("ERROR: source parameters for '%c' already defined", source);
00021         return;
00022         }
00023      SourceParams.Add(this);
00024      if (!strchr("ACST", Source)) // no, it's not "ATSC" ;-)
00025         Sources.Add(new cSource(Source, Description));
00026      dsyslog("registered source parameters for '%c - %s'", source, Description);
00027      }
00028   else
00029      esyslog("ERROR: invalid source '%c'", source);
00030 }
00031 
00032 // --- cSourceParams ---------------------------------------------------------
00033 
00034 cSourceParams SourceParams;
00035 
00036 cSourceParam *cSourceParams::Get(char Source) const
00037 {
00038   for (cSourceParam *sp = First(); sp; sp = Next(sp)) {
00039       if (sp->Source() == Source)
00040          return sp;
00041       }
00042   return NULL;
00043 }