]> git.sesse.net Git - nageru/commitdiff
Make it possible to override stream mux on the command line.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Apr 2016 13:47:04 +0000 (15:47 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Apr 2016 20:04:00 +0000 (22:04 +0200)
defs.h
flags.cpp
flags.h
httpd.cpp

diff --git a/defs.h b/defs.h
index 0db1920ee7883c9cf5cc7cbd3af6fc9725238a2a..33eef45419d89ad3a7e0e4bc5007c3384b82e4b3 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -16,7 +16,7 @@
 
 #define LOCAL_DUMP_PREFIX "record-"
 #define LOCAL_DUMP_SUFFIX ".nut"
-#define STREAM_MUX_NAME "nut"
+#define DEFAULT_STREAM_MUX_NAME "nut"  // Only for HTTP. Local dump guesses from LOCAL_DUMP_SUFFIX.
 #define MUX_OPTS { \
        /* Make seekable .mov files. */ \
        { "movflags", "empty_moov+frag_keyframe+default_base_moof" }, \
index ffba26961e082c29ee2b8d293dbca5007c6cac13..0fe2236e44b51801808eee8228d7652e7798d6e8 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -16,6 +16,7 @@ void usage()
        fprintf(stderr, "  -v, --va-display=SPEC           VA-API device for H.264 encoding\n");
        fprintf(stderr, "                                    ($DISPLAY spec or /dev/dri/render* path)\n");
        fprintf(stderr, "      --http-uncompressed-video   send uncompressed NV12 video to HTTP clients\n");
+       fprintf(stderr, "      --http-mux=NAME             mux to use for HTTP streams (default " DEFAULT_STREAM_MUX_NAME ")\n");
        fprintf(stderr, "      --flat-audio                start with most audio processing turned off\n");
        fprintf(stderr, "      --no-flush-pbos             do not explicitly signal texture data uploads\n");
        fprintf(stderr, "                                    (will give display corruption, but makes it\n");
@@ -30,6 +31,7 @@ void parse_flags(int argc, char * const argv[])
                { "theme", required_argument, 0, 't' },
                { "va-display", required_argument, 0, 1000 },
                { "http-uncompressed-video", no_argument, 0, 1001 },
+               { "http-mux", required_argument, 0, 1004 },
                { "flat-audio", no_argument, 0, 1002 },
                { "no-flush-pbos", no_argument, 0, 1003 },
                { 0, 0, 0, 0 }
@@ -54,6 +56,9 @@ void parse_flags(int argc, char * const argv[])
                case 1001:
                        global_flags.uncompressed_video_to_http = true;
                        break;
+               case 1004:
+                       global_flags.stream_mux_name = optarg;
+                       break;
                case 1002:
                        global_flags.flat_audio = true;
                        break;
diff --git a/flags.h b/flags.h
index 146856460fff81bab91ea473401a3afa707cab58..308e3103bfd6be6c068406f166971bc24cc17994 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -3,6 +3,8 @@
 
 #include <string>
 
+#include "defs.h"
+
 struct Flags {
        int num_cards = 2;
        std::string va_display;
@@ -10,6 +12,7 @@ struct Flags {
        std::string theme_filename = "theme.lua";
        bool flat_audio = false;
        bool flush_pbos = true;
+       std::string stream_mux_name = DEFAULT_STREAM_MUX_NAME;
 };
 extern Flags global_flags;
 
index 518e77dc4cafa0a39c689a7be299b0f65da03535..f6664b3df900879fe89a6f14c7c72160e7293ed2 100644 (file)
--- a/httpd.cpp
+++ b/httpd.cpp
@@ -92,7 +92,7 @@ int HTTPD::answer_to_connection(MHD_Connection *connection,
                                const char *version, const char *upload_data,
                                size_t *upload_data_size, void **con_cls)
 {
-       AVOutputFormat *oformat = av_guess_format(STREAM_MUX_NAME, nullptr, nullptr);
+       AVOutputFormat *oformat = av_guess_format(global_flags.stream_mux_name.c_str(), nullptr, nullptr);
        assert(oformat != nullptr);
        HTTPD::Stream *stream = new HTTPD::Stream(oformat, width, height);
        {