mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 17:16:51 +00:00
Snapshot 2009-06-11
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "remux/extern.h"
|
||||
#include "server/server.h"
|
||||
#include "server/streamer.h"
|
||||
#include <vdr/tools.h>
|
||||
#include <sys/types.h>
|
||||
@@ -6,8 +7,6 @@
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const char *g_ExternRemux = "/root/externremux.sh";
|
||||
|
||||
class cTSExt: public cThread {
|
||||
private:
|
||||
cRingBufferLinear *m_ResultBuffer;
|
||||
@@ -28,7 +27,7 @@ public:
|
||||
cTSExt::cTSExt(cRingBufferLinear *ResultBuffer, std::string Parameter):
|
||||
m_ResultBuffer(ResultBuffer),
|
||||
m_Active(false),
|
||||
m_Process(0),
|
||||
m_Process(-1),
|
||||
m_Inpipe(0),
|
||||
m_Outpipe(0)
|
||||
{
|
||||
@@ -67,9 +66,13 @@ 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;
|
||||
execl("/bin/sh", "sh", "-c", cmd.c_str(), NULL);
|
||||
_exit(-1);
|
||||
std::string cmd = std::string(opt_remux) + " " + Parameter;
|
||||
if (execl("/bin/sh", "sh", "-c", cmd.c_str(), NULL) == -1) {
|
||||
esyslog("streamdev-server: externremux script '%s' execution failed: %m", cmd.c_str());
|
||||
_exit(-1);
|
||||
}
|
||||
// should never be reached
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
close(inpipe[0]);
|
||||
@@ -84,16 +87,31 @@ cTSExt::~cTSExt()
|
||||
m_Active = false;
|
||||
Cancel(3);
|
||||
if (m_Process > 0) {
|
||||
// close pipes
|
||||
close(m_Outpipe);
|
||||
close(m_Inpipe);
|
||||
kill(m_Process, SIGTERM);
|
||||
for (int i = 0; waitpid(m_Process, NULL, WNOHANG) == 0; i++) {
|
||||
if (i == 20) {
|
||||
esyslog("streamdev-server: externremux process won't stop - killing it");
|
||||
kill(m_Process, SIGKILL);
|
||||
}
|
||||
cCondWait::SleepMs(100);
|
||||
// signal and wait for termination
|
||||
if (kill(m_Process, SIGINT) < 0) {
|
||||
esyslog("streamdev-server: externremux SIGINT failed: %m");
|
||||
}
|
||||
else {
|
||||
int i = 0;
|
||||
int retval;
|
||||
while ((retval = waitpid(m_Process, NULL, WNOHANG)) == 0) {
|
||||
|
||||
if ((++i % 20) == 0) {
|
||||
esyslog("streamdev-server: externremux process won't stop - killing it");
|
||||
kill(m_Process, SIGKILL);
|
||||
}
|
||||
cCondWait::SleepMs(100);
|
||||
}
|
||||
|
||||
if (retval < 0)
|
||||
esyslog("streamdev-server: externremux process waitpid failed: %m");
|
||||
else
|
||||
Dprintf("streamdev-server: externremux child (%d) exited as expected\n", m_Process);
|
||||
}
|
||||
m_Process = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,6 @@
|
||||
#include <vdr/ringbuffer.h>
|
||||
#include <string>
|
||||
|
||||
extern const char *g_ExternRemux;
|
||||
|
||||
class cTSExt;
|
||||
|
||||
class cExternRemux: public cTSRemux {
|
||||
|
@@ -5,6 +5,10 @@
|
||||
#include <vdr/remux.h>
|
||||
#include <vdr/ringbuffer.h>
|
||||
|
||||
#ifndef MAXTRACKS
|
||||
#define MAXTRACKS 64
|
||||
#endif
|
||||
|
||||
class cTS2PS;
|
||||
|
||||
class cTS2PSRemux: public cTSRemux {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "remux/tsremux.h"
|
||||
|
||||
#define SC_PICTURE 0x00 // "picture header"
|
||||
#define SC_PICTURE 0x00 // "picture header"
|
||||
#define PID_MASK_HI 0x1F
|
||||
|
||||
void cTSRemux::SetBrokenLink(uchar *Data, int Length)
|
||||
{
|
||||
|
@@ -4,6 +4,10 @@
|
||||
#include "libdvbmpeg/transform.h"
|
||||
#include <vdr/remux.h>
|
||||
|
||||
#ifndef NO_PICTURE
|
||||
#define NO_PICTURE 0
|
||||
#endif
|
||||
|
||||
#define RESULTBUFFERSIZE KILOBYTE(256)
|
||||
|
||||
class cTSRemux {
|
||||
|
Reference in New Issue
Block a user