From 685f43c6ec1cbe59b52e008744bb86dd7c048544 Mon Sep 17 00:00:00 2001 From: schmirl Date: Tue, 29 Apr 2008 07:00:53 +0000 Subject: [PATCH] - Fixed assignment of externremux.sh's default location cPlugin::ConfigDirectory() cannot be used directly after the plugin has been loaded. The return value of AddDirectory() must be allocated. --- HISTORY | 1 + remux/extern.c | 4 +--- remux/extern.h | 2 -- server/server.c | 3 ++- server/server.h | 6 ++++-- streamdev-server.c | 9 +++++++-- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/HISTORY b/HISTORY index 653936b..92dc98c 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ VDR Plugin 'streamdev' Revision History --------------------------------------- +- fixed assignment of externremux.sh's default location (reported by plautze) - added french translations (thanks to micky979) - added italian translations (thanks to Diego Pierotto) - added gettext support (thanks to Rolf Ahrenberg) diff --git a/remux/extern.c b/remux/extern.c index cebaa2c..7d6307b 100644 --- a/remux/extern.c +++ b/remux/extern.c @@ -7,8 +7,6 @@ #include #include -const char *g_ExternRemux = EXTERNREMUXPATH; - class cTSExt: public cThread { private: cRingBufferLinear *m_ResultBuffer; @@ -68,7 +66,7 @@ cTSExt::cTSExt(cRingBufferLinear *ResultBuffer, std::string Parameter): for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++) close(i); //close all dup'ed filedescriptors - std::string cmd = std::string(g_ExternRemux) + " " + Parameter; + std::string cmd = std::string(opt_remux) + " " + Parameter; execl("/bin/sh", "sh", "-c", cmd.c_str(), NULL); _exit(-1); } diff --git a/remux/extern.h b/remux/extern.h index 7a44852..aa6acf7 100644 --- a/remux/extern.h +++ b/remux/extern.h @@ -5,8 +5,6 @@ #include #include -extern const char *g_ExternRemux; - class cTSExt; class cExternRemux: public cTSRemux { diff --git a/server/server.c b/server/server.c index 5db895e..481e041 100644 --- a/server/server.c +++ b/server/server.c @@ -1,5 +1,5 @@ /* - * $Id: server.c,v 1.5 2007/04/02 10:32:34 schmirl Exp $ + * $Id: server.c,v 1.6 2008/04/29 07:00:54 schmirl Exp $ */ #include "server/server.h" @@ -13,6 +13,7 @@ #include cSVDRPhosts StreamdevHosts; +char *opt_remux = NULL; cStreamdevServer *cStreamdevServer::m_Instance = NULL; cList cStreamdevServer::m_Servers; diff --git a/server/server.h b/server/server.h index be74d51..c32fe09 100644 --- a/server/server.h +++ b/server/server.h @@ -1,5 +1,5 @@ /* - * $Id: server.h,v 1.3 2008/04/07 14:50:33 schmirl Exp $ + * $Id: server.h,v 1.4 2008/04/29 07:00:54 schmirl Exp $ */ #ifndef VDR_STREAMDEV_SERVER_H @@ -10,9 +10,11 @@ #include "server/component.h" #include "server/connection.h" -#define EXTERNREMUXPATH (*AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "externremux.sh")) +#define DEFAULT_EXTERNREMUX (*AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "externremux.sh")) #define STREAMDEVHOSTSPATH (*AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "streamdevhosts.conf")) +extern char *opt_remux; + class cStreamdevServer: public cThread { private: bool m_Active; diff --git a/streamdev-server.c b/streamdev-server.c index 40ba309..b2c178a 100644 --- a/streamdev-server.c +++ b/streamdev-server.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: streamdev-server.c,v 1.8 2008/04/08 14:18:15 schmirl Exp $ + * $Id: streamdev-server.c,v 1.9 2008/04/29 07:00:53 schmirl Exp $ */ #include @@ -25,6 +25,7 @@ cPluginStreamdevServer::cPluginStreamdevServer(void) cPluginStreamdevServer::~cPluginStreamdevServer() { + free(opt_remux); } const char *cPluginStreamdevServer::Description(void) @@ -50,7 +51,9 @@ bool cPluginStreamdevServer::ProcessArgs(int argc, char *argv[]) while((c = getopt_long(argc, argv, "r:", long_options, NULL)) != -1) { switch (c) { case 'r': - g_ExternRemux = optarg; + if (opt_remux) + free(opt_remux); + opt_remux = strdup(optarg); break; default: return false; @@ -74,6 +77,8 @@ bool cPluginStreamdevServer::Start(void) } return false; } + if (!opt_remux) + opt_remux = strdup(DEFAULT_EXTERNREMUX); cStreamdevServer::Initialize();