aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/VLCInput.cpp14
-rw-r--r--src/VLCInput.h15
-rw-r--r--src/dabplus-enc.cpp13
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 5139b89..ffa9258 100644
--- a/src/VLCInput.h
+++ b/src/VLCInput.h
@@ -47,12 +47,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) { }
@@ -104,6 +106,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;
@@ -128,8 +133,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,
@@ -151,8 +157,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 42a58f9..5c2f1cb 100644
--- a/src/dabplus-enc.cpp
+++ b/src/dabplus-enc.cpp
@@ -120,6 +120,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"
@@ -281,6 +283,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
@@ -343,6 +346,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 },
{"dab", no_argument, 0, 'a'},
@@ -377,7 +381,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;
@@ -472,6 +476,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':
@@ -711,8 +718,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) {