[vlc-devel] [PATCH 2/2] input: add record start option

Francois Cartegnie fcvlcdev at free.fr
Tue Oct 13 21:29:16 CEST 2020


Because there's no way to start a native recording
from the really start without building an sout chain
---
 src/input/input.c   | 6 ++++++
 src/input/var.c     | 1 +
 src/libvlc-module.c | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/src/input/input.c b/src/input/input.c
index 1f5ac9189a..3adcaaef9f 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1334,6 +1334,12 @@ static int Init( input_thread_t * p_input )
             vlc_value_t val = { .f_float = f_rate };
             input_ControlPushHelper( p_input, INPUT_CONTROL_SET_RATE, &val );
         }
+
+        if( priv->master->b_can_stream_record &&
+            var_GetBool( p_input, "input-record-start" ) )
+        {
+            ToggleRecording(p_input, true);
+        }
     }
 
     if( !priv->b_preparsing && priv->p_sout )
diff --git a/src/input/var.c b/src/input/var.c
index b5de58afb6..2c056ddcf0 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -103,6 +103,7 @@ void input_ConfigVarInit ( input_thread_t *p_input )
     }
 
     /* */
+    var_Create( p_input, "input-record-start", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Create( p_input, "input-record-native", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
 
     /* */
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index aea70ed995..b7efb33b85 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -713,6 +713,9 @@ static const char *const ppsz_prefres[] = {
     "When possible, the input stream will be recorded instead of using " \
     "the stream output module" )
 
+#define INPUT_RECORD_START_TEXT N_("Start recording immediately")
+#define INPUT_RECORD_START_LONGTEXT N_("Record from start, do not wait for toggle action")
+
 #define INPUT_TIMESHIFT_PATH_TEXT N_("Timeshift directory")
 #define INPUT_TIMESHIFT_PATH_LONGTEXT N_( \
     "Directory used to store the timeshift temporary files." )
@@ -2001,6 +2004,7 @@ vlc_module_begin ()
                   INPUT_RECORD_PATH_TEXT, INPUT_RECORD_PATH_LONGTEXT)
     add_bool( "input-record-native", true, INPUT_RECORD_NATIVE_TEXT,
               INPUT_RECORD_NATIVE_LONGTEXT, true )
+    add_bool( "input-record-start", false, INPUT_RECORD_START_TEXT, INPUT_RECORD_START_LONGTEXT, true )
 
     add_directory("input-timeshift-path", NULL,
                   INPUT_TIMESHIFT_PATH_TEXT, INPUT_TIMESHIFT_PATH_LONGTEXT)
-- 
2.26.2



More information about the vlc-devel mailing list