[vdr-plugin-externalplayer] 01/04: Imported Upstream version 0.3.2

Tobias Grimm tiber-guest at moszumanska.debian.org
Sun Feb 15 18:30:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

tiber-guest pushed a commit to branch master
in repository vdr-plugin-externalplayer.

commit 36e4ba81c782d2fdb3dd6dac5bc61e324e7b99f2
Author: etobi <git at e-tobi.net>
Date:   Sun Feb 15 19:27:07 2015 +0100

    Imported Upstream version 0.3.2
---
 HISTORY                  |   30 +-
 Makefile                 |   20 +-
 Makefile.old             |   82 +++
 README                   |   18 +-
 externalplayer-config.c  | 1321 ++++++++++------------------------------------
 externalplayer-config.h  |  192 ++++---
 externalplayer-control.c |  405 ++------------
 externalplayer-control.h |   19 +-
 externalplayer-player.c  |  153 ++++--
 externalplayer-player.h  |   31 +-
 externalplayer-remotes.c |   24 +-
 externalplayer-remotes.h |   22 +-
 externalplayer.c         |  168 +++++-
 externalplayer.h         |   31 +-
 po/de_DE.po              |   12 +-
 15 files changed, 872 insertions(+), 1656 deletions(-)

diff --git a/HISTORY b/HISTORY
index e4f2b9e..98984b3 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,4 +1,4 @@
-VDR Plugin 'externalplayer' Revision History
+VDR Plugin 'externalplayer' Revision History
 --------------------------------------------
 
 2005-09-26: Version 0.0.1
@@ -12,9 +12,9 @@ VDR Plugin 'externalplayer' Revision History
   externalplayer-player.c/.h to externalplayer-control.c/.h and
   externalplayer-remotes.c/.h.
 - Changed way to shut down player.
-- Rewrode of cRemotesDisable class. No need to know lirc/rcu device
+- Reworde of cRemotesDisable class. No need to know lirc/rcu device
   names any more.
-- Added configuartion file support (new files externalplayer-remotes.c/.h).
+- Added configuration file support (new files externalplayer-remotes.c/.h).
 - Created example configuration.
 - Changed MainMenuAction if more than one playe exists in configuration.
   (new classes cOsdExternalplayer and cOsdItemExternalplayer in
@@ -22,7 +22,27 @@ VDR Plugin 'externalplayer' Revision History
 - Added slave mode.
 - Added i18n support.
 
-2013-01:27: Version 0.2.0
+2013-01-27: Version 0.2.0
 
 - Moved old i18n support to new system
-- Adjust Makefile to new makefile system of VDR 1.7.35
\ No newline at end of file
+- Adjust Makefile to new makefile system of VDR 1.7.35
+
+2013-02-03: Version 0.3.0
+
+- Incorporate Makefile fix from Copperhead for VDR 1.7.36.
+- Fix exec problem.
+- Fix process killing.
+- Make config file case insensitive.
+
+2013-04-14: Version 0.3.1
+
+- Bugfixes.
+- Menu can be selected via numeric keys if more than one entry exsist.
+- Basic SVDRP support.
+
+2013-04-21: Version 0.3.2
+- SVDRP EXEC command can execute a specific entry.
+- New SVDRP LIST command to display available configurations.
+- Remove filedescriptor cleanup after fork, this can cause crashes.
+- Kill a running program when VDR is shutdown.
+- Allow TAB in config file.
diff --git a/Makefile b/Makefile
index d2ade9c..15b7885 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).h | awk '{ pri
 PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
 LIBDIR = $(call PKGCFG,libdir)
 LOCDIR = $(call PKGCFG,locdir)
+CFGDIR = $(call PKGCFG,configdir)/plugins/$(PLUGIN)
 PLGCFG = $(call PKGCFG,plgcfg)
 #
 TMPDIR ?= /tmp
