]> git.sesse.net Git - nageru/commitdiff
Support changing the HTTP port.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 31 Oct 2018 23:45:17 +0000 (00:45 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 31 Oct 2018 23:46:12 +0000 (00:46 +0100)
flags.cpp
flags.h
frames/.empty [deleted file]
main.cpp

index 1a4c08e5bfc25cbfb37324ebb048594751f35f8f..4c7537093982671a4775f0b20d7bd7b7c6d0b569 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -14,7 +14,8 @@ Flags global_flags;
 // Long options that have no corresponding short option.
 enum LongOption {
        OPTION_HELP = 1000,
-       OPTION_SLOW_DOWN_INPUT = 1001
+       OPTION_SLOW_DOWN_INPUT = 1001,
+       OPTION_HTTP_PORT = 1002
 };
 
 void usage()
@@ -29,6 +30,7 @@ void usage()
        fprintf(stderr, "                                  3 = good (realtime 720p on GTX 970 or so)\n");
        fprintf(stderr, "                                  4 = best (not realtime on any current GPU)\n");
        fprintf(stderr, "  -d, --working-directory DIR     where to store frames and database\n");
+       fprintf(stderr, "      --http-port PORT            which port to listen on for output\n");
 }
 
 void parse_flags(int argc, char * const argv[])
@@ -38,6 +40,7 @@ void parse_flags(int argc, char * const argv[])
                { "slow-down-input", no_argument, 0, OPTION_SLOW_DOWN_INPUT },
                { "interpolation-quality", required_argument, 0, 'q' },
                { "working-directory", required_argument, 0, 'd' },
+               { "http-port", required_argument, 0, OPTION_HTTP_PORT },
                { 0, 0, 0, 0 }
        };
        for ( ;; ) {
@@ -57,6 +60,9 @@ void parse_flags(int argc, char * const argv[])
                case 'd':
                        global_flags.working_directory = optarg;
                        break;
+               case OPTION_HTTP_PORT:
+                       global_flags.http_port = atoi(optarg);
+                       break;
                case OPTION_HELP:
                        usage();
                        exit(0);
diff --git a/flags.h b/flags.h
index 8b2563c0f6017b9af04d1a424bb47e450a3bb4c7..5e9d34b2c24b969e36859343c64675c46e2ae234 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -3,11 +3,14 @@
 
 #include <string>
 
+#include "defs.h"
+
 struct Flags {
        std::string stream_source;
        std::string working_directory = ".";
        bool slow_down_input = false;
        int interpolation_quality = 2;
+       uint16_t http_port = DEFAULT_HTTPD_PORT;
 };
 extern Flags global_flags;
 
diff --git a/frames/.empty b/frames/.empty
deleted file mode 100644 (file)
index e69de29..0000000
index 229bbf1c8e416ac3705907b7783a375d486b848f..1d29735f92a2180f8734e4793571a15befbe50c8 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
        main_window.show();
 
        global_httpd->add_endpoint("/queue_status", bind(&MainWindow::get_queue_status, &main_window), HTTPD::NO_CORS_POLICY);
-       global_httpd->start(DEFAULT_HTTPD_PORT);
+       global_httpd->start(global_flags.http_port);
 
        init_jpeg_vaapi();