From: Steinar H. Gunderson Date: Sun, 17 Apr 2016 13:47:04 +0000 (+0200) Subject: Make it possible to override stream mux on the command line. X-Git-Tag: 1.3.0~99 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=77cc363c7e4db05eb8c1b7fef1a56e2ee308e0d4 Make it possible to override stream mux on the command line. --- diff --git a/defs.h b/defs.h index 0db1920..33eef45 100644 --- 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" }, \ diff --git a/flags.cpp b/flags.cpp index ffba269..0fe2236 100644 --- 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 1468564..308e310 100644 --- a/flags.h +++ b/flags.h @@ -3,6 +3,8 @@ #include +#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; diff --git a/httpd.cpp b/httpd.cpp index 518e77d..f6664b3 100644 --- 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); {