From e86d019878a4315cc5a75450d2753c543fbe5a1a Mon Sep 17 00:00:00 2001 From: schmirl Date: Mon, 19 Feb 2007 12:08:16 +0000 Subject: [PATCH] Added commandline switch -r/--remux for specifying name of externremux script (thanks to Rolf Ahrenberg) Modified Files: streamdev-server.c streamdev-server.h remux/extern.c remux/extern.h --- remux/extern.c | 8 +++++--- remux/extern.h | 2 ++ streamdev-server.c | 31 ++++++++++++++++++++++++++++++- streamdev-server.h | 4 +++- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/remux/extern.c b/remux/extern.c index b1857f8..ca1082e 100644 --- a/remux/extern.c +++ b/remux/extern.c @@ -6,6 +6,8 @@ #include #include +const char *g_ExternRemux = "/root/externremux.sh"; + class cTSExt: public cThread { private: cRingBufferLinear *m_ResultBuffer; @@ -65,9 +67,9 @@ cTSExt::cTSExt(cRingBufferLinear *ResultBuffer): for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++) close(i); //close all dup'ed filedescriptors - printf("starting externremux.sh\n"); - execl("/bin/sh", "sh", "-c", "/root/externremux.sh", NULL); - printf("failed externremux.sh\n"); + //printf("starting externremux.sh\n"); + execl("/bin/sh", "sh", "-c", g_ExternRemux, NULL); + //printf("failed externremux.sh\n"); _exit(-1); } diff --git a/remux/extern.h b/remux/extern.h index 9066680..ae055ac 100644 --- a/remux/extern.h +++ b/remux/extern.h @@ -4,6 +4,8 @@ #include "remux/tsremux.h" #include +extern const char *g_ExternRemux; + class cTSExt; class cExternRemux: public cTSRemux { diff --git a/streamdev-server.c b/streamdev-server.c index 2d81652..af5f104 100644 --- a/streamdev-server.c +++ b/streamdev-server.c @@ -3,13 +3,15 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: streamdev-server.c,v 1.4 2006/11/24 11:45:36 schmirl Exp $ + * $Id: streamdev-server.c,v 1.5 2007/02/19 12:08:16 schmirl Exp $ */ +#include #include "streamdev-server.h" #include "server/setup.h" #include "server/server.h" #include "server/suspend.h" +#include "remux/extern.h" #include "i18n.h" const char *cPluginStreamdevServer::DESCRIPTION = "VDR Streaming Server"; @@ -27,6 +29,33 @@ const char *cPluginStreamdevServer::Description(void) return tr(DESCRIPTION); } +const char *cPluginStreamdevServer::CommandLineHelp(void) +{ + // return a string that describes all known command line options. + return " -r , --remux= Define an external command for remuxing.\n"; +} + +bool cPluginStreamdevServer::ProcessArgs(int argc, char *argv[]) +{ + // implement command line argument processing here if applicable. + static const struct option long_options[] = { + { "remux", required_argument, NULL, 'r' }, + { NULL, 0, NULL, 0 } + }; + + int c; + while((c = getopt_long(argc, argv, "r:", long_options, NULL)) != -1) { + switch (c) { + case 'r': + g_ExternRemux = optarg; + break; + default: + return false; + } + } + return true; +} + bool cPluginStreamdevServer::Start(void) { i18n_name = Name(); diff --git a/streamdev-server.h b/streamdev-server.h index 09a2c42..8149e4b 100644 --- a/streamdev-server.h +++ b/streamdev-server.h @@ -1,5 +1,5 @@ /* - * $Id: streamdev-server.h,v 1.3 2006/07/05 20:37:17 thomas Exp $ + * $Id: streamdev-server.h,v 1.4 2007/02/19 12:08:16 schmirl Exp $ */ #ifndef VDR_STREAMDEVSERVER_H @@ -19,6 +19,8 @@ public: virtual const char *Version(void) { return VERSION; } virtual const char *Description(void); + virtual const char *CommandLineHelp(void); + virtual bool ProcessArgs(int argc, char *argv[]); virtual bool Start(void); virtual void Stop(void); virtual cString Active(void);