summaryrefslogtreecommitdiff
path: root/sourceparams.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2010-02-28 12:19:50 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2010-02-28 12:19:50 +0100
commit1eb033576f1829b4466ac27825af91e662e7b17f (patch)
treee02d623302de293070fe381db71f712207372606 /sourceparams.c
parentd255ad785d7a9f258097e6bba55c950d516b6a67 (diff)
downloadvdr-1eb033576f1829b4466ac27825af91e662e7b17f.tar.gz
vdr-1eb033576f1829b4466ac27825af91e662e7b17f.tar.bz2
Added plugin-defined sources
Diffstat (limited to 'sourceparams.c')
-rw-r--r--sourceparams.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/sourceparams.c b/sourceparams.c
new file mode 100644
index 00000000..9a55540b
--- /dev/null
+++ b/sourceparams.c
@@ -0,0 +1,43 @@
+/*
+ * sourceparams.c: Source parameter handling
+ *
+ * See the main source file 'vdr.c' for copyright information and
+ * how to reach the author.
+ *
+ * $Id: sourceparams.c 1.1 2010/02/28 12:15:49 kls Exp $
+ */
+
+#include "sourceparams.h"
+#include "sources.h"
+
+// --- cSourceParam ----------------------------------------------------------
+
+cSourceParam::cSourceParam(char Source, const char *Description)
+{
+ source = Source;
+ if ('A' <= source && source <= 'Z') {
+ if (SourceParams.Get(source)) {
+ esyslog("ERROR: source parameters for '%c' already defined", source);
+ return;
+ }
+ SourceParams.Add(this);
+ if (Source != 'C' && Source != 'S' && Source != 'T')
+ Sources.Add(new cSource(Source, Description));
+ dsyslog("registered source parameters for '%c - %s'", source, Description);
+ }
+ else
+ esyslog("ERROR: invalid source '%c'", source);
+}
+
+// --- cSourceParams ---------------------------------------------------------
+
+cSourceParams SourceParams;
+
+cSourceParam *cSourceParams::Get(char Source) const
+{
+ for (cSourceParam *sp = First(); sp; sp = Next(sp)) {
+ if (sp->Source() == Source)
+ return sp;
+ }
+ return NULL;
+}