[PATCH v2 spice-streaming-agent] Allow to set plugins directory via command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Could be useful mainly for testing purposes, it allows to load
plugins that aren't installed in the default plugins folder.
To set different plugins directory use --plugins-dir=

Signed-off-by: Snir Sheriber <ssheribe@xxxxxxxxxx>
---
 src/spice-streaming-agent.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 267b76e..9c04576 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -283,6 +283,7 @@ static void usage(const char *progname)
     printf("\t-p portname  -- virtio-serial port to use\n");
     printf("\t-l file -- log frames to file\n");
     printf("\t--log-binary -- log binary frames (following -l)\n");
+    printf("\t--plugins-dir=path -- change plugins directory\n");
     printf("\t-d -- enable debug logs\n");
     printf("\t-c variable=value -- change settings\n");
     printf("\t\tframerate = 1-100 (check 10,20,30,40,50,60)\n");
@@ -445,10 +446,15 @@ done:
 int main(int argc, char* argv[])
 {
     const char *streamport = "/dev/virtio-ports/com.redhat.stream.0";
-    char opt;
+    int opt;
     const char *log_filename = NULL;
     int logmask = LOG_UPTO(LOG_WARNING);
+    const char *pluginsdir = PLUGINSDIR;
+    enum {
+        OPT_PLUGINS_DIR = UCHAR_MAX+1
+    };
     struct option long_options[] = {
+        { "plugins-dir", required_argument, NULL, OPT_PLUGINS_DIR},
         { "log-binary", no_argument, &log_binary, 1},
         { "help", no_argument, NULL, 'h'},
         { 0, 0, 0, 0}
@@ -464,6 +470,10 @@ int main(int argc, char* argv[])
         case 0:
             /* Handle long options if needed */
             break;
+        case OPT_PLUGINS_DIR:
+            if (optarg)
+                pluginsdir = optarg;
+            break;
         case 'p':
             streamport = optarg;
             break;
@@ -493,7 +503,7 @@ int main(int argc, char* argv[])
     // register built-in plugins
     MjpegPlugin::Register(&agent);
 
-    agent.LoadPlugins(PLUGINSDIR);
+    agent.LoadPlugins(pluginsdir);
 
     register_interrupts();
 
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]