<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 15 Nov 2017, at 12:15, Frediano Ziglio <<a href="mailto:fziglio@redhat.com" class="">fziglio@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">From: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="">dinechin@redhat.com</a>><br class=""><br class="">Signed-off-by: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="">dinechin@redhat.com</a>><br class="">---<br class="">include/spice-streaming-agent/plugin.hpp |  6 ++++++<br class="">src/concrete-agent.cpp                   | 11 +++++++++++<br class="">src/concrete-agent.hpp                   |  1 +<br class="">src/spice-streaming-agent.cpp            | 23 +++++++++++------------<br class="">4 files changed, 29 insertions(+), 12 deletions(-)<br class=""><br class="">diff --git a/include/spice-streaming-agent/plugin.hpp<br class="">b/include/spice-streaming-agent/plugin.hpp<br class="">index 41ad11f..83980d7 100644<br class="">--- a/include/spice-streaming-agent/plugin.hpp<br class="">+++ b/include/spice-streaming-agent/plugin.hpp<br class="">@@ -56,6 +56,12 @@ struct Settings<br class="">    unsigned    quality         =      80; // Normalized in 0-100 (100=high)<br class="">    unsigned    avg_bitrate     = 3000000; // Target average bitrate in bps<br class="">    unsigned    max_bitrate     = 8000000; // Target maximum bitrate<br class="">+<br class="">+#define STANDARD_OPTIONS_USAGE                                          \<br class="">+    "framerate  = [1-240]       Number of frames per second\n"          \<br class="">+    "quality    = [1-100]       Normalized quality, 100 = high\n"       \<br class="">+    "avg_bitrate= [1-10000000]  Average bits per second for stream\n"   \<br class="">+    "max_bitrate= [1-10000000]  Maximum bits per second for stream\n"<br class="">};<br class=""><br class="">/*!<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Why putting this in the public header?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></div></blockquote><div><br class=""></div><div>The initial idea was to make sure plugins were actually showing the</div><div>same message for common options. Thinking more about output</div><div>formatting, I realized it was stupid to emit the same usage info</div><div>for every plugin, so I am in the process of changing that.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I don't see any point for the plugins to know that information and</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">if they starts using it the value can become an ABI.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Also these defines are global (not inside any namespace) so the</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">"STANDARD_OPTIONS_USAGE" would prevent the name reuse.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></div></blockquote><div><br class=""></div><div>You are right, and I found a better way to output the hierarchy of</div><div>usage information (and also offer a better format).</div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp<br class="">index 59f11b2..377c934 100644<br class="">--- a/src/concrete-agent.cpp<br class="">+++ b/src/concrete-agent.cpp<br class="">@@ -140,6 +140,17 @@ FrameCapture *ConcreteAgent::GetBestFrameCapture()<br class="">    return nullptr;<br class="">}<br class=""><br class="">+void ConcreteAgent::PluginsUsage()<br class="">+{<br class="">+    for (auto &plugin: plugins) {<br class="">+        printf("\n"<br class="">+               "settings for %s:\n"<br class="">+               "%s",<br class="">+               plugin->Name(),<br class="">+               plugin->Usage());<br class="">+    }<br class="">+}<br class="">+<br class="">void ConcreteAgent::ApplyOptions(Plugin *plugin)<br class="">{<br class="">    bool usage = false;<br class="">diff --git a/src/concrete-agent.hpp b/src/concrete-agent.hpp<br class="">index b3d4e06..eeb43f8 100644<br class="">--- a/src/concrete-agent.hpp<br class="">+++ b/src/concrete-agent.hpp<br class="">@@ -34,6 +34,7 @@ public:<br class="">    void LoadPlugins(const char *directory);<br class="">    void ApplyOptions(Plugin *plugin);<br class="">    FrameCapture *GetBestFrameCapture();<br class="">+    void PluginsUsage();<br class=""><br class="">private:<br class="">    void LoadPlugin(const char *plugin_filename);<br class="">diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp<br class="">index d5984bc..71a36e1 100644<br class="">--- a/src/spice-streaming-agent.cpp<br class="">+++ b/src/spice-streaming-agent.cpp<br class="">@@ -269,18 +269,16 @@ static void register_interrupts(void)<br class=""><br class="">static void usage(const char *progname)<br class="">{<br class="">-    printf("usage: %s <options>\n", progname);<br class="">-    printf("options are:\n");<br class="">-    printf("\t-p portname  -- virtio-serial port to use\n");<br class="">-    printf("\t-i accept commands from stdin\n");<br class="">-    printf("\t-l file -- log frames to file\n");<br class="">-    printf("\t--log-binary -- log binary frames (following -l)\n");<br class="">-    printf("\t-d -- enable debug logs\n");<br class="">-    printf("\t-c variable=value -- change settings\n");<br class="">-    printf("\t\tframerate = 1-100 (check 10,20,30,40,50,60)\n");<br class="">-    printf("\n");<br class="">-    printf("\t-h or --help     -- print this help message\n");<br class="">-<br class="">+    printf("usage: %s <options>\n"<br class="">+           "options are:\n"<br class="">+           "\t-p portname  -- virtio-serial port to use\n"<br class="">+           "\t-i accept commands from stdin\n"<br class="">+           "\t-l file -- log frames to file\n"<br class="">+           "\t--log-binary -- log binary frames (following -l)\n"<br class="">+           "\t-d -- enable debug logs\n"<br class="">+           "\t-c variable=value -- change settings (see below)\n"<br class="">+           "\t-h or --help     -- print this help message\n", progname);<br class="">+    agent.PluginsUsage();<br class="">    exit(1);<br class="">}<br class=""><br class="">@@ -474,6 +472,7 @@ int main(int argc, char* argv[])<br class="">            setlogmask(logmask);<br class="">            break;<br class=""><span class="Apple-tab-span" style="white-space: pre;">      </span>case 'h':<br class="">+            agent.LoadPlugins(PLUGINSDIR);<br class=""><span class="Apple-tab-span" style="white-space: pre;">     </span><span class="Apple-converted-space"> </span>   usage(argv[0]);<br class=""><span class="Apple-tab-span" style="white-space: pre;">     </span><span class="Apple-converted-space"> </span>   break;<br class=""><span class="Apple-tab-span" style="white-space: pre;">      </span>}<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Frediano</span></div></div></blockquote></div><br class=""></body></html>