[vlc-commits] [Git][videolan/vlc][master] 3 commits: cmdline: read the "high-priority" option early

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Aug 19 12:57:39 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d48ad7b4 by Steve Lhomme at 2022-08-19T11:14:19+00:00
cmdline: read the "high-priority" option early

The value of the command line parameter will need to be known early, when we
call vlc_threads_setup().

- - - - -
e2120bb3 by Steve Lhomme at 2022-08-19T11:14:19+00:00
cmdline: read the "clock-source" option early

The value of the command line parameter will need to be known early, when we
call vlc_threads_setup().

- - - - -
d325c08d by Steve Lhomme at 2022-08-19T11:14:19+00:00
cmdline: always call config_CmdLineEarlyScan()

But don't use the dynamic plugin parameters when they should not exist.

Before it was only called when HAVE_DYNAMIC_PLUGINS is defined because there
were only parameters for that, but now there is more (on Windows for now).

- - - - -


3 changed files:

- src/config/cmdline.c
- src/config/configuration.h
- src/libvlc.c


Changes:

=====================================
src/config/cmdline.c
=====================================
@@ -40,7 +40,6 @@
 
 #include <assert.h>
 
-#ifdef HAVE_DYNAMIC_PLUGINS
 #undef config_CmdLineEarlyScan
 /**
  * Perform early scan of arguments for a small subset of simple options.
@@ -98,6 +97,9 @@
  */
 void config_CmdLineEarlyScan( vlc_object_t *p_this, int argc, const char *argv[] )
 {
+#if !defined(HAVE_DYNAMIC_PLUGINS) && !defined(_WIN32)
+    VLC_UNUSED(p_this); VLC_UNUSED(argc); VLC_UNUSED(argv);
+#else
     for( int i = 0; i < argc; i++ )
     {
         const char *arg = argv[i];
@@ -117,16 +119,34 @@ void config_CmdLineEarlyScan( vlc_object_t *p_this, int argc, const char *argv[]
     check_option_variant("--"   option_name, option_name, true)  \
     check_option_variant("--no-"option_name, option_name, false) \
     check_option_variant("--no" option_name, option_name, false)
+#define check_string(option_name) \
+    if( strncmp( arg, "--" option_name "=", strlen("--" option_name "=") ) == 0 ) \
+    { \
+        const char *value = arg + strlen("--" option_name "="); \
+        var_Create (p_this, option_name, VLC_VAR_STRING); \
+        var_SetString (p_this, option_name, value); \
+        continue; \
+    }
 
+#ifdef HAVE_DYNAMIC_PLUGINS
         check_option("plugins-cache")
         check_option("plugins-scan")
         check_option("reset-plugins-cache")
+#endif
+
+#if defined(_WIN32) || defined(__OS2__)
+        check_option("high-priority")
+#endif
+#ifdef _WIN32
+        check_string("clock-source")
+#endif
 
 #undef check_option
 #undef check_option_variant
+#undef check_string
     }
-}
 #endif
+}
 
 #undef config_LoadCmdLine
 /**


=====================================
src/config/configuration.h
=====================================
@@ -54,10 +54,8 @@ int  config_AutoSaveConfigFile( vlc_object_t * );
 
 void config_Free(struct vlc_param *, size_t);
 
-#ifdef HAVE_DYNAMIC_PLUGINS
 void config_CmdLineEarlyScan( vlc_object_t *, int, const char *[] );
 #define config_CmdLineEarlyScan(a,b,c) config_CmdLineEarlyScan(VLC_OBJECT(a),b,c)
-#endif
 
 int config_LoadCmdLine   ( vlc_object_t *, int, const char *[], int * );
 int config_LoadConfigFile( vlc_object_t * );


=====================================
src/libvlc.c
=====================================
@@ -145,11 +145,10 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     module_InitBank ();
 
     /*
-     * Perform early check for commandline arguments that affect module loading.
+     * Perform early check for commandline arguments that affect module loading
+     * or vlc_threads_setup()
      */
-#ifdef HAVE_DYNAMIC_PLUGINS
     config_CmdLineEarlyScan( p_libvlc, i_argc, ppsz_argv );
-#endif
 
     vlc_threads_setup (p_libvlc);
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2afe251d735b03c030dcd227a9a51fc7d426b7c0...d325c08ddd72c7902f63b079dce1a89c9f36045f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2afe251d735b03c030dcd227a9a51fc7d426b7c0...d325c08ddd72c7902f63b079dce1a89c9f36045f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list