[vdr] streamdev-server for 1.4.1

Aftab Ahmed linux-vdr at theaftab.com
Fri Jun 16 09:26:43 CEST 2006


Gavin Hamill wrote:

>Sorry to bore you all with this old topic, but is there anyone who has a
>working tarball of vdr-1.4.1/PLUGINS/src/streamdev they could send me? 
>
>I've spent the last 20 minutes with Google trying to pick my way
>through German wiki/forum posts without success :(
>
>If it contains support for the 'Extern' URL form to pipe the TS
>through /root/externremux.sh, that'd be perfect! :)
>
>Cheers,
>Gavin.
>
Ahhh some one else that wants to watch the foorball at work!!

I used the attacted patch to make the current cvs work a few days ago.

I am still using 1.4.0-3, but i doubt that should make a difference

Aftab
-------------- next part --------------
Index: i18n.c
===================================================================
RCS file: /var/cvsroot/streamdev/i18n.c,v
retrieving revision 1.3
diff -u -r1.3 i18n.c
--- i18n.c	10 May 2005 21:02:24 -0000	1.3
+++ i18n.c	17 Apr 2006 16:29:10 -0000
@@ -807,5 +807,25 @@
                 ""                      // Russian
 #endif
         },
+        {       "Streaming TV",     // English
+                "Streaming TV",// Deutsch
+                "",                                                                                     // Slovenski
+                "",                                                                                     // Italiano
+                "",                                                                                     // Nederlands
+                "",                                                                                     // Português
+                "",                                                                                     // Français
+                "",                                                                                     // Norsk
+                "",                                                                                     // suomi
+                "",                                                                                     // Polski
+                "",                                                                                     // Español
+                "",                                                                                     // Ellinika
+                "",                                                                                     // Svenska
+                "",                                                                                     // Romaneste
+                "",                                                                                     // Magyar
+                "",                                                                                     // Catala
+#if VDRVERSNUM >= 10300
+                ""                      // Russian
+#endif
+        },
 	{ NULL }
 };
Index: streamdev-server.c
===================================================================
RCS file: /var/cvsroot/streamdev/streamdev-server.c,v
retrieving revision 1.2
diff -u -r1.2 streamdev-server.c
--- streamdev-server.c	9 May 2005 20:22:29 -0000	1.2
+++ streamdev-server.c	17 Apr 2006 16:29:10 -0000
@@ -6,10 +6,12 @@
  * $Id: streamdev-server.c,v 1.2 2005/05/09 20:22:29 lordjaxom 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,36 @@
 	return tr(DESCRIPTION);
 }
 
+const char *cPluginStreamdevServer::CommandLineHelp(void)
+{
+  static char *help_str=0;
+  
+  free(help_str);    //                                     for easier orientation, this is column 80|
+  asprintf(&help_str,"  -r CMD,   --remux=CMD    use CMD to remux stream\n"
+                     "                           (default: \"%s\")\n",
+                    g_szRemuxScript
+                    );
+  return help_str;
+}
+
+bool cPluginStreamdevServer::ProcessArgs(int argc, char *argv[])
+{
+  static struct option long_options[] = {
+      { "remux",    required_argument, NULL, 'r' },
+      { NULL }
+    };
+    
+  int c, option_index = 0;
+  while((c=getopt_long(argc,argv,"r:",long_options,&option_index))!=-1) {
+    switch (c) {
+      case 'r': g_szRemuxScript=optarg;break;
+      default:  return false;
+      }
+    }
+  return true;
+}
+
+
 bool cPluginStreamdevServer::Start(void) 
 {
 	i18n_name = Name();
@@ -55,9 +87,13 @@
 	cStreamdevServer::Destruct();
 }
 
-bool cPluginStreamdevServer::Active(void) 
+cString cPluginStreamdevServer::Active(void) 
 {
-	return cStreamdevServer::Active();
+	if(cStreamdevServer::Active())
+    {
+		return tr("Streaming TV");
+    }
+    return NULL;
 }
 
 const char *cPluginStreamdevServer::MainMenuEntry(void) 
Index: streamdev-server.h
===================================================================
RCS file: /var/cvsroot/streamdev/streamdev-server.h,v
retrieving revision 1.2
diff -u -r1.2 streamdev-server.h
--- streamdev-server.h	9 May 2005 20:22:29 -0000	1.2
+++ streamdev-server.h	17 Apr 2006 16:29:10 -0000
@@ -21,11 +21,14 @@
 	virtual const char *Description(void);
 	virtual bool Start(void);
 	virtual void Stop(void);
-	virtual bool Active(void);
+	virtual cString Active(void);
 	virtual const char *MainMenuEntry(void);
 	virtual cOsdObject *MainMenuAction(void);
 	virtual cMenuSetupPage *SetupMenu(void);
 	virtual bool SetupParse(const char *Name, const char *Value);
+
+	virtual bool ProcessArgs(int argc, char *argv[]);
+	virtual const char *CommandLineHelp(void);
 };
 
 #endif // VDR_STREAMDEVSERVER_H
Index: remux/extern.c
===================================================================
RCS file: /var/cvsroot/streamdev/remux/extern.c,v
retrieving revision 1.1
diff -u -r1.1 extern.c
--- remux/extern.c	12 Feb 2005 17:20:35 -0000	1.1
+++ remux/extern.c	17 Apr 2006 16:29:10 -0000
@@ -3,6 +3,9 @@
 #include <vdr/tools.h>
 #include <sys/types.h>
 #include <signal.h>
+#include <wait.h>
+
+const char *g_szRemuxScript = "externremux.sh";
 
 class cTSExt: public cThread {
 private:
@@ -10,7 +13,6 @@
 	bool               m_Active;
 	int                m_Process;
 	int                m_Inpipe, m_Outpipe;
-
 protected:
 	virtual void Action(void);
 
@@ -47,6 +49,7 @@
 	}
 
 	if (m_Process == 0) {
+
 		// child process
 		dup2(inpipe[0], STDIN_FILENO);
 		close(inpipe[1]);
@@ -57,9 +60,7 @@
         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");
+		execl("/bin/sh", "sh", "-c", g_szRemuxScript, NULL);
 		_exit(-1);
 	}
 
@@ -77,6 +78,7 @@
 	close(m_Outpipe);
 	close(m_Inpipe);
 	kill(m_Process, SIGTERM);
+	waitpid(m_Process, 0, 0);
 }
 
 void cTSExt::Action(void)
Index: remux/extern.h
===================================================================
RCS file: /var/cvsroot/streamdev/remux/extern.h,v
retrieving revision 1.1
diff -u -r1.1 extern.h
--- remux/extern.h	12 Feb 2005 17:20:35 -0000	1.1
+++ remux/extern.h	17 Apr 2006 16:29:10 -0000
@@ -4,6 +4,8 @@
 #include "remux/tsremux.h"
 #include <vdr/ringbuffer.h>
 
+extern const char *g_szRemuxScript;
+
 class cTSExt;
 
 class cExternRemux: public cTSRemux {


More information about the vdr mailing list