vdr  1.7.31
sourceparams.c
Go to the documentation of this file.
1 /*
2  * sourceparams.c: Source parameter handling
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: sourceparams.c 1.2 2010/03/06 11:13:39 kls Exp $
8  */
9 
10 #include "sourceparams.h"
11 #include "sources.h"
12 
13 // --- cSourceParam ----------------------------------------------------------
14 
15 cSourceParam::cSourceParam(char Source, const char *Description)
16 {
17  source = Source;
18  if ('A' <= source && source <= 'Z') {
19  if (SourceParams.Get(source)) {
20  esyslog("ERROR: source parameters for '%c' already defined", source);
21  return;
22  }
23  SourceParams.Add(this);
24  if (!strchr("ACST", Source)) // no, it's not "ATSC" ;-)
25  Sources.Add(new cSource(Source, Description));
26  dsyslog("registered source parameters for '%c - %s'", source, Description);
27  }
28  else
29  esyslog("ERROR: invalid source '%c'", source);
30 }
31 
32 // --- cSourceParams ---------------------------------------------------------
33 
35 
36 cSourceParam *cSourceParams::Get(char Source) const
37 {
38  for (cSourceParam *sp = First(); sp; sp = Next(sp)) {
39  if (sp->Source() == Source)
40  return sp;
41  }
42  return NULL;
43 }