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
This commit is contained in:
schmirl 2007-02-19 12:08:16 +00:00
parent e3a4418453
commit e86d019878
4 changed files with 40 additions and 5 deletions

View File

@ -6,6 +6,8 @@
#include <signal.h>
#include <unistd.h>
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);
}

View File

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

View File

@ -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 <getopt.h>
#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 <CMD>, --remux=<CMD> 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();

View File

@ -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);