Description: Set VNSI server port via commandline option
 Running multiple VDR instances on a single machine with different
 configuration due to child lock etc, the VNSI server plugin must
 be allowed to utilize different streaming ports.
 This patch adds the configuration option -P which takes
 the port VNSI server answers to.
 .
 vdr-plugin-vnsiserver (1:0.9.1.git20130320-5yavdr4~precise) precise; urgency=medium
 .
   * Add VNSI port configuration via commandline
Author: Peer Oliver Schmidt <peer.oliver.schmidt@linuxmce.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- vdr-plugin-vnsiserver-0.9.1.git20130320.orig/vnsi.c
+++ vdr-plugin-vnsiserver-0.9.1.git20130320/vnsi.c
@@ -40,7 +40,7 @@ cPluginVNSIServer::~cPluginVNSIServer()
 
 const char *cPluginVNSIServer::CommandLineHelp(void)
 {
-    return "  -t n, --timeout=n      stream data timeout in seconds (default: 10)\n";
+    return "  -t n, --timeout=n      stream data timeout in seconds (default: 10)\n  -P n, --port=n         VNSI stream port (default: 34890)\n";
 }
 
 bool cPluginVNSIServer::ProcessArgs(int argc, char *argv[])
@@ -48,15 +48,18 @@ bool cPluginVNSIServer::ProcessArgs(int
   // Implement command line argument processing here if applicable.
   static struct option long_options[] = {
        { "timeout",  required_argument, NULL, 't' },
+       { "port",  required_argument, NULL, 'P' },
        { NULL,       no_argument,       NULL,  0  }
      };
 
   int c;
 
-  while ((c = getopt_long(argc, argv, "t:", long_options, NULL)) != -1) {
+  while ((c = getopt_long(argc, argv, "t:P:", long_options, NULL)) != -1) {
         switch (c) {
           case 't': if(optarg != NULL) VNSIServerConfig.stream_timeout = atoi(optarg);
-                    break;
+                              break;
+          case 'P': if(optarg != NULL) VNSIServerConfig.listen_port = atoi(optarg);
+                              break;
           default:  return false;
           }
         }
