]> git.sesse.net Git - nageru/commitdiff
Make the HTTP port settable.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 28 Oct 2017 11:44:27 +0000 (13:44 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 28 Oct 2017 11:44:27 +0000 (13:44 +0200)
defs.h
flags.cpp
flags.h
kaeru.cpp
mixer.cpp

diff --git a/defs.h b/defs.h
index 9a3fce7b0e45011a93f84890eaf5fe7dfbed9c4d..a5679afcfad953e558cf5e9683dee355d6f1b8a7 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -18,6 +18,7 @@
 #define LOCAL_DUMP_PREFIX "record-"
 #define LOCAL_DUMP_SUFFIX ".nut"
 #define DEFAULT_STREAM_MUX_NAME "nut"  // Only for HTTP. Local dump guesses from LOCAL_DUMP_SUFFIX.
+#define DEFAULT_HTTPD_PORT 9095
 #define MUX_OPTS { \
        /* Make seekable .mov files. */ \
        { "movflags", "empty_moov+frag_keyframe+default_base_moof" }, \
index c65903abacda4fc7b98911f27dd165569b1bfcd8..41365c5284c2d1d5a17776fcb6afef4080fae483 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -33,6 +33,7 @@ enum LongOption {
        OPTION_HTTP_COARSE_TIMEBASE,
        OPTION_HTTP_AUDIO_CODEC,
        OPTION_HTTP_AUDIO_BITRATE,
+       OPTION_HTTP_PORT,
        OPTION_NO_TRANSCODE_AUDIO,
        OPTION_FLAT_AUDIO,
        OPTION_GAIN_STAGING,
@@ -108,6 +109,8 @@ void usage(Program program)
        fprintf(stderr, "      --http-audio-bitrate=KBITS  audio codec bit rate to use for HTTP streams\n");
        fprintf(stderr, "                                  (default is %d, ignored unless --http-audio-codec is set)\n",
                DEFAULT_AUDIO_OUTPUT_BIT_RATE / 1000);
+       fprintf(stderr, "      --http-port=PORT            which port to use for the built-in HTTP server\n");
+       fprintf(stderr, "                                  (default is %d)\n", DEFAULT_HTTPD_PORT);
        if (program == PROGRAM_KAERU) {
                fprintf(stderr, "      --no-transcode-audio        copy encoded audio raw from the source stream\n");
                fprintf(stderr, "                                    (requires --http-audio-codec= to be set)\n");
@@ -187,6 +190,7 @@ void parse_flags(Program program, int argc, char * const argv[])
                { "http-coarse-timebase", no_argument, 0, OPTION_HTTP_COARSE_TIMEBASE },
                { "http-audio-codec", required_argument, 0, OPTION_HTTP_AUDIO_CODEC },
                { "http-audio-bitrate", required_argument, 0, OPTION_HTTP_AUDIO_BITRATE },
+               { "http-port", required_argument, 0, OPTION_HTTP_PORT },
                { "no-transcode-audio", no_argument, 0, OPTION_NO_TRANSCODE_AUDIO },
                { "flat-audio", no_argument, 0, OPTION_FLAT_AUDIO },
                { "gain-staging", required_argument, 0, OPTION_GAIN_STAGING },
@@ -294,6 +298,9 @@ void parse_flags(Program program, int argc, char * const argv[])
                case OPTION_HTTP_AUDIO_BITRATE:
                        global_flags.stream_audio_codec_bitrate = atoi(optarg) * 1000;
                        break;
+               case OPTION_HTTP_PORT:
+                       global_flags.http_port = atoi(optarg);
+                       break;
                case OPTION_NO_TRANSCODE_AUDIO:
                        global_flags.transcode_audio = false;
                        break;
diff --git a/flags.h b/flags.h
index e6bf08ecf576c4612d14e10f52dc4c671d63844e..83d1894b472e67a0b09688e472f2bb0e055b5dc2 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -54,6 +54,7 @@ struct Flags {
        double output_buffer_frames = 6.0;
        double output_slop_frames = 0.5;
        int max_input_queue_frames = 6;
+       int http_port = DEFAULT_HTTPD_PORT;
        bool display_timecode_in_stream = false;
        bool display_timecode_on_stdout = false;
        bool ten_bit_input = false;
index 425870ed3bd839cebdcf378378bcfa69adf18521..6d98cce1791992a47df17663b77d5159169061fd 100644 (file)
--- a/kaeru.cpp
+++ b/kaeru.cpp
@@ -208,7 +208,7 @@ int main(int argc, char *argv[])
 
        BasicStats basic_stats(/*verbose=*/false);
        global_basic_stats = &basic_stats;
-       httpd.start(9095);
+       httpd.start(global_flags.http_port);
 
        signal(SIGUSR1, adjust_bitrate);
        signal(SIGUSR2, adjust_bitrate);
index 6ec12e88357b1430ef922cf3dad57d9407cd2e66..f45880d321be6d2a1c17c5a61b7ba0babc28e846 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -353,7 +353,7 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
        theme.reset(new Theme(global_flags.theme_filename, global_flags.theme_dirs, resource_pool.get(), num_cards));
 
        // Start listening for clients only once VideoEncoder has written its header, if any.
-       httpd.start(9095);
+       httpd.start(global_flags.http_port);
 
        // First try initializing the then PCI devices, then USB, then
        // fill up with fake cards until we have the desired number of cards.