From 319172854c238795585ce42c6fb357833b6b2bda Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 10 Jan 2016 18:18:07 +0100 Subject: Enable VLC compressor only if required --- src/VLCInput.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index 4ec9208..f527f20 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -136,9 +136,17 @@ int VLCInput::prepare() // VLC options + std::stringstream transcode_options_ss; + transcode_options_ss << "acodec=s16l"; + transcode_options_ss << ",samplerate=" << m_rate; + if (not m_gain.empty()) { + transcode_options_ss << ",afilter=compressor"; + } + string transcode_options = transcode_options_ss.str(); + char smem_options[512]; snprintf(smem_options, sizeof(smem_options), - "#transcode{acodec=s16l,samplerate=%d,afilter=compressor}:" + "#transcode{%s}:" // We are using transcode because smem only support raw audio and // video formats "smem{" @@ -146,7 +154,7 @@ int VLCInput::prepare() "audio-prerender-callback=%lld," "audio-data=%lld" "}", - m_rate, + transcode_options.c_str(), handleStream_address, prepareRender_address, (long long int)(intptr_t)this); -- cgit v1.2.3