From 98e61b8f765314e5132da97797590703eb6484ea Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 2 Dec 2015 07:14:19 +0100 Subject: Merge patch from Francesco for VLC input Adds cache control and compressor --- src/VLCInput.cpp | 5 +++-- src/VLCInput.h | 13 ++++++++++++- src/dabplus-enc.cpp | 16 ++++++++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index 3a2e9ec..00d5fa4 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -138,7 +138,7 @@ int VLCInput::prepare() // VLC options char smem_options[512]; snprintf(smem_options, sizeof(smem_options), - "#transcode{acodec=s16l,samplerate=%d}:" + "#transcode{acodec=s16l,samplerate=%d,afilter=compressor}:" // We are using transcode because smem only support raw audio and // video formats "smem{" @@ -153,7 +153,8 @@ int VLCInput::prepare() char verb_options[512]; snprintf(verb_options, sizeof(verb_options), - "--verbose=%d", m_verbosity); + "--verbose=%d --network-caching %s --compressor-makeup-gain=%s ", + m_verbosity,(char *)m_cache.c_str(),(char *)m_gain.c_str()); const char * const vlc_args[] = { verb_options, diff --git a/src/VLCInput.h b/src/VLCInput.h index 6b0a0f4..326c6cd 100644 --- a/src/VLCInput.h +++ b/src/VLCInput.h @@ -44,11 +44,15 @@ class VLCInput VLCInput(const std::string& uri, int rate, unsigned channels, - unsigned verbosity) : + unsigned verbosity, + std::string& gain, + std::string& cache) : m_uri(uri), m_verbosity(verbosity), m_channels(channels), m_rate(rate), + m_cache(cache), + m_gain(gain), m_vlc(NULL) { } ~VLCInput() { cleanup(); } @@ -103,6 +107,13 @@ class VLCInput unsigned m_channels; int m_rate; + // Whether to enable network caching in VLC or not + std::string m_cache; + + // value for the VLC compressor filter + std::string m_gain; + + std::future icy_text_written; std::string m_nowplaying; std::string m_nowplaying_previous; diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp index 76d61fc..0664937 100644 --- a/src/dabplus-enc.cpp +++ b/src/dabplus-enc.cpp @@ -98,6 +98,8 @@ void usage(const char* name) { " For the VLC input:\n" #if HAVE_VLC " -v, --vlc-uri=uri Enable VLC input and use the URI given as source\n" + " -C, --vlc-cache=ms Enable VLC gain control, default 0\n" + " -g, --vlc-gain=db Enable VLC network cache\n" " -V Increase the VLC verbosity by one (can be given \n" " multiple times)\n" " -w, --write-icy-text=filename Write the ICY Text into the file, so that mot-encoder can read it.\n" @@ -252,6 +254,8 @@ int main(int argc, char *argv[]) // For the VLC input std::string vlc_uri = ""; std::string vlc_icytext_file = ""; + std::string vlc_gain = ""; + std::string vlc_cache = ""; unsigned verbosity = 0; // For the file output @@ -318,6 +322,8 @@ int main(int argc, char *argv[]) {"sbr", no_argument, 0, 1 }, {"ps", no_argument, 0, 2 }, {"fifo-silence", no_argument, 0, 3 }, + {"vlc_gain", required_argument, 0, 'g' }, + {"vlc_cache", required_argument, 0, 'C' }, {0, 0, 0, 0}, }; @@ -341,7 +347,7 @@ int main(int argc, char *argv[]) int index; while(ch != -1) { - ch = getopt_long(argc, argv, "aAhDlVb:c:f:i:j:k:o:r:d:p:P:s:v:w:", longopts, &index); + ch = getopt_long(argc, argv, "aAhDlVb:c:f:i:j:k:o:r:d:p:P:s:v:w:g:C:", longopts, &index); switch (ch) { case 0: // AAC-LC aot = AOT_DABPLUS_AAC_LC; @@ -426,6 +432,12 @@ int main(int argc, char *argv[]) case 'w': vlc_icytext_file = optarg; break; + case 'g': + vlc_gain = optarg; + break; + case 'C': + vlc_cache = optarg; + break; #else case 'v': case 'w': @@ -597,7 +609,7 @@ int main(int argc, char *argv[]) JackInput jack_in(jack_name, channels, sample_rate, queue); #endif #if HAVE_VLC - VLCInput vlc_in(vlc_uri, sample_rate, channels, verbosity); + VLCInput vlc_in(vlc_uri, sample_rate, channels, verbosity, vlc_gain, vlc_cache); #endif if (infile) { -- cgit v1.2.3