diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/VLCInput.cpp | 14 | ||||
-rw-r--r-- | src/VLCInput.h | 15 | ||||
-rw-r--r-- | src/dabplus-enc.cpp | 13 |
3 files changed, 33 insertions, 9 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp index f527f20..468ef70 100644 --- a/src/VLCInput.cpp +++ b/src/VLCInput.cpp @@ -159,8 +159,8 @@ int VLCInput::prepare() prepareRender_address, (long long int)(intptr_t)this); - - const char* vlc_args[6]; +#define VLC_ARGS_LEN 32 + const char* vlc_args[VLC_ARGS_LEN]; size_t arg_ix = 0; std::stringstream arg_verbose; arg_verbose << "--verbose=" << m_verbosity; @@ -185,6 +185,16 @@ int VLCInput::prepare() vlc_args[arg_ix++] = "--sout"; vlc_args[arg_ix++] = smem_options; // Stream to memory + for (const auto& opt : m_additional_opts) { + if (arg_ix < VLC_ARGS_LEN) { + vlc_args[arg_ix++] = opt.c_str(); + } + else { + fprintf(stderr, "Too many VLC options given"); + return 1; + } + } + if (m_verbosity) { fprintf(stderr, "Initialising VLC with options:\n"); for (size_t i = 0; i < arg_ix; i++) { diff --git a/src/VLCInput.h b/src/VLCInput.h index 27d6237..d583008 100644 --- a/src/VLCInput.h +++ b/src/VLCInput.h @@ -49,12 +49,14 @@ class VLCInput unsigned channels, unsigned verbosity, std::string& gain, - std::string& cache) : + std::string& cache, + std::vector<std::string>& additional_opts) : m_uri(uri), m_verbosity(verbosity), m_channels(channels), m_rate(rate), m_cache(cache), + m_additional_opts(additional_opts), m_gain(gain), m_vlc(nullptr), m_mp(nullptr) { } @@ -106,6 +108,9 @@ class VLCInput // Whether to enable network caching in VLC or not std::string m_cache; + // Given as-is to libvlc + std::vector<std::string> m_additional_opts; + // value for the VLC compressor filter std::string m_gain; @@ -130,8 +135,9 @@ class VLCInputDirect : public VLCInput unsigned channels, unsigned verbosity, std::string& gain, - std::string& cache) : - VLCInput(uri, rate, channels, verbosity, gain, cache) {} + std::string& cache, + std::vector<std::string>& additional_opts) : + VLCInput(uri, rate, channels, verbosity, gain, cache, additional_opts) {} /* Read exactly length bytes into buf. * Blocks if not enough data is available, @@ -153,8 +159,9 @@ class VLCInputThreaded : public VLCInput unsigned verbosity, std::string& gain, std::string& cache, + std::vector<std::string>& additional_opts, SampleQueue<uint8_t>& queue) : - VLCInput(uri, rate, channels, verbosity, gain, cache), + VLCInput(uri, rate, channels, verbosity, gain, cache, additional_opts), m_fault(false), m_running(false), m_queue(queue) {} diff --git a/src/dabplus-enc.cpp b/src/dabplus-enc.cpp index d0130fd..0f34d65 100644 --- a/src/dabplus-enc.cpp +++ b/src/dabplus-enc.cpp @@ -103,6 +103,8 @@ void usage(const char* name) { " much too loud.\n" " -V Increase the VLC verbosity by one (can be given \n" " multiple times)\n" + " -L OPTION Give an additional options to VLC (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" #else " The VLC input was disabled at compile-time\n" @@ -255,6 +257,7 @@ int main(int argc, char *argv[]) std::string vlc_icytext_file = ""; std::string vlc_gain = ""; std::string vlc_cache = ""; + std::vector<std::string> vlc_additional_opts; unsigned verbosity = 0; // For the file output @@ -312,6 +315,7 @@ int main(int argc, char *argv[]) {"vlc-cache", required_argument, 0, 'C'}, {"vlc-gain", required_argument, 0, 'g'}, {"vlc-uri", required_argument, 0, 'v'}, + {"vlc-opt", required_argument, 0, 'L'}, {"write-icy-text", required_argument, 0, 'w'}, {"aaclc", no_argument, 0, 0 }, {"afterburner", no_argument, 0, 'a'}, @@ -346,7 +350,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:g:C:", longopts, &index); + ch = getopt_long(argc, argv, "aAhDlVb:c:f:i:j:k:L:o:r:d:p:P:s:v:w:g:C:", longopts, &index); switch (ch) { case 0: // AAC-LC aot = AOT_DABPLUS_AAC_LC; @@ -437,6 +441,9 @@ int main(int argc, char *argv[]) case 'C': vlc_cache = optarg; break; + case 'L': + vlc_additional_opts.push_back(optarg); + break; #else case 'v': case 'w': @@ -608,8 +615,8 @@ int main(int argc, char *argv[]) JackInput jack_in(jack_name, channels, sample_rate, queue); #endif #if HAVE_VLC - VLCInputDirect vlc_in_direct(vlc_uri, sample_rate, channels, verbosity, vlc_gain, vlc_cache); - VLCInputThreaded vlc_in_threaded(vlc_uri, sample_rate, channels, verbosity, vlc_gain, vlc_cache, queue); + VLCInputDirect vlc_in_direct(vlc_uri, sample_rate, channels, verbosity, vlc_gain, vlc_cache, vlc_additional_opts); + VLCInputThreaded vlc_in_threaded(vlc_uri, sample_rate, channels, verbosity, vlc_gain, vlc_cache, vlc_additional_opts, queue); #endif if (infile) { |