From 61b5ba527efef75565336dfa87f0a2432dd5f50b Mon Sep 17 00:00:00 2001
From: "Matthias P. Braendli" <matthias.braendli@mpb.li>
Date: Fri, 4 Mar 2016 21:02:15 +0100
Subject: Add -L option to give arbitrary options to VLC

---
 src/VLCInput.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'src/VLCInput.cpp')

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++) {
-- 
cgit v1.2.3