[vlc-commits] [Git][videolan/vlc][master] 4 commits: aout: initialise "visual" from the visualization preference

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Sep 15 05:50:39 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c304106f by Drew O'Meara at 2026-09-15T05:36:05+00:00
aout: initialise "visual" from the visualization preference

"visual" backs the Audio > Visualizations menu, but its only initialiser is
a non-inheriting read of "effect-list", so it always starts empty and the
menu shows Disable while the configured visualization is running.

Refs #27423

- - - - -
d11e8f37 by Drew O'Meara at 2026-09-15T05:36:05+00:00
aout: do not mistake a visualization module for a "visual" effect

VisualizationCallback separated modules from effects with a hardcoded list
of four module names, so any other visualization module was written to
"effect-list" and loaded the wrong plugin. Test the effect names instead.

- - - - -
67965d61 by Drew O'Meara at 2026-09-15T05:36:05+00:00
aout: list the installed visualization modules in "visual"

The menu was built from hardcoded choices, so a module had to be added to
the core before it could be selected there. Build it from
config_GetPszChoices("audio-visual"), as the preferences already do.

Entries now carry each module's description, which is what makes the two
lists agree.

Refs #27423

- - - - -
54c11f5a by Drew O'Meara at 2026-09-15T05:36:05+00:00
vsxu: give the module a real name and description

Both were the literal string "vsxu". The menu is now built from the module
list, so this is the only name the user sees.

- - - - -


3 changed files:

- modules/visualization/vsxu.cpp
- src/audio_output/filters.c
- src/audio_output/output.c


Changes:

=====================================
modules/visualization/vsxu.cpp
=====================================
@@ -55,8 +55,8 @@ static void Close        ( filter_t * );
 #define HEIGHT_LONGTEXT N_("The height of the video window, in pixels.")
 
 vlc_module_begin ()
-    set_shortname( N_("vsxu"))
-    set_description( N_("vsxu") )
+    set_shortname( "VSXu" )
+    set_description( N_("Vovoid VSXu visualization") )
     set_capability( "visualization", 0 )
     set_subcategory( SUBCAT_AUDIO_VISUAL )
     add_integer( "vsxu-width", 1280, WIDTH_TEXT, WIDTH_LONGTEXT )


=====================================
src/audio_output/filters.c
=====================================
@@ -387,14 +387,17 @@ static int VisualizationCallback (vlc_object_t *obj, const char *var,
     /* FIXME: This ugly hack enforced by visual effect-list, as is the need for
      * separate "visual" (external) and "audio-visual" (internal) variables...
      * The visual plugin should have one submodule per effect instead. */
-    if (strcasecmp (mode, "none") && strcasecmp (mode, "goom")
-     && strcasecmp (mode, "projectm") && strcasecmp (mode, "vsxu")
-     && strcasecmp (mode, "glspectrum"))
-    {
-        var_Create (obj, "effect-list", VLC_VAR_STRING);
-        var_SetString (obj, "effect-list", mode);
-        mode = "visual";
-    }
+    static const char *const effects[] = {
+        "dummy", "scope", "spectrometer", "spectrum", "vuMeter",
+    };
+    for (size_t i = 0; i < ARRAY_SIZE(effects); i++)
+        if (!strcasecmp (mode, effects[i]))
+        {
+            var_Create (obj, "effect-list", VLC_VAR_STRING);
+            var_SetString (obj, "effect-list", mode);
+            mode = "visual";
+            break;
+        }
 
     var_SetString (obj, "audio-visual", mode);
     aout_InputRequestRestart ((audio_output_t *)obj);


=====================================
src/audio_output/output.c
=====================================
@@ -316,6 +316,10 @@ audio_output_t *aout_New (vlc_object_t *parent)
     char *str;
 
     /* Visualizations */
+    var_Create (aout, "audio-visual", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
+    var_Change(aout, "audio-visual", VLC_VAR_SETTEXT,
+               _("Audio visualizations"));
+
     var_Create (aout, "visual", VLC_VAR_STRING);
     var_Change(aout, "visual", VLC_VAR_SETTEXT, _("Visualizations"));
     val.psz_string = (char *)"";
@@ -328,36 +332,39 @@ audio_output_t *aout_New (vlc_object_t *parent)
     var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("Spectrum"));
     val.psz_string = (char *)"vuMeter";
     var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("VU meter"));
-    /* Look for goom plugin */
-    if (module_exists ("goom"))
-    {
-        val.psz_string = (char *)"goom";
-        var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "Goom");
-    }
-    /* Look for libprojectM plugin */
-    if (module_exists ("projectm"))
-    {
-        val.psz_string = (char *)"projectm";
-        var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "projectM");
-    }
-    /* Look for VSXu plugin */
-    if (module_exists ("vsxu"))
-    {
-        val.psz_string = (char *)"vsxu";
-        var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "Vovoid VSXU");
-    }
-    /* Look for glspectrum plugin */
-    if (module_exists ("glspectrum"))
+    /* Same list the preferences use; "visual" is covered by its effects. */
+    char **vis_vals, **vis_texts;
+    ssize_t vis_count = config_GetPszChoices ("audio-visual", &vis_vals,
+                                              &vis_texts);
+    for (ssize_t i = 0; i < vis_count; i++)
     {
-        val.psz_string = (char *)"glspectrum";
-        var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, "3D spectrum");
+        if (strcmp (vis_vals[i], "any") && strcmp (vis_vals[i], "none")
+         && strcmp (vis_vals[i], "visual"))
+        {
+            val.psz_string = vis_vals[i];
+            var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, vis_texts[i]);
+        }
+        free (vis_vals[i]);
+        free (vis_texts[i]);
     }
-    str = var_GetNonEmptyString (aout, "effect-list");
-    if (str != NULL)
+    free (vis_vals);
+    free (vis_texts);
+
+    /* Show the configured visualization as the selected one. */
+    str = var_GetNonEmptyString (aout, "audio-visual");
+    if (str != NULL && strcasecmp (str, "none") && strcasecmp (str, "any"))
     {
-        var_SetString (aout, "visual", str);
-        free (str);
+        if (!strcasecmp (str, "visual"))
+        {
+            /* The visual plugin picks its effect with "effect-list". */
+            free (str);
+            str = module_exists ("visual")
+                ? var_InheritString (aout, "effect-list") : NULL;
+        }
+        if (str != NULL)
+            var_SetString (aout, "visual", str);
     }
+    free (str);
 
     var_Create (aout, "audio-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
     var_AddCallback (aout, "audio-filter", FilterCallback, NULL);
@@ -366,10 +373,6 @@ audio_output_t *aout_New (vlc_object_t *parent)
     var_Create (aout, "viewpoint", VLC_VAR_ADDRESS );
     var_AddCallback (aout, "viewpoint", ViewpointCallback, NULL);
 
-    var_Create (aout, "audio-visual", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
-    var_Change(aout, "audio-visual", VLC_VAR_SETTEXT,
-               _("Audio visualizations"));
-
     /* Replay gain */
     var_Create (aout, "audio-replay-gain-mode",
                 VLC_VAR_STRING | VLC_VAR_DOINHERIT );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/664f9810b03c923a34cebbea699d9a40e9f716ad...54c11f5ace4819e83dad58b86e429c94ca31c157

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/664f9810b03c923a34cebbea699d9a40e9f716ad...54c11f5ace4819e83dad58b86e429c94ca31c157
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list