From: Steinar H. Gunderson Date: Sat, 30 Apr 2016 23:50:18 +0000 (+0200) Subject: Add a flag to disable ALSA monitoring output. X-Git-Tag: 1.3.0~44 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a29ee5d5544e6a5613b14ca31d4107b8846859c5;p=nageru Add a flag to disable ALSA monitoring output. --- diff --git a/flags.cpp b/flags.cpp index c2dd153..f782c76 100644 --- a/flags.cpp +++ b/flags.cpp @@ -34,6 +34,7 @@ void usage() fprintf(stderr, " --http-coarse-timebase use less timebase for HTTP (recommended for muxers\n"); fprintf(stderr, " that handle large pts poorly, like e.g. MP4)\n"); fprintf(stderr, " --flat-audio start with most audio processing turned off\n"); + fprintf(stderr, " --disable-alsa-output disable audio monitoring via ALSA\n"); fprintf(stderr, " --no-flush-pbos do not explicitly signal texture data uploads\n"); fprintf(stderr, " (will give display corruption, but makes it\n"); fprintf(stderr, " possible to run with apitrace in real time)\n"); @@ -58,6 +59,7 @@ void parse_flags(int argc, char * const argv[]) { "http-audio-codec", required_argument, 0, 1006 }, { "http-audio-bitrate", required_argument, 0, 1007 }, { "flat-audio", no_argument, 0, 1002 }, + { "disable-alsa-output", no_argument, 0, 1014 }, { "no-flush-pbos", no_argument, 0, 1003 }, { 0, 0, 0, 0 } }; @@ -114,6 +116,9 @@ void parse_flags(int argc, char * const argv[]) case 1002: global_flags.flat_audio = true; break; + case 1014: + global_flags.enable_alsa_output = false; + break; case 1003: global_flags.flush_pbos = false; break; diff --git a/flags.h b/flags.h index 0f27cf2..0c01ab1 100644 --- a/flags.h +++ b/flags.h @@ -22,6 +22,7 @@ struct Flags { int x264_bitrate = DEFAULT_X264_OUTPUT_BIT_RATE; // In kilobit/sec. int x264_vbv_max_bitrate = -1; // In kilobits. 0 = no limit, -1 = same as (CBR). int x264_vbv_buffer_size = -1; // In kilobits. 0 = one-frame VBV, -1 = same as (one-second VBV). + bool enable_alsa_output = true; }; extern Flags global_flags; diff --git a/mixer.cpp b/mixer.cpp index d84754e..cbc14f2 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -256,7 +256,9 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards) // and there's a limit to how important the peak meter is. peak_resampler.setup(OUTPUT_FREQUENCY, OUTPUT_FREQUENCY * 4, /*num_channels=*/2, /*hlen=*/16, /*frel=*/1.0); - alsa.reset(new ALSAOutput(OUTPUT_FREQUENCY, /*num_channels=*/2)); + if (global_flags.enable_alsa_output) { + alsa.reset(new ALSAOutput(OUTPUT_FREQUENCY, /*num_channels=*/2)); + } } Mixer::~Mixer()