- 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.
This commit is contained in:
schmirl 2008-04-29 07:00:57 +00:00
parent 9e46f86686
commit 90ae937018
6 changed files with 15 additions and 10 deletions

View File

@ -1,6 +1,7 @@
VDR Plugin 'streamdev' Revision History VDR Plugin 'streamdev' Revision History
--------------------------------------- ---------------------------------------
- fixed assignment of externremux.sh's default location (reported by plautze)
- added French translation (thanks to micky979) - added French translation (thanks to micky979)
- updated Italian translation (thanks to Diego Pierotto) - updated Italian translation (thanks to Diego Pierotto)
- removed some unused translations - removed some unused translations

View File

@ -7,8 +7,6 @@
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
const char *g_ExternRemux = EXTERNREMUXPATH;
class cTSExt: public cThread { class cTSExt: public cThread {
private: private:
cRingBufferLinear *m_ResultBuffer; cRingBufferLinear *m_ResultBuffer;
@ -68,7 +66,7 @@ cTSExt::cTSExt(cRingBufferLinear *ResultBuffer, std::string Parameter):
for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++) for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++)
close(i); //close all dup'ed filedescriptors 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); execl("/bin/sh", "sh", "-c", cmd.c_str(), NULL);
_exit(-1); _exit(-1);
} }

View File

@ -5,8 +5,6 @@
#include <vdr/ringbuffer.h> #include <vdr/ringbuffer.h>
#include <string> #include <string>
extern const char *g_ExternRemux;
class cTSExt; class cTSExt;
class cExternRemux: public cTSRemux { class cExternRemux: public cTSRemux {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: server.c,v 1.5 2007/04/02 10:32:34 schmirl Exp $ * $Id: server.c,v 1.5.2.1 2008/04/29 07:01:00 schmirl Exp $
*/ */
#include "server/server.h" #include "server/server.h"
@ -13,6 +13,7 @@
#include <errno.h> #include <errno.h>
cSVDRPhosts StreamdevHosts; cSVDRPhosts StreamdevHosts;
char *opt_remux = NULL;
cStreamdevServer *cStreamdevServer::m_Instance = NULL; cStreamdevServer *cStreamdevServer::m_Instance = NULL;
cList<cServerComponent> cStreamdevServer::m_Servers; cList<cServerComponent> cStreamdevServer::m_Servers;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: server.h,v 1.3 2008/04/07 14:50:33 schmirl Exp $ * $Id: server.h,v 1.3.2.1 2008/04/29 07:01:00 schmirl Exp $
*/ */
#ifndef VDR_STREAMDEV_SERVER_H #ifndef VDR_STREAMDEV_SERVER_H
@ -10,9 +10,11 @@
#include "server/component.h" #include "server/component.h"
#include "server/connection.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")) #define STREAMDEVHOSTSPATH (*AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "streamdevhosts.conf"))
extern char *opt_remux;
class cStreamdevServer: public cThread { class cStreamdevServer: public cThread {
private: private:
bool m_Active; bool m_Active;

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: streamdev-server.c,v 1.7 2008/04/07 14:27:27 schmirl Exp $ * $Id: streamdev-server.c,v 1.7.2.1 2008/04/29 07:00:57 schmirl Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -26,6 +26,7 @@ cPluginStreamdevServer::cPluginStreamdevServer(void)
cPluginStreamdevServer::~cPluginStreamdevServer() cPluginStreamdevServer::~cPluginStreamdevServer()
{ {
free(opt_remux);
} }
const char *cPluginStreamdevServer::Description(void) const char *cPluginStreamdevServer::Description(void)
@ -51,7 +52,9 @@ bool cPluginStreamdevServer::ProcessArgs(int argc, char *argv[])
while((c = getopt_long(argc, argv, "r:", long_options, NULL)) != -1) { while((c = getopt_long(argc, argv, "r:", long_options, NULL)) != -1) {
switch (c) { switch (c) {
case 'r': case 'r':
g_ExternRemux = optarg; if (opt_remux)
free(opt_remux);
opt_remux = strdup(optarg);
break; break;
default: default:
return false; return false;
@ -77,6 +80,8 @@ bool cPluginStreamdevServer::Start(void)
} }
return false; return false;
} }
if (!opt_remux)
opt_remux = strdup(DEFAULT_EXTERNREMUX);
cStreamdevServer::Initialize(); cStreamdevServer::Initialize();