@@ -73,20 +74,20 @@ $(DEPFILE): Makefile
 PODIR     = po
 I18Npo    = $(wildcard $(PODIR)/*.po)
 I18Nmo    = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
-I18Nmsgs  = $(addprefix $(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
+I18Nmsgs  = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
 I18Npot   = $(PODIR)/$(PLUGIN).pot
 
 %.mo: %.po
-	msgfmt -v -c -o $@ $<
+	msgfmt -c -o $@ $<
 
-$(I18Npot): $(wildcard *.c *.h)
+$(I18Npot): $(wildcard *.c)
 	xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
 
 %.po: $(I18Npot)
 	msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
 	@touch $@
 
-$(I18Nmsgs): $(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
+$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
 	install -D -m644 $< $@
 
 .PHONY: i18n
@@ -98,12 +99,15 @@ install-i18n: $(I18Nmsgs)
 
 $(SOFILE): $(OBJS)
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
-	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 install-lib: $(SOFILE)
-	install -D $^ $(LIBDIR)/$^.$(APIVERSION)
+	install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
 
-install: install-lib install-i18n
+install-conf:
+	@mkdir -p $(DESTDIR)$(CFGDIR)
+	@cp -n examples/externalplayer.conf $(DESTDIR)$(CFGDIR)
+
+install: install-lib install-i18n install-conf
 
 dist: clean
 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
@@ -114,5 +118,5 @@ dist: clean
 	@echo Distribution package created as $(PACKAGE).tgz
 
 clean:
-	@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
+	@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot $(PODIR)/*.orig
 	@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
diff --git a/Makefile.old b/Makefile.old
new file mode 100644
index 0000000..3be02d3
--- /dev/null
+++ b/Makefile.old
@@ -0,0 +1,82 @@
+#
+# Makefile for a Video Disk Recorder plugin
+#
+# $Id$
+
+# The official name of this plugin.
+# This name will be used in the '-P...' option of VDR to load the plugin.
+# By default the main source file also carries this name.
+#
+PLUGIN = externalplayer
+
+### The version number of this plugin (taken from the main source file):
+
+VERSION = $(shell grep 'static const char \*VERSION *=' externalplayer.h | awk '{ print $$6 }' | sed -e 's/[";]//g')
+
+### The C++ compiler and options:
+
+CXX      ?= g++
+CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
+
+### The directory environment:
+
+DVBDIR = ../../../../DVB
+VDRDIR = ../../..
+LIBDIR = ../../lib
+TMPDIR = /tmp
+
+### Allow user defined options to overwrite defaults:
+
+-include $(VDRDIR)/Make.config
+
+### The version number of VDR (taken from VDR's "config.h"):
+
+VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
+
+### The name of the distribution archive:
+
+ARCHIVE = $(PLUGIN)-$(VERSION)
+PACKAGE = vdr-$(ARCHIVE)
+
+### Includes and Defines (add further entries here):
+
+INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include
+
+DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+### The object files (add further files here):
+
+OBJS = externalplayer.o externalplayer-config.o externalplayer-control.o  externalplayer-i18n.o externalplayer-player.o externalplayer-remotes.o
+
+### Implicit rules:
+
+%.o: %.c
+	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
+
+# Dependencies:
+
+MAKEDEP = $(CXX) -MM -MG
+DEPFILE = .dependencies
+$(DEPFILE): Makefile
+	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
+
+-include $(DEPFILE)
+
+### Targets:
+
+all: libvdr-$(PLUGIN).so
+
+libvdr-$(PLUGIN).so: $(OBJS)
+	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	@cp $@ $(LIBDIR)/$@.$(VDRVERSION)
+
+dist: clean
+	@-rm -rf $(TMPDIR)/$(ARCHIVE)
+	@mkdir $(TMPDIR)/$(ARCHIVE)
+	@cp -a * $(TMPDIR)/$(ARCHIVE)
+	@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
+	@-rm -rf $(TMPDIR)/$(ARCHIVE)
+	@echo Distribution package created as $(PACKAGE).tar.gz
+
+clean:
+	@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
diff --git a/README b/README
index f2c1f9b..1128522 100644
--- a/README
+++ b/README
@@ -1,10 +1,11 @@
-This is a "plugin" for the Video Disk Recorder (VDR).
+This is a plugin for the Video Disk Recorder (VDR).
 
-Written by:                  Felix H�dicke <felixhaedicke at web.de>
+Originally written by:       Felix Hädicke <felixhaedicke at web.de>
+Old project's homepage:      http://sourceforge.net/projects/externalplayer
 
-Project's homepage:          http://sourceforge.net/projects/externalplayer
-
-Latest version available at: http://sourceforge.net/projects/externalplayer
+Current maintainer         : Ulrich Eckhardt <vdr at uli-eckhardt.de>
+Current project's homepage : http://www.uli-eckhardt.de/vdr/external.de.shtml
+English translation        : http://www.uli-eckhardt.de/vdr/external.en.shtml
 
 See the file COPYING for license information.
 
@@ -13,4 +14,9 @@ This can be used to launch external players from main menu.
 
 You have to create a configuration file "externalplayer.conf". Put this file
 to the vdr plugin configuration directory. For most distributions, this is
-/video/plugins
\ No newline at end of file
+/video/plugins.
+
+SVDRP Commands
+---------------------------------------------
+    LIST     :  List available configurations
+    EXEC <no>:  Execute configuration number.
diff --git a/externalplayer-config.c b/externalplayer-config.c
index bae156a..a80fdea 100644
--- a/externalplayer-config.c
+++ b/externalplayer-config.c
@@ -1,144 +1,66 @@
 /*
  * externalplayer-config.c: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+  * Initially written by Felix Hädicke
  *
- * $Id$
+ * 2013 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  */
 
 #include "externalplayer-config.h"
 
 sKeymap::sKeymap() {
-  vdrKeyUp = new string("\e[A");
-  vdrKeyDown = new string("\e[B");
-  vdrKeyLeft = new string("\e[D");
-  vdrKeyRight = new string("\e[C");
-  vdrKeyOk = NULL;
-  vdrKeyBack = NULL;
-  vdrKeyRed = NULL;
-  vdrKeyGreen = NULL;
-  vdrKeyYellow = NULL;
-  vdrKeyBlue = NULL;
-  vdrKey0 = new string("0");
-  vdrKey1 = new string("1");
-  vdrKey2 = new string("2");
-  vdrKey3 = new string("3");
-  vdrKey4 = new string("4");
-  vdrKey5 = new string("5");
-  vdrKey6 = new string("6");
-  vdrKey7 = new string("7");
-  vdrKey8 = new string("8");
-  vdrKey9 = new string("9");
-  vdrKeyPlay = NULL;
-  vdrKeyPause = NULL;
-  vdrKeyStop = NULL;
-  vdrKeyRecord = NULL;
-  vdrKeyFastFwd = NULL;
-  vdrKeyFaswRew = NULL;
-  vdrKeyAudio = NULL;
-  vdrKeySchedule = NULL;
-  vdrKeyChannels = NULL;
-  vdrKeyTimers = NULL;
-  vdrKeyRecordings = NULL;
-  vdrKeySetup = NULL;
-  vdrKeyCommands = NULL;
-  vdrKeyUser1 = NULL;
-  vdrKeyUser2 = NULL;
-  vdrKeyUser3 = NULL;
-  vdrKeyUser4 = NULL;
-  vdrKeyUser5 = NULL;
-  vdrKeyUser6 = NULL;
-  vdrKeyUser7 = NULL;
-  vdrKeyUser8 = NULL;
-  vdrKeyUser9 = NULL;
-}
-
-sKeymap::~sKeymap() {
-  delete vdrKeyUp;
-  delete vdrKeyDown;
-  delete vdrKeyLeft;
-  delete vdrKeyRight;
-  delete vdrKeyOk;
-  delete vdrKeyBack;
-  delete vdrKeyRed;
-  delete vdrKeyGreen;
-  delete vdrKeyYellow;
-  delete vdrKeyBlue;
-  delete vdrKey0;
-  delete vdrKey1;
-  delete vdrKey2;
-  delete vdrKey3;
-  delete vdrKey4;
-  delete vdrKey5;
-  delete vdrKey6;
-  delete vdrKey7;
-  delete vdrKey8;
-  delete vdrKey9;
-  delete vdrKeyPlay;
-  delete vdrKeyPause;
-  delete vdrKeyStop;
-  delete vdrKeyRecord;
-  delete vdrKeyFastFwd;
-  delete vdrKeyFaswRew;
-  delete vdrKeyAudio;
-  delete vdrKeySchedule;
-  delete vdrKeyChannels;
-  delete vdrKeyTimers;
-  delete vdrKeyRecordings;
-  delete vdrKeySetup;
-  delete vdrKeyCommands;
-  delete vdrKeyUser1;
-  delete vdrKeyUser2;
-  delete vdrKeyUser3;
-  delete vdrKeyUser4;
-  delete vdrKeyUser5;
-  delete vdrKeyUser6;
-  delete vdrKeyUser7;
-  delete vdrKeyUser8;
-  delete vdrKeyUser9;
+    mKeyMap[kUp] = "\e[A";
+    mKeyMap[kDown] = "\e[B";
+    mKeyMap[kLeft] = "\e[D";
+    mKeyMap[kRight] = "\e[C";
+
+    mKeyMap[k0] = "0";
+    mKeyMap[k1] = "1";
+    mKeyMap[k2] = "2";
+    mKeyMap[k3] = "3";
+    mKeyMap[k4] = "4";
+    mKeyMap[k5] = "5";
+    mKeyMap[k6] = "6";
+    mKeyMap[k7] = "7";
+    mKeyMap[k8] = "8";
+    mKeyMap[k9] = "9";
 }
 
 // --- sPlayerArgs ----------------------------------------------------------
 
 sPlayerArgs::sPlayerArgs() {
-  menuEntry = "";
-  playerCommand = "";
-  slaveMode = false;
-  playMode = pmExtern_THIS_SHOULD_BE_AVOIDED;
-  deactivateRemotes = false;
-  blockMenu = false;
-  keys = new sKeymap();
-}
-
-sPlayerArgs::~sPlayerArgs() {
-  delete keys;
+  mMenuEntry = "";
+  mPlayerCommand = "";
+  mSlaveMode = false;
+  mPlayMode = pmExtern_THIS_SHOULD_BE_AVOIDED;
+  mDeactivateRemotes = false;
+  mBlockMenu = false;
 }
 
-// --- FileNotFoundException -------------------------------------------------
+// --- SyntaxErrorException -------------------------------------------------
 
-FileNotFoundException::FileNotFoundException(string nFilename) {
-  filename = nFilename;
+SyntaxErrorException::SyntaxErrorException(int nCharNumber, const string &nConfigFileContent) {
+  mCharNumber = nCharNumber;
+  mConfigFileContent = nConfigFileContent;
 }
 
-SyntaxErrorException::SyntaxErrorException(int nCharNumber, string * nConfigFileContent) {
-  charNumber = nCharNumber;
-  configFileContent = nConfigFileContent;
-}
-
-int SyntaxErrorException::getLineNumber() {
+int SyntaxErrorException::GetLineNumber() {
   int lineNumber = 0;
-  for (int i = 0; i < charNumber; i++) {
-    if ((*configFileContent)[i] == '\n') {
+  for (int i = 0; i < mCharNumber; i++) {
+    if (mConfigFileContent[i] == '\n') {
       lineNumber++;
     }
   }
   return lineNumber;
 }
 
-int SyntaxErrorException::getColumnNumber() {
+int SyntaxErrorException::GetColumnNumber() {
   int columnNumber = 1;
-  for (int i = 0; i < charNumber; i++) {
-    if ((*configFileContent)[i] == '\n') {
+  for (int i = 0; i < mCharNumber; i++) {
+    if (mConfigFileContent[i] == '\n') {
       columnNumber = 1;
     }
     else {
@@ -150,17 +72,18 @@ int SyntaxErrorException::getColumnNumber() {
 
 // --- EntryMissingException -------------------------------------------------
 
-EntryMissingException::EntryMissingException(string nPlayerCommand, string nMenuEntry, int nCharNumber, string * nConfigFileContent) {
-  playerCommand = nPlayerCommand;
-  menuEntry = nMenuEntry;
-  charNumber = nCharNumber;
-  configFileContent = nConfigFileContent;
+EntryMissingException::EntryMissingException(const string &nPlayerCommand, const string &nMenuEntry,
+                                             int nCharNumber, const string &nConfigFileContent) {
+  mPlayerCommand = nPlayerCommand;
+  mMenuEntry = nMenuEntry;
+  mCharNumber = nCharNumber;
+  mConfigFileContent = nConfigFileContent;
 }
 
-int EntryMissingException::getLineNumber() {
+int EntryMissingException::GetLineNumber() {
   int lineNumber = 0;
-  for (int i = 0; i < charNumber; i++) {
-    if ((*configFileContent)[i] == '\n') {
+  for (int i = 0; i < mCharNumber; i++) {
+    if (mConfigFileContent[i] == '\n') {
       lineNumber++;
     }
   }
@@ -169,16 +92,17 @@ int EntryMissingException::getLineNumber() {
 
 // --- InvalidKeywordException -----------------------------------------------
 
-InvalidKeywordException::InvalidKeywordException(string nKeyword, int nCharNumber, string * nConfigFileContent) {
-  keyword = nKeyword;
-  charNumber = nCharNumber;
-  configFileContent = nConfigFileContent;
+InvalidKeywordException::InvalidKeywordException(const string &nKeyword, int nCharNumber,
+                                                 const string &nConfigFileContent) {
+  mKeyword = nKeyword;
+  mCharNumber = nCharNumber;
+  mConfigFileContent = nConfigFileContent;
 }
 
-int InvalidKeywordException::getLineNumber() {
+int InvalidKeywordException::GetLineNumber() {
   int lineNumber = 0;
-  for (int i = 0; i < charNumber; i++) {
-    if ((*configFileContent)[i] == '\n') {
+  for (int i = 0; i < mCharNumber; i++) {
+    if (mConfigFileContent[i] == '\n') {
       lineNumber++;
     }
   }
@@ -189,24 +113,23 @@ int InvalidKeywordException::getLineNumber() {
 
 cExternalplayerConfig::cExternalplayerConfig(string filename) {
   try {
-    configFileContent = readConfigFile(filename);
-    configuration = parseConfigFile();
+    mConfigFileContent = ReadConfigFile(filename);
+    configuration = ParseConfigFile();
   }
-  catch (FileNotFoundException fnfEx) {
-    configFileContent = NULL;
-    isyslog("externalplayer-plugin: Configuration file \"%s\" not found!\n", fnfEx.getFilename().c_str());
+  catch (FileNotFoundException &fnfEx) {
+    mConfigFileContent.clear();
+    esyslog("externalplayer-plugin: Configuration file \"%s\" not found!\n", fnfEx.GetFilename().c_str());
   }
 }
 
 cExternalplayerConfig::~cExternalplayerConfig() {
-  delete configFileContent;
   while (!configuration.empty()) {
     delete configuration.back();
     configuration.pop_back();
   }
 }
 
-string * cExternalplayerConfig::readConfigFile(string filename) {
+string cExternalplayerConfig::ReadConfigFile(const string &filename) {
   ifstream playerConfigStream;
   playerConfigStream.open(filename.c_str(), ios::in);
 
@@ -214,32 +137,32 @@ string * cExternalplayerConfig::readConfigFile(string filename) {
     throw FileNotFoundException(filename);
   }
 
-  string * configFileContent = new string();
-
+  string configFileContent;
   char buffer[256];
 
   while (!playerConfigStream.eof()) {
     playerConfigStream.getline(buffer, 256);
-    (*configFileContent) = (*configFileContent) + '\n' + buffer;
+    configFileContent = configFileContent + '\n' + buffer;
   }
-  (*configFileContent) = (*configFileContent) + '\n';
+  configFileContent = configFileContent + '\n';
 
   playerConfigStream.close();
 
   return configFileContent;
 }
 
-list<sPlayerArgs *> cExternalplayerConfig::parseConfigFile() {
-  list<sPlayerArgs *> configuration;
+sPlayerArgsList cExternalplayerConfig::ParseConfigFile() {
+  sPlayerArgsList configuration;
   sPlayerArgs * playerConfig = NULL;
 
-  for (unsigned int i = 0; i < configFileContent->size(); i++) {
-    switch ((*configFileContent)[i]) {
+  for (unsigned int i = 0; i < mConfigFileContent.size(); i++) {
+    switch (mConfigFileContent[i]) {
       case ' ':
+      case '\t':
       case '\n':
         break;
       case '#':
-        while ((*configFileContent)[i] != '\n') {
+        while (mConfigFileContent[i] != '\n') {
           i++;
         }
         break;
@@ -247,84 +170,89 @@ list<sPlayerArgs *> cExternalplayerConfig::parseConfigFile() {
         playerConfig = new sPlayerArgs();
         i++;
         try {
-          playerConfig = getConfiguration(&i);
+          playerConfig = GetConfiguration(&i);
           configuration.push_back(playerConfig);
         }
-        catch (EntryMissingException emEx) {
-          if (emEx.getMenuEntry() == "") {
-            isyslog("externalplayer-plugin: error in config file: \"MenuEntry\" missing or invalid, line %i",
-                    emEx.getLineNumber());
+        catch (EntryMissingException &emEx) {
+          if (emEx.GetMenuEntry() == "") {
+            esyslog("externalplayer-plugin: error in config file: \"MenuEntry\" missing or invalid, line %i",
+                    emEx.GetLineNumber());
           }
-          if (emEx.getPlayerCommand() == "") {
-            isyslog("externalplayer-plugin: error in config file: \"Command\" missing or invalid, line %i!\n",
-                    emEx.getLineNumber());
+          if (emEx.GetPlayerCommand() == "") {
+            esyslog("externalplayer-plugin: error in config file: \"Command\" missing or invalid, line %i!\n",
+                    emEx.GetLineNumber());
           }
         }
         break;
       default:
         unsigned int errorPosition = i;
-        while ((*configFileContent)[i] != '\n') {
+        while (mConfigFileContent[i] != '\n') {
           i++;
         }
         i++;
-        isyslog("externalplayer-plugin: syntax error in config file: line %i, column %i! Ignoring rest of this line.",
-                getLineNumberOfChar(errorPosition), getColumnNumberOfChar(errorPosition));
+        esyslog("externalplayer-plugin: syntax error in config file: line %i, column %i! Ignoring rest of this line.",
+                GetLineNumberOfChar(errorPosition), GetColumnNumberOfChar(errorPosition));
+        break;
     }
   }
 
   return configuration;
 }
 
-sPlayerArgs * cExternalplayerConfig::getConfiguration(unsigned int * position) {
+sPlayerArgs * cExternalplayerConfig::GetConfiguration(unsigned int * position) {
   sPlayerArgs * args = new sPlayerArgs();
 
   bool endOfFile = false;
-  while ((*configFileContent)[*position] != '}' && !endOfFile) {
-    switch ((*configFileContent)[*position]) {
+  while (mConfigFileContent[*position] != '}' && !endOfFile) {
+    switch (mConfigFileContent[*position]) {
       case ' ':
+      case '\t':
       case '\n':
         (*position)++;
         break;
       case '#':
-        while ((*configFileContent)[*position] != '\n') {
+        while (mConfigFileContent[*position] != '\n') {
           (*position)++;
         }
         (*position)++;
         break;
       default:
-        if (*position >= configFileContent->size()) {
-          isyslog("externalplayer-plugin: no \"}\" at end of file!");
+        if (*position >= mConfigFileContent.size()) {
+          esyslog("externalplayer-plugin: no \"}\" at end of file!");
           endOfFile = true;
         }
         else {
           try {
-            sConfigEntry entry = getConfigEntry(position);
-            processConfigEntry(args, entry, *position);
+            sConfigEntry entry = GetConfigEntry(position);
+            dsyslog ("Entry %s, %s", entry.key.c_str(), entry.value.c_str());
+            ProcessConfigEntry(args, entry, *position);
           }
-          catch(SyntaxErrorException seEx) {
-            isyslog("externalplayer-plugin: syntax error in config file: line %i, column %i! Ignoring entry.",
-                    seEx.getLineNumber(), seEx.getColumnNumber());
+          catch(SyntaxErrorException &seEx) {
+            esyslog("externalplayer-plugin: syntax error in config file: line %i, column %i! Ignoring entry.",
+                    seEx.GetLineNumber(), seEx.GetColumnNumber());
           }
-          catch (InvalidKeywordException ikEx) {
-            isyslog("externalplayer-plugin: error in config file: invalig keyword \"%s\" line %i!",
-                  ikEx.getKeyword().c_str(), ikEx.getLineNumber());
+          catch (InvalidKeywordException &ikEx) {
+            esyslog("externalplayer-plugin: error in config file: invalig keyword \"%s\" line %i!",
+                  ikEx.GetKeyword().c_str(), ikEx.GetLineNumber());
           }
         }
+        break;
     }
   }
 
-  if ((args->playerCommand == "") || (args->menuEntry == "")) {
-    throw EntryMissingException(args->playerCommand, args->menuEntry, *position, configFileContent);
+  if ((args->mPlayerCommand == "") || (args->mMenuEntry == "")) {
+    throw EntryMissingException(args->mPlayerCommand, args->mMenuEntry, *position, mConfigFileContent);
   }
 
   return args;
 }
 
-sConfigEntry cExternalplayerConfig::getConfigEntry(unsigned int * position) {
+sConfigEntry cExternalplayerConfig::GetConfigEntry(unsigned int * position)
+{
   sConfigEntry entry;
 
-  while ((*configFileContent)[*position] != '=') {
-    switch((*configFileContent)[*position]) {
+  while (mConfigFileContent[*position] != '=') {
+    switch(mConfigFileContent[*position]) {
       case '{':
       case '}':
       case '\n':
@@ -333,39 +261,40 @@ sConfigEntry cExternalplayerConfig::getConfigEntry(unsigned int * position) {
         {
           unsigned int errorPosition = *position;
           (*position)++;
-          while ((*configFileContent)[*position] != '\n' && (*configFileContent)[*position] != ';' \
-                  && (*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          while ((mConfigFileContent[*position] != '\n') && (mConfigFileContent[*position] != ';') &&
+                 (mConfigFileContent[*position] != '{') && (mConfigFileContent[*position] != '}')) {
             (*position)++;
           }
-          if ((*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          if (mConfigFileContent[*position] != '{' && mConfigFileContent[*position] != '}') {
             (*position)++;
           }
-          throw SyntaxErrorException(errorPosition, configFileContent);
+          throw SyntaxErrorException(errorPosition, mConfigFileContent);
         }
         break;
       case '#':
         {
           unsigned int errorPosition = *position;
           (*position)++;
-          while ((*configFileContent)[*position] != '\n' && (*configFileContent)[*position] != ';' \
-                  && (*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          while ((mConfigFileContent[*position] != '\n') && (mConfigFileContent[*position] != ';') &&
+                 (mConfigFileContent[*position] != '{') && (mConfigFileContent[*position] != '}')) {
             (*position)++;
           }
-          if ((*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          if ((mConfigFileContent[*position] != '{') && (mConfigFileContent[*position] != '}')) {
             (*position)++;
           }
-          throw SyntaxErrorException(errorPosition, configFileContent);
+          throw SyntaxErrorException(errorPosition, mConfigFileContent);
         }
         break;
       default:
-        entry.key += (*configFileContent)[*position];
+        entry.key += mConfigFileContent[*position];
         (*position)++;
+        break;
     }
   }
   (*position)++;
 
-  while ((*configFileContent)[*position] != ';') {
-    switch((*configFileContent)[*position]) {
+  while (mConfigFileContent[*position] != ';') {
+    switch(mConfigFileContent[*position]) {
       case '{':
       case '}':
       case '\n':
@@ -373,23 +302,23 @@ sConfigEntry cExternalplayerConfig::getConfigEntry(unsigned int * position) {
         {
           unsigned int errorPosition = *position;
           (*position)++;
-          while ((*configFileContent)[*position] != '\n' && (*configFileContent)[*position] != ';' \
-                  && (*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          while ((mConfigFileContent[*position] != '\n') && (mConfigFileContent[*position] != ';') &&
+                 (mConfigFileContent[*position] != '{') && (mConfigFileContent[*position] != '}')) {
             (*position)++;
           }
-          if ((*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          if ((mConfigFileContent[*position] != '{') && (mConfigFileContent[*position] != '}')) {
             (*position)++;
           }
-          throw SyntaxErrorException(errorPosition, configFileContent);
+          throw SyntaxErrorException(errorPosition, mConfigFileContent);
         }
       break;
       case '\"':
-        while ((*configFileContent)[*position] != '\"') {
+        while (mConfigFileContent[*position] != '\"') {
           (*position)++;
-          if ((*configFileContent)[*position] == '\n') {
-            throw SyntaxErrorException(*position, configFileContent);
+          if (mConfigFileContent[*position] == '\n') {
+            throw SyntaxErrorException(*position, mConfigFileContent);
           }
-          entry.value += (*configFileContent)[*position];
+          entry.value += mConfigFileContent[*position];
         }
         (*position)++;
         break;
@@ -397,921 +326,231 @@ sConfigEntry cExternalplayerConfig::getConfigEntry(unsigned int * position) {
         {
           int errorPosition = *position;
           (*position)++;
-          while ((*configFileContent)[*position] != '\n' && (*configFileContent)[*position] != ';' \
-                  && (*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          while ((mConfigFileContent[*position] != '\n') && (mConfigFileContent[*position] != ';') &&
+                 (mConfigFileContent[*position] != '{') && (mConfigFileContent[*position] != '}')) {
             (*position)++;
           }
-          if ((*configFileContent)[*position] != '{' && (*configFileContent)[*position] != '}') {
+          if ((mConfigFileContent[*position] != '{') && (mConfigFileContent[*position] != '}')) {
             (*position)++;
           }
-          throw SyntaxErrorException(errorPosition, configFileContent);
+          throw SyntaxErrorException(errorPosition, mConfigFileContent);
         }
         break;
       default:
-        entry.value += (*configFileContent)[*position];
+        entry.value += mConfigFileContent[*position];
         (*position)++;
+        break;
     }
   }
   (*position)++;
 
-  removeUnnecessarySymbols(&(entry.key));
-  removeUnnecessarySymbols(&(entry.value));
+  RemoveUnnecessarySymbols(entry.key);
+  RemoveUnnecessarySymbols(entry.value);
 
   return entry;
 }
 
-void cExternalplayerConfig::removeUnnecessarySymbols(string * stringPtr) {
-  while ((*stringPtr)[0] == ' ') {
-    stringPtr->erase(stringPtr->begin());
+void cExternalplayerConfig::RemoveUnnecessarySymbols(string &stringPtr) {
+  while ((stringPtr[0] == ' ') || (stringPtr[0] == '\t')){
+    stringPtr.erase(stringPtr.begin());
   }
 
-  while ((*stringPtr)[stringPtr->size() - 1] == ' ') {
-    stringPtr->erase((stringPtr->end() - 1), (stringPtr->end()));
+  while ((stringPtr[stringPtr.size() - 1] == ' ') || (stringPtr[stringPtr.size() - 1] == '\t')){
+    stringPtr.erase((stringPtr.end() - 1), (stringPtr.end()));
   }
-
 }
 
-void cExternalplayerConfig::processConfigEntry(sPlayerArgs * args, sConfigEntry entry, int position) {
-  if (entry.key == "Command") {
-    args->playerCommand = entry.value;
-  }
-
-  else if (entry.key == "MenuEntry") {
-    args->menuEntry = entry.value;
-  }
-
-  else if (entry.key == "InputMode") {
-    if (entry.value == "deactivateRemotes") {
-      args->deactivateRemotes = true;
-      args->slaveMode = false;
-    }
-    else if (entry.value == "slave") {
-      args->deactivateRemotes = false;
-      args->slaveMode = true;
-    }
-    else if (entry.value == "normal" || entry.value == "default") {
-      args->deactivateRemotes = false;
-      args->slaveMode = false;
-    }
-    else {
-      throw InvalidKeywordException(entry.value, position, configFileContent);
-    }
-  }
-
-  else if (entry.key == "OutputMode") {
-    if (entry.value == "extern") {
-      args->playMode = pmExtern_THIS_SHOULD_BE_AVOIDED;
-    }
-    else if (entry.value == "none") {
-      args->playMode = pmNone;
-    }
-    else if (entry.value == "audioOnly") {
-      args->playMode = pmAudioOnly;
-    }
-    else if (entry.value == "audioOnlyBlack") {
-      args->playMode = pmAudioOnlyBlack;
-    }
-  }
-
-  else if (entry.key == "BlockMenu") {
-    if ((entry.value == "true") || (entry.value == "1")) {
-      args->blockMenu = true;
-    }
-    else if (entry.value == "false" || (entry.value == "0")) {
-      args->blockMenu = false;
-    }
-    else {
-      throw InvalidKeywordException(entry.value, position, configFileContent);
-    }
-  }
-
-  else if (entry.key == "vdrKeyUp") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUp;
-        args->keys->vdrKeyUp = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyUp;
-      args->keys->vdrKeyUp = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyDown") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyDown;
-        args->keys->vdrKeyDown = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyDown;
-      args->keys->vdrKeyDown = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyLeft") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyLeft;
-        args->keys->vdrKeyLeft = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyLeft;
-      args->keys->vdrKeyLeft = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyRight") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyRight;
-        args->keys->vdrKeyRight = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyRight;
-      args->keys->vdrKeyRight = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyOk") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyOk;
-        args->keys->vdrKeyOk = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyOk;
-      args->keys->vdrKeyOk = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyBack") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyBack;
-        args->keys->vdrKeyBack = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyBack;
-      args->keys->vdrKeyBack = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyRed") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyRed;
-        args->keys->vdrKeyRed = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyRed;
-      args->keys->vdrKeyRed = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyGreen") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyGreen;
-        args->keys->vdrKeyGreen = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyGreen;
-      args->keys->vdrKeyGreen = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyYellow") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyYellow;
-        args->keys->vdrKeyYellow = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyYellow;
-      args->keys->vdrKeyYellow = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyBlue") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyBlue;
-        args->keys->vdrKeyBlue = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyBlue;
-      args->keys->vdrKeyBlue = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey0") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey0;
-        args->keys->vdrKey0 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey0;
-      args->keys->vdrKey0 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey1") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey1;
-        args->keys->vdrKey1 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey1;
-      args->keys->vdrKey1 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey2") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey2;
-        args->keys->vdrKey2 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey2;
-      args->keys->vdrKey2 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey3") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey3;
-        args->keys->vdrKey3 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey3;
-      args->keys->vdrKey3 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey4") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey4;
-        args->keys->vdrKey4 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey4;
-      args->keys->vdrKey4 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey5") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey5;
-        args->keys->vdrKey5 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey5;
-      args->keys->vdrKey5 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey6") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey6;
-        args->keys->vdrKey6 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey6;
-      args->keys->vdrKey6 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey7") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey7;
-        args->keys->vdrKey7 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey7;
-      args->keys->vdrKey7 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey8") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey8;
-        args->keys->vdrKey8 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey8;
-      args->keys->vdrKey8 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKey9") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKey9;
-        args->keys->vdrKey9 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKey9;
-      args->keys->vdrKey9 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyPlay") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyPlay;
-        args->keys->vdrKeyPlay = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyPlay;
-      args->keys->vdrKeyPlay = new string(entry.value);
-    }
-  }
+void cExternalplayerConfig::ProcessConfigEntry(sPlayerArgs *args, sConfigEntry entry, int position) {
+    cKey keys;
+    bool found = true;
 
-  else if (entry.key == "vdrKeyPause") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyPause;
-        args->keys->vdrKeyPause = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyPause;
-      args->keys->vdrKeyPause = new string(entry.value);
+    if (entry.key.empty() || entry.value.empty()) {
+        throw SyntaxErrorException(position, mConfigFileContent);
     }
-  }
 
-  else if (entry.key == "vdrKeyStop") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyStop;
-        args->keys->vdrKeyStop = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    if (StringTool::strcasecmp (entry.key, "Command")) {
+        args->mPlayerCommand = entry.value;
     }
-    else {
-      delete args->keys->vdrKeyStop;
-      args->keys->vdrKeyStop = new string(entry.value);
+    else if (StringTool::strcasecmp (entry.key, "MenuEntry")) {
+        args->mMenuEntry = entry.value;
     }
-  }
-
-  else if (entry.key == "vdrKeyRecord") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyRecord;
-        args->keys->vdrKeyRecord = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (StringTool::strcasecmp (entry.key, "InputMode")) {
+        if (StringTool::strcasecmp (entry.value, "deactivateRemotes")) {
+            args->mDeactivateRemotes = true;
+            args->mSlaveMode = false;
+        }
+        else if (StringTool::strcasecmp (entry.value, "slave")) {
+            args->mDeactivateRemotes = false;
+            args->mSlaveMode = true;
+        }
+        else if (StringTool::strcasecmp (entry.value, "normal") ||
+                 StringTool::strcasecmp (entry.value, "default")) {
+            args->mDeactivateRemotes = false;
+            args->mSlaveMode = false;
+        }
+        else {
+            throw InvalidKeywordException(entry.value, position, mConfigFileContent);
+        }
     }
-    else {
-      delete args->keys->vdrKeyRecord;
-      args->keys->vdrKeyRecord = new string(entry.value);
+    else if (StringTool::strcasecmp (entry.key, "OutputMode")) {
+        if (StringTool::strcasecmp (entry.value, "extern")) {
+            args->mPlayMode = pmExtern_THIS_SHOULD_BE_AVOIDED;
+        }
+        else if (StringTool::strcasecmp (entry.value, "none")) {
+            args->mPlayMode = pmNone;
+        }
+        else if (StringTool::strcasecmp (entry.value, "audioOnly")) {
+            args->mPlayMode = pmAudioOnly;
+        }
+        else if (StringTool::strcasecmp (entry.value, "audioOnlyBlack")) {
+            args->mPlayMode = pmAudioOnlyBlack;
+        }
     }
-  }
-
-  else if (entry.key == "vdrKeyFastFwd") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyFastFwd;
-        args->keys->vdrKeyFastFwd = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (StringTool::strcasecmp (entry.key, "BlockMenu")) {
+        if ((StringTool::strcasecmp (entry.value, "true")) || (entry.value == "1")) {
+            args->mBlockMenu = true;
+        }
+        else if (StringTool::strcasecmp (entry.value, "false") || (entry.value == "0")) {
+            args->mBlockMenu = false;
+        }
+        else {
+            throw InvalidKeywordException(entry.value, position, mConfigFileContent);
+        }
     }
     else {
-      delete args->keys->vdrKeyFastFwd;
-      args->keys->vdrKeyFastFwd = new string(entry.value);
+        found = false;
+        string keyname;
+        const char *vdrkeyname;
+        for (int key = kUp; key <= kKbd; key++) {
+            vdrkeyname = keys.ToString((eKeys)key, false);
+            if (vdrkeyname != NULL)
+            {
+                keyname = "vdrKey";
+                keyname += vdrkeyname;
+                if (StringTool::strcasecmp (entry.key, keyname)) {
+                    found = true;
+                    string *keyString = GetCodeSpecialKey(entry.value);
+                    if (keyString != NULL) {
+                        args->mKeys.SetKey ((eKeys)key, *keyString);
+                        delete keyString;
+                    }
+                    else {
+                        args->mKeys.SetKey((eKeys)key, entry.value);
+                    }
+                    break;
+                }
+            }
+        }
     }
-  }
 
-  else if (entry.key == "vdrKeyFaswRew") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyFaswRew;
-        args->keys->vdrKeyFaswRew = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyFaswRew;
-      args->keys->vdrKeyFaswRew = new string(entry.value);
+    if (!found) {
+        throw InvalidKeywordException(entry.key, position, mConfigFileContent);
     }
-  }
+}
 
-  else if (entry.key == "vdrKeyAudio") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyAudio;
-        args->keys->vdrKeyAudio = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+string *cExternalplayerConfig::GetCodeSpecialKey(string name) {
+    if (name == "noKey") {
+        return new string("");
     }
-    else {
-      delete args->keys->vdrKeyAudio;
-      args->keys->vdrKeyAudio = new string(entry.value);
+    else if (name == "specialKeyUp") {
+        return new string("\e[A");
     }
-  }
-
-  else if (entry.key == "vdrKeySchedule") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeySchedule;
-        args->keys->vdrKeySchedule = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyDown") {
+        return new string("\e[B");
     }
-    else {
-      delete args->keys->vdrKeySchedule;
-      args->keys->vdrKeySchedule = new string(entry.value);
+    else if (name == "specialKeyRight") {
+        return new string("\e[C");
     }
-  }
-
-  else if (entry.key == "vdrKeyChannels") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyChannels;
-        args->keys->vdrKeyChannels = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyLeft") {
+        return new string("\e[D");
     }
-    else {
-      delete args->keys->vdrKeyChannels;
-      args->keys->vdrKeyChannels = new string(entry.value);
+    else if (name == "specialKeyF1") {
+        return new string("\eOP");
     }
-  }
-
-  else if (entry.key == "vdrKeyTimers") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyTimers;
-        args->keys->vdrKeyTimers = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyF2") {
+        return new string("\eOQ");
     }
-    else {
-      delete args->keys->vdrKeyTimers;
-      args->keys->vdrKeyTimers = new string(entry.value);
+    else if (name == "specialKeyF3") {
+        return new string("\eOR");
     }
-  }
-
-  else if (entry.key == "vdrKeyRecordings") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyRecordings;
-        args->keys->vdrKeyRecordings = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyF4") {
+        return new string("\eOS");
     }
-    else {
-      delete args->keys->vdrKeyRecordings;
-      args->keys->vdrKeyRecordings = new string(entry.value);
+    else if (name == "specialKeyF5") {
+        return new string("\e[15~");
     }
-  }
-
-  else if (entry.key == "vdrKeySetup") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeySetup;
-        args->keys->vdrKeySetup = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyF6") {
+        return new string("\e[17~");
     }
-    else {
-      delete args->keys->vdrKeySetup;
-      args->keys->vdrKeySetup = new string(entry.value);
+    else if (name == "specialKeyF7") {
+        return new string("\e[18~");
     }
-  }
-
-  else if (entry.key == "vdrKeyCommands") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyCommands;
-        args->keys->vdrKeyCommands = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyF8") {
+        return new string("\e[19~");
     }
-    else {
-      delete args->keys->vdrKeyCommands;
-      args->keys->vdrKeyCommands = new string(entry.value);
+    else if (name == "specialKeyF9") {
+        return new string("\e[20~");
     }
-  }
-
-  else if (entry.key == "vdrKeyUser1") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser1;
-        args->keys->vdrKeyUser1 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyF10") {
+        return new string("\e[21~");
     }
-    else {
-      delete args->keys->vdrKeyUser1;
-      args->keys->vdrKeyUser1 = new string(entry.value);
+    else if (name == "specialKeyF11") {
+        return new string("\e[23~");
     }
-  }
-
-  else if (entry.key == "vdrKeyUser2") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser2;
-        args->keys->vdrKeyUser2 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyF12") {
+        return new string("\e[24~");
     }
-    else {
-      delete args->keys->vdrKeyUser2;
-      args->keys->vdrKeyUser2 = new string(entry.value);
+    else if (name == "specialKeyIns") {
+        return new string("\e[2~");
     }
-  }
-
-  else if (entry.key == "vdrKeyUser3") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser3;
-        args->keys->vdrKeyUser3 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyDel") {
+        return new string("\e[3~");
     }
-    else {
-      delete args->keys->vdrKeyUser3;
-      args->keys->vdrKeyUser3 = new string(entry.value);
+    else if (name == "specialKeyHome") {
+        return new string("\e[H");
     }
-  }
-
-  else if (entry.key == "vdrKeyUser4") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser4;
-        args->keys->vdrKeyUser4 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyEnd") {
+        return new string("\e[F");
     }
-    else {
-      delete args->keys->vdrKeyUser4;
-      args->keys->vdrKeyUser4 = new string(entry.value);
+    else if (name == "specialKeyPageUp") {
+        return new string("\e[5~");
     }
-  }
-
-  else if (entry.key == "vdrKeyUser5") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser5;
-        args->keys->vdrKeyUser5 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyUser5;
-      args->keys->vdrKeyUser5 = new string(entry.value);
+    else if (name == "specialKeyPageDown") {
+        return new string("\e[6~");
     }
-  }
-
-  else if (entry.key == "vdrKeyUser6") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser6;
-        args->keys->vdrKeyUser6 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeySpace") {
+        return new string(" ");
     }
-    else {
-      delete args->keys->vdrKeyUser6;
-      args->keys->vdrKeyUser6 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyUser7") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser7;
-        args->keys->vdrKeyUser7 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+    else if (name == "specialKeyReturn") {
+        return new string("\n");
     }
     else {
-      delete args->keys->vdrKeyUser7;
-      args->keys->vdrKeyUser7 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyUser8") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser8;
-        args->keys->vdrKeyUser8 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
-    }
-    else {
-      delete args->keys->vdrKeyUser8;
-      args->keys->vdrKeyUser8 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "vdrKeyUser9") {
-    if (entry.value.size() > 1) {
-      string * keyString = getCodeSpecialKey(entry.value);
-      if (keyString != NULL) {
-        delete args->keys->vdrKeyUser9;
-        args->keys->vdrKeyUser9 = keyString;
-      }
-      else {
-        throw InvalidKeywordException(entry.value, position, configFileContent);
-      }
+        return NULL;
     }
-    else {
-      delete args->keys->vdrKeyUser9;
-      args->keys->vdrKeyUser9 = new string(entry.value);
-    }
-  }
-
-  else if (entry.key == "" || entry.value == "") {
-    throw SyntaxErrorException(position, configFileContent);
-  }
-
-  else {
-    throw InvalidKeywordException(entry.key, position, configFileContent);
-  }
-}
-
-string * cExternalplayerConfig::getCodeSpecialKey(string name) {
-  if (name == "noKey") {
-    return new string("");
-  }
-  else if (name == "specialKeyUp") {
-    return new string("\e[A");
-  }
-  else if (name == "specialKeyDown") {
-    return new string("\e[B");
-  }
-  else if (name == "specialKeyRight") {
-    return new string("\e[C");
-  }
-  else if (name == "specialKeyLeft") {
-    return new string("\e[D");
-  }
-  else if (name == "specialKeyF1") {
-    return new string("\eOP");
-  }
-  else if (name == "specialKeyF2") {
-    return new string("\eOQ");
-  }
-  else if (name == "specialKeyF3") {
-    return new string("\eOR");
-  }
-  else if (name == "specialKeyF4") {
-    return new string("\eOS");
-  }
-  else if (name == "specialKeyF5") {
-    return new string("\e[15~");
-  }
-  else if (name == "specialKeyF6") {
-    return new string("\e[17~");
-  }
-  else if (name == "specialKeyF7") {
-    return new string("\e[18~");
-  }
-  else if (name == "specialKeyF8") {
-    return new string("\e[19~");
-  }
-  else if (name == "specialKeyF9") {
-    return new string("\e[20~");
-  }
-  else if (name == "specialKeyF10") {
-    return new string("\e[21~");
-  }
-  else if (name == "specialKeyF11") {
-    return new string("\e[23~");
-  }
-  else if (name == "specialKeyF12") {
-    return new string("\e[24~");
-  }
-  else if (name == "specialKeyIns") {
-    return new string("\e[2~");
-  }
-  else if (name == "specialKeyDel") {
-    return new string("\e[3~");
-  }
-  else if (name == "specialKeyHome") {
-    return new string("\e[H");
-  }
-  else if (name == "specialKeyEnd") {
-    return new string("\e[F");
-  }
-  else if (name == "specialKeyPageUp") {
-    return new string("\e[5~");
-  }
-  else if (name == "specialKeyPageDown") {
-    return new string("\e[6~");
-  }
-  else if (name == "specialKeySpace") {
-    return new string(" ");
-  }
-  else if (name == "specialKeyReturn") {
-    return new string("\n");
-  }
-  else {
-    return NULL;
-  }
 }
 
-unsigned int cExternalplayerConfig::getLineNumberOfChar(unsigned int charNumber) {
-  unsigned int lineNumber = 0;
+unsigned int cExternalplayerConfig::GetLineNumberOfChar(unsigned int charNumber) {
+    unsigned int lineNumber = 0;
 
-  for (unsigned int i = 0; i < charNumber; i++) {
-    if ((*configFileContent)[i] == '\n') {
-      lineNumber++;
+    for (unsigned int i = 0; i < charNumber; i++) {
+        if (mConfigFileContent[i] == '\n') {
+            lineNumber++;
+        }
     }
-  }
-
-  return lineNumber;
+    return lineNumber;
 }
 
-unsigned int cExternalplayerConfig::getColumnNumberOfChar(unsigned int charNumber) {
-  unsigned int columnNumber = 1;
+unsigned int cExternalplayerConfig::GetColumnNumberOfChar(unsigned int charNumber) {
+    unsigned int columnNumber = 1;
 
-  for (unsigned int i = 0; i < charNumber; i++) {
-    if ((*configFileContent)[i] == '\n') {
-      columnNumber = 1;
-    }
-    else {
-      columnNumber++;
+    for (unsigned int i = 0; i < charNumber; i++) {
+        if (mConfigFileContent[i] == '\n') {
+            columnNumber = 1;
+        }
+        else {
+            columnNumber++;
+        }
     }
-  }
 
-  return columnNumber;
+    return columnNumber;
 }
diff --git a/externalplayer-config.h b/externalplayer-config.h
index 6f8dd29..a82485c 100644
--- a/externalplayer-config.h
+++ b/externalplayer-config.h
@@ -1,150 +1,140 @@
 /*
  * externalplayer-config.h: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+ * Initially written by Felix Hädicke
+ *
+ * 2013 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
+#ifndef _EXTERNALPLAYER_CONFIG_H_
+#define _EXTERNALPLAYER_CONFIG_H_
+
 #include <string>
-#include <list>
+#include <vector>
+#include <stdexcept>
 #include <fstream>
 #include <cstring>
 
 #include <vdr/device.h>
 #include <vdr/tools.h>
-
-#ifndef _EXTERNALPLAYER_CONFIG_H_
-#define _EXTERNALPLAYER_CONFIG_H_
+#include <vdr/keys.h>
 
 using namespace std;
 
-struct sKeymap {
-  string * vdrKeyUp;
-  string * vdrKeyDown;
-  string * vdrKeyLeft;
-  string * vdrKeyRight;
-  string * vdrKeyOk;
-  string * vdrKeyBack;
-  string * vdrKeyRed;
-  string * vdrKeyGreen;
-  string * vdrKeyYellow;
-  string * vdrKeyBlue;
-  string * vdrKey0;
-  string * vdrKey1;
-  string * vdrKey2;
-  string * vdrKey3;
-  string * vdrKey4;
-  string * vdrKey5;
-  string * vdrKey6;
-  string * vdrKey7;
-  string * vdrKey8;
-  string * vdrKey9;
-  string * vdrKeyPlay;
-  string * vdrKeyPause;
-  string * vdrKeyStop;
-  string * vdrKeyRecord;
-  string * vdrKeyFastFwd;
-  string * vdrKeyFaswRew;
-  string * vdrKeyChannelUp;
-  string * vdrKeyChannelDown;
-  string * vdrKeyAudio;
-  string * vdrKeySchedule;
-  string * vdrKeyChannels;
-  string * vdrKeyTimers;
-  string * vdrKeyRecordings;
-  string * vdrKeySetup;
-  string * vdrKeyCommands;
-  string * vdrKeyUser1;
-  string * vdrKeyUser2;
-  string * vdrKeyUser3;
-  string * vdrKeyUser4;
-  string * vdrKeyUser5;
-  string * vdrKeyUser6;
-  string * vdrKeyUser7;
-  string * vdrKeyUser8;
-  string * vdrKeyUser9;
-  sKeymap();
-  ~sKeymap();
+class StringTool {
+public:
+    static int strcasecmp (const string &s1, const string &s2) {
+        return (::strcasecmp (s1.c_str(), s2.c_str()) == 0);
+    }
+};
+
+class sKeymap {
+private:
+    string mKeyMap[k_Setup+1];
+public:
+    void SetKey (eKeys key, const string &val) {mKeyMap[key] = val;}
+    string GetKey (eKeys key) {return mKeyMap[key];}
+    sKeymap();
 };
 
 struct sPlayerArgs {
-  string menuEntry;
-  string playerCommand;
-  ePlayMode playMode;
-  bool slaveMode;
-  bool deactivateRemotes;
-  bool blockMenu;
-  sKeymap * keys;
-  sPlayerArgs();
-  ~sPlayerArgs();
+    string mMenuEntry;
+    string mPlayerCommand;
+    ePlayMode mPlayMode;
+    bool mSlaveMode;
+    bool mDeactivateRemotes;
+    bool mBlockMenu;
+    sKeymap mKeys;
+    sPlayerArgs();
 };
 
+typedef vector<sPlayerArgs *> sPlayerArgsList;
+
 struct sConfigEntry {
-  string key;
-  string value;
+    string key;
+    string value;
 };
 
 class FileNotFoundException {
 private:
-  string filename;
+    string mFilename;
 public:
-  FileNotFoundException(string nFilename);
-  string getFilename() { return filename; }
+    FileNotFoundException(string nFilename) {mFilename = nFilename;}
+    string GetFilename(void) {
+        return mFilename;
+    }
 };
 
 class SyntaxErrorException {
 private:
-  int charNumber;
-  string * configFileContent;
+    int mCharNumber;
+    string mConfigFileContent;
 public:
-  SyntaxErrorException(int nCharNumber, string * nConfigFileContent);
-  int getLineNumber();
-  int getColumnNumber();
+    SyntaxErrorException(int nCharNumber, const string &nConfigFileContent);
+    int GetLineNumber(void);
+    int GetColumnNumber(void);
 };
 
 class EntryMissingException {
 private:
-  string playerCommand;
-  string menuEntry;
-  int charNumber;
-  string * configFileContent;
+    string mPlayerCommand;
+    string mMenuEntry;
+    int mCharNumber;
+    string mConfigFileContent;
 public:
-  EntryMissingException(string nPlayerCommand, string nMenuEntry, int nCharNumber, string * nConfigFileContent);
-  string getPlayerCommand() { return playerCommand; }
-  string getMenuEntry() { return menuEntry; }
-  int getLineNumber();
+    EntryMissingException(const string &nPlayerCommand, const string &nMenuEntry,
+                          int nCharNumber, const string &nConfigFileContent);
+    string GetPlayerCommand(void) {
+        return mPlayerCommand;
+    }
+    string GetMenuEntry(void) {
+        return mMenuEntry;
+    }
+    int GetLineNumber(void);
 };
 
 class InvalidKeywordException {
 private:
-  string keyword;
-  int charNumber;
-  string * configFileContent;
+    string mKeyword;
+    int mCharNumber;
+    string mConfigFileContent;
 public:
-  InvalidKeywordException(string nKeyword, int nCharNumber, string * nConfigFileContent);
-  string getKeyword() { return keyword; }
-  int getLineNumber();
+    InvalidKeywordException(const string &nKeyword, int nCharNumber,
+                            const string &nConfigFileContent);
+    string GetKeyword(void) {return mKeyword;}
+    int GetLineNumber(void);
 };
 
 class cExternalplayerConfig {
 private:
-  string * configFileContent;
-  list<sPlayerArgs *> configuration;
-  string * readConfigFile(string filename);
-  list<sPlayerArgs *> parseConfigFile();
-  sPlayerArgs * getConfiguration(unsigned int * position);
-  sConfigEntry getConfigEntry(unsigned int * position);
-  void removeUnnecessarySymbols(string * stringPtr);
-  void processConfigEntry(sPlayerArgs * args, sConfigEntry entry, int position);
-  string * getCodeSpecialKey(string name);
-  unsigned int getLineNumberOfChar(unsigned int charNumber);
-  unsigned int getColumnNumberOfChar(unsigned int charNumber);
+    string mConfigFileContent;
+    sPlayerArgsList configuration;
+    string ReadConfigFile(const string &filename);
+    sPlayerArgsList ParseConfigFile(void);
+    sPlayerArgs *GetConfiguration(unsigned int *position);
+    sConfigEntry GetConfigEntry(unsigned int *position);
+    void RemoveUnnecessarySymbols(string &stringPtr);
+    void ProcessConfigEntry(sPlayerArgs *args, sConfigEntry entry,
+                            int position);
+    string *GetCodeSpecialKey(string name);
+    unsigned int GetLineNumberOfChar(unsigned int charNumber);
+    unsigned int GetColumnNumberOfChar(unsigned int charNumber);
 public:
-  cExternalplayerConfig(string filename);
-  ~cExternalplayerConfig();
-  list<sPlayerArgs *> getConfiguration() { return configuration; }
-  int playerCount() { return configuration.size(); }
+    cExternalplayerConfig(string filename);
+    ~cExternalplayerConfig();
+    sPlayerArgsList GetConfiguration(void) {
+        return configuration;
+    }
+    sPlayerArgs *GetConfiguration(int cnt) throw (std::out_of_range) {
+        return (configuration.at(cnt));
+    }
+    int PlayerCount(void) {
+        return configuration.size();
+    }
 };
 
 #endif /*_EXTERNALPLAYER_CONFIG_H_*/
diff --git a/externalplayer-control.c b/externalplayer-control.c
index 6270c3e..484559c 100644
--- a/externalplayer-control.c
+++ b/externalplayer-control.c
@@ -1,20 +1,24 @@
 /*
  * externalplayer-control.c: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+* Initially written by Felix Hädicke
+ *
+ * 2013 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
 #include "externalplayer-control.h"
 #include "externalplayer-player.h"
 
 cStatusExternalplayer::cStatusExternalplayer(sPlayerArgs * nConfig) : cStatus() {
-  config = nConfig;
+  mConfig = nConfig;
 }
 
 void cStatusExternalplayer::OsdTitle(const char * title) {
-  if (config->blockMenu) {
+  if (mConfig->mBlockMenu) {
     cRemote::Put(kMenu);
     isyslog("externalplayer-plugin: menu blocked");
   }
@@ -23,383 +27,48 @@ void cStatusExternalplayer::OsdTitle(const char * title) {
 // --- cControlExternalplayer ------------------------------------------------
 
 cControlExternalplayer::cControlExternalplayer(sPlayerArgs * nConfig, int fdsPipe[2])
-    : cControl(player = new cPlayerExternalplayer(nConfig->playMode, nConfig, fdsPipe[0])) {
-  config = nConfig;
-  status = new cStatusExternalplayer(config);
+    : cControl(player = new cPlayerExternalplayer(nConfig->mPlayMode, nConfig, fdsPipe[0])) {
+  mConfig = nConfig;
+  mStatus = new cStatusExternalplayer(mConfig);
   fdWritePipe = fdsPipe[1];
+  fdReadPipe = fdsPipe[0];
 }
 
 cControlExternalplayer::~cControlExternalplayer() {
-  isyslog("externalplayer-plugin: shutting down player");
+  dsyslog("externalplayer-plugin: shutting down player");
+  close (fdWritePipe);
+  close (fdReadPipe);
   delete player;
-  delete status;
+  delete mStatus;
   player = NULL;
 }
 
 eOSState cControlExternalplayer::ProcessKey(eKeys key) {
-  if (!(((cPlayerExternalplayer *)player)->isActive())) {
-    return osEnd;
-  }
+    if (!(((cPlayerExternalplayer *)player)->isActive())) {
+        isyslog("externalplayer-plugin: player not active");
+        return osEnd;
+    }
 
-  if (config->slaveMode) {
-    switch (key) {
-      case kUp:
-        {
-          string * key = config->keys->vdrKeyUp;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kDown:
-        {
-          string * key = config->keys->vdrKeyDown;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kOk:
-        {
-          string * key = config->keys->vdrKeyOk;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kBack:
-        {
-          string * key = config->keys->vdrKeyBack;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kLeft:
-        {
-          string * key = config->keys->vdrKeyLeft;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kRight:
-        {
-          string * key = config->keys->vdrKeyRight;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kRed:
-        {
-          string * key = config->keys->vdrKeyRed;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kGreen:
-        {
-          string * key = config->keys->vdrKeyGreen;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kYellow:
-        {
-          string * key = config->keys->vdrKeyYellow;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kBlue:
-        {
-          string * key = config->keys->vdrKeyBlue;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k0:
-        {
-          string * key = config->keys->vdrKey0;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k1:
-        {
-          string * key = config->keys->vdrKey1;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k2:
-        {
-          string * key = config->keys->vdrKey2;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k3:
-        {
-          string * key = config->keys->vdrKey3;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k4:
-        {
-          string * key = config->keys->vdrKey4;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k5:
-        {
-          string * key = config->keys->vdrKey5;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k6:
-        {
-          string * key = config->keys->vdrKey6;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k7:
-        {
-          string * key = config->keys->vdrKey7;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k8:
-        {
-          string * key = config->keys->vdrKey8;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case k9:
-        {
-          string * key = config->keys->vdrKey9;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kPlay:
-        {
-          string * key = config->keys->vdrKeyPlay;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
+    if (mConfig->mSlaveMode) {
+        string keyval = mConfig->mKeys.GetKey (key);
+        if (!keyval.empty()) {
+            write(fdWritePipe, keyval.c_str(), keyval.size());
         }
-        break;
-      case kPause:
-        {
-          string * key = config->keys->vdrKeyPause;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
+        if ((key == kChanUp) || (key == kChanDn)) {
+            return osEnd;
         }
-        break;
-      case kStop:
-        {
-          string * key = config->keys->vdrKeyStop;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kRecord:
-        {
-          string * key = config->keys->vdrKeyRecord;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kFastFwd:
-        {
-          string * key = config->keys->vdrKeyFastFwd;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kFastRew:
-        {
-          string * key = config->keys->vdrKeyFaswRew;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-#if VDRVERSNUM >= 10318
-      case kAudio:
-        {
-          string * key = config->keys->vdrKeyAudio;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-#endif
-      case kSchedule:
-        {
-          string * key = config->keys->vdrKeySchedule;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kChannels:
-        {
-          string * key = config->keys->vdrKeyChannels;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kTimers:
-        {
-          string * key = config->keys->vdrKeyTimers;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kRecordings:
-        {
-          string * key = config->keys->vdrKeyRecordings;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kSetup:
-        {
-          string * key = config->keys->vdrKeySetup;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kCommands:
-        {
-          string * key = config->keys->vdrKeyCommands;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser1:
-        {
-          string * key = config->keys->vdrKeyUser1;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser2:
-        {
-          string * key = config->keys->vdrKeyUser2;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser3:
-        {
-          string * key = config->keys->vdrKeyUser3;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser4:
-        {
-          string * key = config->keys->vdrKeyUser4;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser5:
-        {
-          string * key = config->keys->vdrKeyUser5;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser6:
-        {
-          string * key = config->keys->vdrKeyUser6;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser7:
-        {
-          string * key = config->keys->vdrKeyUser7;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser8:
-        {
-          string * key = config->keys->vdrKeyUser8;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kUser9:
-        {
-          string * key = config->keys->vdrKeyUser9;
-          if (key != NULL) {
-            write(fdWritePipe, key->c_str(), key->size());
-          }
-        }
-        break;
-      case kChanUp:
-      case kChanDn:
-        return osEnd;
-        break;
-      default:
-        break;
     }
-  }
-  else {
-    switch (key) {
-      case kStop:
-      case kBlue:
-      case kChanUp:
-      case kChanDn:
-        return osEnd;
-      default:
-        break;
+    else {
+        switch (key) {
+        case kStop:
+        case kBlue:
+        case kChanUp:
+        case kChanDn:
+            return osEnd;
+        default:
+            break;
+        }
     }
-}
 
-  return osContinue;
+    return osContinue;
 }
diff --git a/externalplayer-control.h b/externalplayer-control.h
index c5da308..5ba5f3f 100644
--- a/externalplayer-control.h
+++ b/externalplayer-control.h
@@ -1,9 +1,13 @@
 /*
  * externalplayer-control.h: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+ * Initially written by Felix Hädicke
+ *
+ * 2013 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
 #ifndef _EXTERNALPLAYER_CONTROL_H_
@@ -18,7 +22,7 @@ using namespace std;
 
 class cStatusExternalplayer : public cStatus {
 private:
-  sPlayerArgs * config;
+  sPlayerArgs *mConfig;
 public:
   cStatusExternalplayer(sPlayerArgs * nConfig);
   ~cStatusExternalplayer() {}
@@ -27,14 +31,19 @@ public:
 
 class cControlExternalplayer : public cControl {
 private:
-  sPlayerArgs * config;
-  cStatusExternalplayer * status;
+  sPlayerArgs *mConfig;
+  cStatusExternalplayer *mStatus;
   int fdWritePipe;
+  int fdReadPipe;
 public:
   cControlExternalplayer(sPlayerArgs * nConfig, int fdsPipe[2]);
   ~cControlExternalplayer();
   void Hide() {}
   eOSState ProcessKey(eKeys key);
+  void Stop(void) {
+      cPlayerExternalplayer *pl = (cPlayerExternalplayer *)player;
+      pl->Stop();
+  }
 };
 
 #endif /*_EXTERNALPLAYER_CONTROL_H_*/
diff --git a/externalplayer-player.c b/externalplayer-player.c
index a32bedd..bd9e307 100644
--- a/externalplayer-player.c
+++ b/externalplayer-player.c
@@ -1,9 +1,13 @@
 /*
  * externalplayer-player.c: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+ * Initially written by Felix Hädicke
+ *
+ * 2013 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
 #include <sys/types.h>
@@ -14,73 +18,116 @@
 
 #include "externalplayer-player.h"
 
-pid_t pid = 0;
-void killProcess(int noParam) {
-  if (kill(pid, 0) == 0) {
-    isyslog("externalplayer-plugin: player did not terminate properly. Killing process %i", pid);
-    kill(pid, SIGKILL);
-    signal(SIGALRM, SIG_DFL);
-  }
-  pid = 0;
+int cKillThread::Wait(int pid)
+{
+    int stat_loc = 0;
+    int cnt = 0;
+    while (waitpid (pid, &stat_loc, WNOHANG) != pid) {
+        cnt++;
+        if (cnt > 5) {
+            return false;
+        }
+        sleep(1);
+    }
+    return true;
 }
 
-cPlayerExternalplayer::cPlayerExternalplayer(ePlayMode playMode, sPlayerArgs * nConfig, int nFdReadPipe)
-    : cPlayer(playMode) {
-  config = nConfig;
+void cKillThread::Action(void)
+{
+    if (kill(mPid, 0) == 0) {
+        kill(mPid, SIGTERM);
+        if (Wait (mPid)) {
+            return;
+        }
+        isyslog("externalplayer-plugin: player did not terminate properly. Killing process %i", mPid);
+        Skins.QueueMessage(mtInfo, tr("player did not terminate properly"));
+        kill(mPid, SIGKILL);
+        if (!Wait (mPid)) {
+            isyslog("externalplayer-plugin: player did not terminate properly. Can not killing process %i", mPid);
+        }
+    }
+}
 
-  fdReadPipe = nFdReadPipe;
+void cKillThread::KillProc(int npid)
+{
+    mPid = npid;
+    SetDescription ("KillThread pid %d", mPid);
+    Start();
+}
+
+cPlayerExternalplayer::cPlayerExternalplayer(ePlayMode playMode, sPlayerArgs * nConfig, int nFdReadPipe)
+                                              : cPlayer(playMode) {
+    mConfig = nConfig;
 
-  if (config->deactivateRemotes) {
-    remotesDisable = new cRemotesDisable();
-  }
-  else {
-    remotesDisable = NULL;
-  }
+    fdReadPipe = nFdReadPipe;
 
+    if (mConfig->mDeactivateRemotes) {
+        mRemotesDisable = new cRemotesDisable();
+    }
+    else {
+        mRemotesDisable = NULL;
+    }
+    mPid = 0;
 }
 
 cPlayerExternalplayer::~cPlayerExternalplayer() {
-  Activate(false);
-  delete remotesDisable;
+
+    Activate(false);
+    delete mRemotesDisable;
 }
 
 void cPlayerExternalplayer::Activate(bool On) {
-  if (On) {
-    if (remotesDisable != NULL) {
-      remotesDisable->deactivateRemotes();
-    }
+    if (On) {
+        if (mRemotesDisable != NULL) {
+            mRemotesDisable->DeactivateRemotes();
+        }
 
-    int nPid = fork();
-    if (nPid == 0) {
-      if (config->slaveMode) {
-        dup2(fdReadPipe, STDIN_FILENO);
-      }
-
-      isyslog("externalplayer-plugin: executing \"%s\"", config->playerCommand.c_str());
-      execle("/bin/sh", "sh", "-c", config->playerCommand.c_str(), NULL, environ);
-      isyslog("externalplayer-plugin: execution (of /bin/sh) failed");
-      _exit(0);
+        int nPid = fork();
+        if (nPid == 0) {
+            // Start a new session
+            pid_t sid = setsid();
+            if (sid < 0) {
+                isyslog("externalplayer-plugin: can not create new session");
+            }
+            if (mConfig->mSlaveMode) {
+                dup2(fdReadPipe, STDIN_FILENO);
+            }
+            if (execl("/bin/sh", "sh", "-c", mConfig->mPlayerCommand.c_str(), NULL) == -1) {
+                LOG_ERROR_STR(mConfig->mPlayerCommand.c_str());
+                exit(-1);
+            }
+            isyslog("externalplayer-plugin: SystemExec failed");
+            exit(0);
+        }
+        else {
+            mPid = nPid;
+            isyslog("externalplayer-plugin: PID of child process: %i executing \"%s\"",
+                    mPid, mConfig->mPlayerCommand.c_str());
+        }
     }
     else {
-      pid = nPid;
-      isyslog("externalplayer-plugin: PID of child process: %i", pid);
-    }
-  }
-  else {
-    if (remotesDisable != NULL) {
-      remotesDisable->reactivateRemotes();
+        if (mRemotesDisable != NULL) {
+            mRemotesDisable->ReactivateRemotes();
+        }
+        if (mPid != 0) {
+            mKillThread.KillProc(mPid);
+        }
     }
-
-    if (pid != 0) {
-      if (kill(pid, 0) == 0) {
-        kill(pid, SIGTERM);
-        alarm(2);
-        signal(SIGALRM, killProcess);
-      }
-    }
-  }
 }
 
 bool cPlayerExternalplayer::isActive() {
-  return (waitpid(pid, NULL, WNOHANG) == 0);
+    int stat_loc = 0;
+    if (mPid == 0) {
+        return false;
+    }
+    if (waitpid(mPid, &stat_loc, WNOHANG) == 0) {
+        return true;
+    }
+    mPid = 0;
+    if (!WIFEXITED (stat_loc))
+    {
+        LOG_ERROR_STR("externalplayer-plugin: Child died unexpected\n");
+        Skins.QueueMessage(mtError, tr("Programm crashed"));
+    }
+    return false;
 }
diff --git a/externalplayer-player.h b/externalplayer-player.h
index dc76531..922ed0d 100644
--- a/externalplayer-player.h
+++ b/externalplayer-player.h
@@ -16,17 +16,34 @@
 
 using namespace std;
 
+class cKillThread : public cThread {
+protected:
+    int mPid;
+    void Action(void);
+    int Wait(int pid);
+public:
+    void KillProc (int npid);
+};
+
 class cPlayerExternalplayer : public cPlayer {
 private:
-  cRemotesDisable * remotesDisable;
-  sPlayerArgs * config;
-  int fdReadPipe;
+    cKillThread mKillThread;
+    cRemotesDisable *mRemotesDisable;
+    sPlayerArgs *mConfig;
+    int fdReadPipe;
+    pid_t mPid;
 protected:
-  void Activate(bool On);
+    void Activate(bool On);
+
 public:
-  cPlayerExternalplayer(ePlayMode playMode, sPlayerArgs * nConfig, int nFdReadPipe);
-  ~cPlayerExternalplayer();
-  bool isActive();
+    cPlayerExternalplayer(ePlayMode playMode, sPlayerArgs * nConfig, int nFdReadPipe);
+    ~cPlayerExternalplayer();
+    bool isActive();
+    void Stop(void) {
+        if (mPid != 0) {
+            mKillThread.KillProc(mPid);
+        }
+    }
 };
 
 #endif /*_EXTERNALPLAYER_PLAYER_H_*/
diff --git a/externalplayer-remotes.c b/externalplayer-remotes.c
index b85531c..b2ee44c 100644
--- a/externalplayer-remotes.c
+++ b/externalplayer-remotes.c
@@ -1,24 +1,28 @@
 /*
  * externalplayer-remotes.c: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+ * Initially written by Felix Hädicke
+ *
+ * 2013 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
 #include <string.h>
 
 #include "externalplayer-remotes.h"
 
-void cRemotesDisable::deactivateRemotes() {
+void cRemotesDisable::DeactivateRemotes() {
   if (!deactivated) {
     isyslog("externalplayer-plugin: deactivating remotes");
     for (cRemote * i = Remotes.First(); i != NULL; i = Remotes.Next(i)) {
       if (strcmp(i->Name(), "LIRC") == 0) {
-        ((cRemotesDisableHelper *) i)->deactivate();
+        ((cRemotesDisableHelper *) i)->Deactivate();
       }
       else if (strcmp(i->Name(), "RCU") == 0) {
-        ((cRemotesDisableHelper *) i)->deactivate();
+        ((cRemotesDisableHelper *) i)->Deactivate();
       }
     }
   }
@@ -26,15 +30,15 @@ void cRemotesDisable::deactivateRemotes() {
   deactivated = true;
 }
 
-void cRemotesDisable::reactivateRemotes() {
+void cRemotesDisable::ReactivateRemotes() {
   if (deactivated) {
     isyslog("externalplayer-plugin: reactivating remotes");
     for (cRemote * i = Remotes.First(); i != NULL; i = Remotes.Next(i)) {
       if (strcmp(i->Name(), "LIRC") == 0) {
-        ((cRemotesDisableHelper *) i)->reactivate();
+        ((cRemotesDisableHelper *) i)->Reactivate();
       }
       else if (strcmp(i->Name(), "RCU") == 0) {
-        ((cRemotesDisableHelper *) i)->reactivate();
+        ((cRemotesDisableHelper *) i)->Reactivate();
       }
     }
   }
@@ -47,13 +51,13 @@ void cRemotesDisable::reactivateRemotes() {
 cRemotesDisableHelper::cRemotesDisableHelper(const char * name) : cRemote(name) {
 }
 
-void cRemotesDisableHelper::deactivate() {
+void cRemotesDisableHelper::Deactivate() {
   if (Active()) {
     Cancel();
   }
 }
 
-void cRemotesDisableHelper::reactivate() {
+void cRemotesDisableHelper::Reactivate() {
   if (!Active()) {
     Start();
   }
diff --git a/externalplayer-remotes.h b/externalplayer-remotes.h
index 24bd6de..3a4a903 100644
--- a/externalplayer-remotes.h
+++ b/externalplayer-remotes.h
@@ -1,9 +1,13 @@
 /*
  * externalplayer-remotes.h: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+ * Initially written by Felix Hädicke
+ *
+ * 2013 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
 #ifndef _EXTERNALPLAYER_REMOTES_H_
@@ -16,17 +20,17 @@ using namespace std;
 
 class cRemotesDisable {
 private:
-  bool deactivated;
+    bool deactivated;
 public:
-  void deactivateRemotes();
-  void reactivateRemotes();
+    void DeactivateRemotes(void);
+    void ReactivateRemotes(void);
 };
 
-class cRemotesDisableHelper : public cRemote, public cThread {
+class cRemotesDisableHelper: public cRemote, public cThread {
 public:
-  cRemotesDisableHelper(const char * name);
-  void deactivate();
-  void reactivate();
+    cRemotesDisableHelper(const char * name);
+    void Deactivate(void);
+    void Reactivate(void);
 };
 
 #endif /*_EXTERNALPLAYER_REMOTES_H_*/
diff --git a/externalplayer.c b/externalplayer.c
index b55d1ff..c3c0237 100644
--- a/externalplayer.c
+++ b/externalplayer.c
@@ -1,9 +1,13 @@
 /*
  * externalplayer.c: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+ * Initially written by Felix Hädicke
+ *
+ * 2012 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
 #include <string.h>
@@ -17,27 +21,31 @@
 #include "externalplayer-remotes.h"
 
 cPluginExternalplayer::cPluginExternalplayer() {
-  playerConfig = NULL;
-  configFilename = "";
+  mControl = NULL;
+  mPlayerConfig = NULL;
+  mConfigFilename = "";
 }
 
 cPluginExternalplayer::~cPluginExternalplayer() {
-  delete playerConfig;
+  delete mPlayerConfig;
 }
 
-void cPluginExternalplayer::startPlayer(sPlayerArgs * config) {
-  isyslog("externalplayer-plugin: starting player: %s", config->menuEntry.c_str());
+void cPluginExternalplayer::StartPlayer(sPlayerArgs *config) {
+  isyslog("externalplayer-plugin: starting player: %s",
+          config->mMenuEntry.c_str());
 
   int fdsPipe[2];
-  if (config->slaveMode) {
+  if (config->mSlaveMode) {
     pipe(fdsPipe);
   }
 
-  cControl::Launch(new cControlExternalplayer(config, fdsPipe));
+  mControl = new cControlExternalplayer(config, fdsPipe);
+  cControl::Launch(mControl);
+  cControl::Attach();
 }
 
 const char *cPluginExternalplayer::CommandLineHelp() {
-  return "  -C FILE,  --config=FILE  specify path to config file\n";
+  return "  -C FILE,  --config=FILE  specify path to configuration file\n";
 }
 
 bool cPluginExternalplayer::ProcessArgs(int argc, char *argv[]) {
@@ -49,7 +57,7 @@ bool cPluginExternalplayer::ProcessArgs(int argc, char *argv[]) {
   int c;
   while ((c = getopt_long(argc, argv, "C:", long_options, NULL)) != -1) {
     switch (c) {
-      case 'C': configFilename = optarg;
+      case 'C': mConfigFilename = optarg;
                 break;
       default:  return false;
     }
@@ -62,29 +70,32 @@ bool cPluginExternalplayer::Initialize() {
 }
 
 bool cPluginExternalplayer::Start() {
-  if (configFilename == "") {
-    configFilename += ConfigDirectory();
-    configFilename += "/externalplayer.conf";
+  if (mConfigFilename == "") {
+    mConfigFilename += ConfigDirectory();
+    mConfigFilename += "/externalplayer.conf";
   }
 
-  playerConfig = new cExternalplayerConfig(configFilename);
+  mPlayerConfig = new cExternalplayerConfig(mConfigFilename);
 
   return true;
 }
 
 void cPluginExternalplayer::Stop() {
+    if (mControl != NULL) {
+        mControl->Stop();
+    }
 }
 
 void cPluginExternalplayer::Housekeeping() {
 }
 
 const char * cPluginExternalplayer::MainMenuEntry() {
-  int count = playerConfig->playerCount();
+  int count = mPlayerConfig->PlayerCount();
   if (count == 0) {
     return NULL;
   }
   else if (count == 1) {
-    return playerConfig->getConfiguration().front()->menuEntry.c_str();
+    return mPlayerConfig->GetConfiguration().front()->mMenuEntry.c_str();
   }
   else {
     return tr("External Players");
@@ -92,16 +103,16 @@ const char * cPluginExternalplayer::MainMenuEntry() {
 }
 
 cOsdObject * cPluginExternalplayer::MainMenuAction() {
-  int count = playerConfig->playerCount();
+  int count = mPlayerConfig->PlayerCount();
   if (count == 0) {
     return NULL;
   }
   else if (count == 1) {
-    startPlayer(playerConfig->getConfiguration().front());
+    StartPlayer(mPlayerConfig->GetConfiguration().front());
     return NULL;
   }
   else {
-    return new cOsdExternalplayer(playerConfig);
+    return new cOsdExternalplayer(this);
   }
 }
 
@@ -117,31 +128,130 @@ bool cPluginExternalplayer::Service(const char *Id, void *Data) {
   return false;
 }
 
+const char **cPluginExternalplayer::SVDRPHelpPages(void)
+{
+    static const char *HelpPages[] = {
+            "LIST: List available configurations\n",
+            "EXEC <no>: Execute entry no <no>\n",
+            NULL
+    };
+    return HelpPages;
+}
+
+cString cPluginExternalplayer::SVDRPCommand(const char *Command, const char *Option,
+                                            int &ReplyCode)
+{
+    sPlayerArgs *config = NULL;
+    char *endptr = NULL;
+    long opt = 0;
+
+    if (strcasecmp(Command, "EXEC") == 0) {
+        if ((Option == NULL) || (Option[0] == '\0')) {
+            config = mPlayerConfig->GetConfiguration().front();
+        }
+        else {
+            errno = 0;
+            opt = strtol (Option, &endptr, 10);
+            if (((errno == ERANGE) && ((opt == LONG_MAX) || (opt == LONG_MIN))) ||
+                    ((errno != 0) && (opt == 0)) ||
+                    (Option == endptr))  {
+                ReplyCode = 504;
+                return cString::sprintf("Invalid number \"%s\"", Option);
+            }
+            try {
+                config = mPlayerConfig->GetConfiguration (opt);
+            }
+            catch (const std::out_of_range &oor)
+            {
+                ReplyCode = 504;
+                return cString::sprintf("Configuration %ld not available", opt);
+            }
+        }
+        StartPlayer(config);
+        return "OK";
+    }
+    else if (strcasecmp(Command, "LIST") == 0) {
+        int cnt = 1;
+        string ret = "";
+        char buf[10];
+        sPlayerArgs *nConf;
+        sPlayerArgsList playerArgs = mPlayerConfig->GetConfiguration();
+        for (sPlayerArgsList::iterator i = playerArgs.begin(); i != playerArgs.end(); i++) {
+            nConf = *i;
+            sprintf(buf,"%3d ", cnt);
+            if (cnt > 1) {
+                ret += "\n";
+            }
+            ret += buf + nConf->mMenuEntry;
+            cnt++;
+        }
+        if (ret.empty()) {
+            ReplyCode = 504;
+            return "No config available";
+        }
+        return cString(ret.c_str());
+    }
+    return NULL;
+}
+
 // --- cOsdExternalplayer ---------------------------------------------------
 
-cOsdExternalplayer::cOsdExternalplayer(cExternalplayerConfig * nPlayerConfig) : cOsdMenu(tr("External Players")) {
-  playerConfig = nPlayerConfig;
-  list<sPlayerArgs *> playerArgs = playerConfig->getConfiguration();
-  for (list<sPlayerArgs *>::iterator i = playerArgs.begin(); i != playerArgs.end(); i++) {
-      Add(new cOsdItemExternalplayer(*i));
+cOsdExternalplayer::cOsdExternalplayer(cPluginExternalplayer *plugin) :
+                                             cOsdMenu(tr("External Players")) {
+  cExternalplayerConfig *playerconfig;
+  int cnt = 1;
+  char num[4];
+  sPlayerArgs *nConf;
+  string menutxt;
+  playerconfig = plugin->GetConfig();
+  sPlayerArgsList playerArgs = playerconfig->GetConfiguration();
+  for (sPlayerArgsList::iterator i = playerArgs.begin(); i != playerArgs.end(); i++) {
+      nConf = *i;
+      if (cnt <= 9) {
+          sprintf(num,"%d ", cnt);
+      }
+      else {
+          strcpy (num, "  ");
+      }
+
+      menutxt = num + nConf->mMenuEntry;
+      Add(new cOsdItemExternalplayer(cnt, plugin, menutxt.c_str()));
+      cnt++;
   }
 }
 
 cOsdExternalplayer::~cOsdExternalplayer() {
 }
 
-cOsdItemExternalplayer::cOsdItemExternalplayer(sPlayerArgs * nConfig) : cOsdItem(nConfig->menuEntry.c_str()) {
-  config = nConfig;
+cOsdItemExternalplayer::cOsdItemExternalplayer(int cnt,
+                                               cPluginExternalplayer *plugin,
+                                               const char *menutxt) :
+                                                        cOsdItem(menutxt) {
+  mCnt = cnt;
+  mPlugin = plugin;
 }
 
 // --- cOsdItemExternalplayer -----------------------------------------------
 
 eOSState cOsdItemExternalplayer::ProcessKey(eKeys key) {
+  eOSState state = osUnknown;
+  cExternalplayerConfig *playerconfig = mPlugin->GetConfig();
+
   if (key == kOk) {
-    cPluginExternalplayer::startPlayer(config);
+      mPlugin->StartPlayer(playerconfig->GetConfiguration(mCnt-1));
     return osEnd;
   }
-  return osUnknown;
+  if ((key > k0) && (key <= k9)) {
+      try
+      {
+          mPlugin->StartPlayer(playerconfig->GetConfiguration(key - k1));
+          state = osEnd;
+      }
+      catch (const std::out_of_range &oor)
+      {
+      }
+  }
+  return state;
 }
 
 VDRPLUGINCREATOR(cPluginExternalplayer);
diff --git a/externalplayer.h b/externalplayer.h
index 62c9c62..e1be722 100644
--- a/externalplayer.h
+++ b/externalplayer.h
@@ -1,9 +1,13 @@
 /*
  * externalplayer.h: A plugin for the Video Disk Recorder
  *
- * See the README file for copyright information and how to reach the author.
+* Initially written by Felix Hädicke
+ *
+ * 2012 Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>
+ *
+ * This code is distributed under the terms and conditions of the
+ * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
  *
- * $Id$
  */
 
 #ifndef _EXTERNALPLAYER_H_
@@ -15,16 +19,17 @@
 #include <vdr/menu.h>
 
 #include "externalplayer-config.h"
-
+#include "externalplayer-control.h"
 using namespace std;
 
-static const char *VERSION        = "0.2.0";
+static const char *VERSION        = "0.3.2";
 static const char *DESCRIPTION    = tr("launch external players");
 
 class cPluginExternalplayer : public cPlugin {
 private:
-  string configFilename;
-  cExternalplayerConfig * playerConfig;
+  string mConfigFilename;
+  cExternalplayerConfig * mPlayerConfig;
+  cControlExternalplayer *mControl;
 public:
   cPluginExternalplayer();
   virtual ~cPluginExternalplayer();
@@ -41,22 +46,26 @@ public:
   virtual cMenuSetupPage * SetupMenu();
   virtual bool SetupParse(const char * Name, const char * Value);
   virtual bool Service(const char * Id, void * Data = NULL);
-  static void startPlayer(sPlayerArgs * config);
+  void StartPlayer(sPlayerArgs * config);
+  virtual const char **SVDRPHelpPages(void);
+  virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode);
+  cExternalplayerConfig *GetConfig(void) { return mPlayerConfig; };
 };
 
 class cOsdExternalplayer : public cOsdMenu {
 private:
-  cExternalplayerConfig * playerConfig;
+
 public:
-  cOsdExternalplayer(cExternalplayerConfig * nPlayerConfig);
+  cOsdExternalplayer(cPluginExternalplayer *plugin);
   ~cOsdExternalplayer();
 };
 
 class cOsdItemExternalplayer : public cOsdItem {
 private:
-  sPlayerArgs * config;
+    cPluginExternalplayer *mPlugin;
+    int mCnt;
 public:
-  cOsdItemExternalplayer(sPlayerArgs * nConfig);
+  cOsdItemExternalplayer(int cnt, cPluginExternalplayer *plug, const char *menutxt);
   ~cOsdItemExternalplayer() {}
   virtual eOSState ProcessKey(eKeys key);
 };
diff --git a/po/de_DE.po b/po/de_DE.po
index 249df7c..6c30f04 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: external player\n"
 "Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-01-27 13:37+0100\n"
+"POT-Creation-Date: 2013-04-14 19:19+0200\n"
 "PO-Revision-Date: 2013-01-27 13:25+0100\n"
 "Last-Translator: Ulrich Eckhardt <uli-vdr at uli-eckhardt.de>\n"
 "Language-Team: German\n"
@@ -19,5 +19,11 @@ msgstr ""
 msgid "External Players"
 msgstr "Externe Abspielprogramme"
 
-msgid "launch external players"
-msgstr "Externe Abspielprogramme starten"
+msgid "player did not terminate properly"
+msgstr ""
+
+msgid "Programm crashed"
+msgstr ""
+
+#~ msgid "launch external players"
+#~ msgstr "Externe Abspielprogramme starten"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr-plugin-externalplayer.git



More information about the pkg-vdr-dvb-changes mailing list