[vlc-devel] [PATCH 1/4] aout: rename "stereo mode" to "output mode"
Rémi Denis-Courmont
remi at remlab.net
Fri Mar 30 14:55:12 CEST 2018
Le 30 mars 2018 13:57:09 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>This commits renames the following:
> - The "stereo-mode" option to "aout-mode"
> - The "&Stereo Mode" qt menu to "Output &Mode"
> - Every occurrence of stereo_mode to output_mode
>
>In 3.0, we added the Mono choice that is quite confusing with Stereo
>Mode. We
>may want to add other modes: like 4.0 (for out_chan >= 4.0) or 5.1 (for
>out_chan >= 5.1). Finally, I plan to add the "Direct Mode"
>(passthrough) for
>Windows.
>---
> include/vlc_aout.h | 2 +-
> lib/audio.c | 4 +--
> modules/control/oldrc.c | 6 ++--
> modules/gui/macosx/VLCMainMenu.m | 2 +-
> modules/gui/qt/menus.cpp | 4 +--
> share/lua/intf/cli.lua | 2 +-
> src/audio_output/aout_internal.h | 2 +-
> src/audio_output/dec.c | 6 ++--
>src/audio_output/output.c | 60
>++++++++++++++++++++--------------------
> src/libvlc-module.c | 11 ++++----
> 10 files changed, 50 insertions(+), 49 deletions(-)
>
>diff --git a/include/vlc_aout.h b/include/vlc_aout.h
>index 9a888d54a2..b9cf6615f1 100644
>--- a/include/vlc_aout.h
>+++ b/include/vlc_aout.h
>@@ -229,7 +229,7 @@ static const uint32_t pi_vlc_chan_order_wg4[] =
>
> #define AOUT_RESTART_FILTERS 0x1
> #define AOUT_RESTART_OUTPUT (AOUT_RESTART_FILTERS|0x2)
>-#define AOUT_RESTART_STEREOMODE (AOUT_RESTART_OUTPUT|0x4)
>+#define AOUT_RESTART_OUTPUTMODE (AOUT_RESTART_OUTPUT|0x4)
>
>/*****************************************************************************
> * Prototypes
>diff --git a/lib/audio.c b/lib/audio.c
>index 5fe2ce202c..6bef82a39d 100644
>--- a/lib/audio.c
>+++ b/lib/audio.c
>@@ -449,7 +449,7 @@ int libvlc_audio_get_channel( libvlc_media_player_t
>*mp )
> if( !p_aout )
> return 0;
>
>- int val = var_GetInteger( p_aout, "stereo-mode" );
>+ int val = var_GetInteger( p_aout, "aout-mode" );
> vlc_object_release( p_aout );
> return val;
> }
>@@ -465,7 +465,7 @@ int libvlc_audio_set_channel( libvlc_media_player_t
>*mp, int channel )
> if( !p_aout )
> return -1;
>
>- if( var_SetInteger( p_aout, "stereo-mode", channel ) < 0 )
>+ if( var_SetInteger( p_aout, "aout-mode", channel ) < 0 )
> {
> libvlc_printerr( "Audio channel out of range" );
> ret = -1;
>diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
>index e573062da5..c8f5be0108 100644
>--- a/modules/control/oldrc.c
>+++ b/modules/control/oldrc.c
>@@ -1677,14 +1677,14 @@ static int AudioChannel( vlc_object_t *obj,
>char const *cmd,
> {
> /* Retrieve all registered ***. */
> vlc_value_t val, text;
>- if ( var_Change( p_aout, "stereo-mode",
>+ if ( var_Change( p_aout, "aout-mode",
> VLC_VAR_GETCHOICES, &val, &text ) < 0 )
> {
> ret = VLC_ENOVAR;
> goto out;
> }
>
>- int i_value = var_GetInteger( p_aout, "stereo-mode" );
>+ int i_value = var_GetInteger( p_aout, "aout-mode" );
>
> msg_rc( "+----[ %s ]", cmd );
> for ( int i = 0; i < val.p_list->i_count; i++ )
>@@ -1700,7 +1700,7 @@ static int AudioChannel( vlc_object_t *obj, char
>const *cmd,
> msg_rc( "+----[ end of %s ]", cmd );
> }
> else
>- ret = var_SetInteger( p_aout, "stereo-mode", atoi(
>cur.psz_string ) );
>+ ret = var_SetInteger( p_aout, "aout-mode", atoi(
>cur.psz_string ) );
> out:
> vlc_object_release( p_aout );
> (void) old; (void) dummy;
>diff --git a/modules/gui/macosx/VLCMainMenu.m
>b/modules/gui/macosx/VLCMainMenu.m
>index a0946f1fd2..47d96edc3b 100644
>--- a/modules/gui/macosx/VLCMainMenu.m
>+++ b/modules/gui/macosx/VLCMainMenu.m
>@@ -555,7 +555,7 @@
> audio_output_t *p_aout = playlist_GetAout(p_playlist);
> if (p_aout != NULL) {
> [self setupVarMenuItem:_channels target: (vlc_object_t *)p_aout
>- var:"stereo-mode" selector:
>@selector(toggleVar:)];
>+ var:"aout-mode" selector:
>@selector(toggleVar:)];
>
> [self setupVarMenuItem:_visual target: (vlc_object_t *)p_aout
> var:"visual" selector: @selector(toggleVar:)];
>diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
>index 3652827f72..3cbe71210d 100644
>--- a/modules/gui/qt/menus.cpp
>+++ b/modules/gui/qt/menus.cpp
>@@ -265,7 +265,7 @@ static int AudioAutoMenuBuilder( input_thread_t
>*p_input,
> audio_output_t *p_object = p_input ? input_GetAout( p_input ) : NULL;
>
> PUSH_INPUTVAR( "audio-es" );
>- PUSH_VAR( "stereo-mode" );
>+ PUSH_VAR( "aout-mode" );
> PUSH_VAR( "visual" );
>
> if( p_object )
>@@ -618,7 +618,7 @@ QMenu *VLCMenuBar::AudioMenu( intf_thread_t
>*p_intf, QMenu * current )
> {
> addActionWithSubmenu( current, "audio-es", qtr( "Audio &Track" ) );
>audioDeviceMenu = addActionWithSubmenu( current, "audio-device", qtr(
>"Audio &Device" ) );
>- addActionWithSubmenu( current, "stereo-mode", qtr( "&Stereo
>Mode" ) );
>+ addActionWithSubmenu( current, "aout-mode", qtr( "Output
>&Mode" ) );
> current->addSeparator();
>
> addActionWithSubmenu( current, "visual", qtr( "&Visualizations" ) );
>diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
>index 6db1a1cbc9..b4b81bcb4e 100644
>--- a/share/lua/intf/cli.lua
>+++ b/share/lua/intf/cli.lua
>@@ -601,7 +601,7 @@ commands_ordered = {
>{ "volup"; { func = ret_print(vlc.volume.up,"( audio volume: "," )");
>args = "[X]"; help = "raise audio volume X steps" } };
>{ "voldown"; { func = ret_print(vlc.volume.down,"( audio volume: ","
>)"); args = "[X]"; help = "lower audio volume X steps" } };
>-- { "adev"; { func = skip(listvalue("aout","audio-device")); args =
>"[X]"; help = "set/get audio device" } };
>- { "achan"; { func = skip(listvalue("aout","stereo-mode")); args =
>"[X]"; help = "set/get stereo audio output mode" } };
>+ { "achan"; { func = skip(listvalue("aout","aout-mode")); args =
>"[X]"; help = "set/get audio output mode" } };
>{ "atrack"; { func = skip(listvalue("input","audio-es")); args = "[X]";
>help = "set/get audio track" } };
>{ "vtrack"; { func = skip(listvalue("input","video-es")); args = "[X]";
>help = "set/get video track" } };
>{ "vratio"; { func = skip(listvalue("vout","aspect-ratio")); args =
>"[X]"; help = "set/get video aspect ratio" } };
>diff --git a/src/audio_output/aout_internal.h
>b/src/audio_output/aout_internal.h
>index e5b1842ef2..a2c982cde3 100644
>--- a/src/audio_output/aout_internal.h
>+++ b/src/audio_output/aout_internal.h
>@@ -84,7 +84,7 @@ typedef struct
> bool discontinuity;
> } sync;
>
>- int initial_stereo_mode; /**< Initial stereo mode set by options
>*/
>+ int initial_output_mode; /**< Initial output mode set by options
>*/
>
> audio_sample_format_t input_format;
> audio_sample_format_t mixer_format;
>diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
>index 60c35e6176..bdfcbab8fd 100644
>--- a/src/audio_output/dec.c
>+++ b/src/audio_output/dec.c
>@@ -84,8 +84,8 @@ int aout_DecNew( audio_output_t *p_aout,
> owner->mixer_format = owner->input_format;
> owner->request_vout = *p_request_vout;
>
>- var_Change (p_aout, "stereo-mode", VLC_VAR_SETVALUE,
>- &(vlc_value_t) { .i_int = owner->initial_stereo_mode
>}, NULL);
>+ var_Change (p_aout, "aout-mode", VLC_VAR_SETVALUE,
>+ &(vlc_value_t) { .i_int = owner->initial_output_mode
>}, NULL);
>
> owner->filters_cfg = AOUT_FILTERS_CFG_INIT;
>if (aout_OutputNew (p_aout, &owner->mixer_format, &owner->filters_cfg))
>@@ -161,7 +161,7 @@ static int aout_CheckReady (audio_output_t *aout)
>
> /* Notify the decoder that the aout changed in order to try a new
> * suitable codec (like an HDMI audio format). However, keep the
>- * same codec if the aout was restarted because of a
>stereo-mode
>+ * same codec if the aout was restarted because of a
>aout-mode
> * change from the user. */
> if (restart == AOUT_RESTART_OUTPUT)
> status = AOUT_DEC_CHANGED;
>diff --git a/src/audio_output/output.c b/src/audio_output/output.c
>index caf398ea18..1b32113b47 100644
>--- a/src/audio_output/output.c
>+++ b/src/audio_output/output.c
>@@ -171,13 +171,13 @@ static int FilterCallback (vlc_object_t *obj,
>const char *var,
> return VLC_SUCCESS;
> }
>
>-static int StereoModeCallback (vlc_object_t *obj, const char *varname,
>- vlc_value_t oldval, vlc_value_t newval,
>void *data)
>+static int AoutModeCallback (vlc_object_t *obj, const char *varname,
>+ vlc_value_t oldval, vlc_value_t newval,
>void *data)
> {
> audio_output_t *aout = (audio_output_t *)obj;
> (void)varname; (void)oldval; (void)newval; (void)data;
>
>- aout_RestartRequest (aout, AOUT_RESTART_STEREOMODE);
>+ aout_RestartRequest (aout, AOUT_RESTART_OUTPUTMODE);
> return 0;
> }
>
>@@ -337,13 +337,13 @@ audio_output_t *aout_New (vlc_object_t *parent)
> }
>
> /* Stereo mode */
>- var_Create (aout, "stereo-mode", VLC_VAR_INTEGER |
>VLC_VAR_DOINHERIT);
>- owner->initial_stereo_mode = var_GetInteger (aout, "stereo-mode");
>+ var_Create (aout, "aout-mode", VLC_VAR_INTEGER |
>VLC_VAR_DOINHERIT);
>+ owner->initial_output_mode = var_GetInteger (aout, "aout-mode");
>
>- var_AddCallback (aout, "stereo-mode", StereoModeCallback, NULL);
>+ var_AddCallback (aout, "aout-mode", AoutModeCallback, NULL);
> vlc_value_t txt;
> txt.psz_string = _("Stereo audio mode");
>- var_Change (aout, "stereo-mode", VLC_VAR_SETTEXT, &txt, NULL);
>+ var_Change (aout, "aout-mode", VLC_VAR_SETTEXT, &txt, NULL);
>
> /* Equalizer */
>var_Create (aout, "equalizer-preamp", VLC_VAR_FLOAT |
>VLC_VAR_DOINHERIT);
>@@ -374,7 +374,7 @@ void aout_Destroy (audio_output_t *aout)
> var_DelCallback (aout, "mute", var_Copy, aout->obj.parent);
> var_SetFloat (aout, "volume", -1.f);
> var_DelCallback (aout, "volume", var_Copy, aout->obj.parent);
>- var_DelCallback (aout, "stereo-mode", StereoModeCallback, NULL);
>+ var_DelCallback (aout, "aout-mode", AoutModeCallback, NULL);
> vlc_object_release (aout);
> }
>
>@@ -400,15 +400,15 @@ static void aout_Destructor (vlc_object_t *obj)
> vlc_mutex_destroy (&owner->lock);
> }
>
>-static void aout_PrepareStereoMode (audio_output_t *aout,
>+static void aout_PrepareOutputMode (audio_output_t *aout,
> audio_sample_format_t *restrict fmt,
> aout_filters_cfg_t *filters_cfg,
> audio_channel_type_t input_chan_type,
> unsigned i_nb_input_channels,
>- int i_forced_stereo_mode)
>+ int i_forced_output_mode)
> {
> /* Fill Stereo mode choices */
>- var_Change (aout, "stereo-mode", VLC_VAR_CLEARCHOICES, NULL,
>NULL);
>+ var_Change (aout, "aout-mode", VLC_VAR_CLEARCHOICES, NULL, NULL);
> vlc_value_t val, txt, default_val = { .i_int = AOUT_VAR_CHAN_UNSET };
> val.i_int = 0;
>
>@@ -419,14 +419,14 @@ static void aout_PrepareStereoMode
>(audio_output_t *aout,
> {
> val.i_int = AOUT_VAR_CHAN_MONO;
> txt.psz_string = _("Mono");
>- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val,
>&txt);
>+ var_Change (aout, "aout-mode", VLC_VAR_ADDCHOICE, &val, &txt);
> }
>
> if (i_nb_input_channels != 2)
> {
> val.i_int = AOUT_VAR_CHAN_UNSET;
> txt.psz_string = _("Original");
>- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val,
>&txt);
>+ var_Change (aout, "aout-mode", VLC_VAR_ADDCHOICE, &val, &txt);
> }
> if (fmt->i_chan_mode & AOUT_CHANMODE_DOLBYSTEREO)
> {
>@@ -438,7 +438,7 @@ static void aout_PrepareStereoMode (audio_output_t
>*aout,
> val.i_int = AOUT_VAR_CHAN_STEREO;
> txt.psz_string = _("Stereo");
> }
>- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>+ var_Change (aout, "aout-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>
> if (i_nb_input_channels == 2)
> {
>@@ -446,14 +446,14 @@ static void aout_PrepareStereoMode
>(audio_output_t *aout,
>
> val.i_int = AOUT_VAR_CHAN_LEFT;
> txt.psz_string = _("Left");
>- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val,
>&txt);
>+ var_Change (aout, "aout-mode", VLC_VAR_ADDCHOICE, &val, &txt);
> val.i_int = AOUT_VAR_CHAN_RIGHT;
> txt.psz_string = _("Right");
>- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val,
>&txt);
>+ var_Change (aout, "aout-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>
> val.i_int = AOUT_VAR_CHAN_RSTEREO;
> txt.psz_string = _("Reverse stereo");
>- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val,
>&txt);
>+ var_Change (aout, "aout-mode", VLC_VAR_ADDCHOICE, &val, &txt);
> }
>
> if (input_chan_type == AUDIO_CHANNEL_TYPE_AMBISONICS
>@@ -461,20 +461,20 @@ static void aout_PrepareStereoMode
>(audio_output_t *aout,
> {
> val.i_int = AOUT_VAR_CHAN_HEADPHONES;
> txt.psz_string = _("Headphones");
>- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val,
>&txt);
>+ var_Change (aout, "aout-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>
>- if (i_forced_stereo_mode == AOUT_VAR_CHAN_UNSET
>+ if (i_forced_output_mode == AOUT_VAR_CHAN_UNSET
> && aout->current_sink_info.headphones)
> {
>- i_forced_stereo_mode = AOUT_VAR_CHAN_HEADPHONES;
>+ i_forced_output_mode = AOUT_VAR_CHAN_HEADPHONES;
> default_val.i_int = val.i_int;
>- var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE,
>&default_val,
>+ var_Change (aout, "aout-mode", VLC_VAR_SETVALUE,
>&default_val,
> NULL);
> }
> }
>
> /* The user may have selected a different channels configuration. */
>- switch (i_forced_stereo_mode)
>+ switch (i_forced_output_mode)
> {
> case AOUT_VAR_CHAN_RSTEREO:
> filters_cfg->remap[AOUT_CHANIDX_LEFT] = AOUT_CHANIDX_RIGHT;
>@@ -506,7 +506,7 @@ static void aout_PrepareStereoMode (audio_output_t
>*aout,
> filters_cfg->remap[AOUT_CHANIDX_RIGHT] = AOUT_CHANIDX_DISABLE;
> default_val.i_int = val.i_int = AOUT_VAR_CHAN_LEFT;
> }
>- var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE,
>&default_val,
>+ var_Change (aout, "aout-mode", VLC_VAR_SETVALUE,
>&default_val,
> NULL);
> break;
> }
>@@ -523,7 +523,7 @@ int aout_OutputNew (audio_output_t *aout,
>audio_sample_format_t *restrict fmt,
> aout_OutputAssertLocked (aout);
>
> audio_channel_type_t input_chan_type = fmt->channel_type;
>- int i_forced_stereo_mode = AOUT_VAR_CHAN_UNSET;
>+ int i_forced_output_mode = AOUT_VAR_CHAN_UNSET;
> unsigned i_nb_input_channels = fmt->i_channels;
>
>/* Ideally, the audio filters would be created before the audio output,
>@@ -551,11 +551,11 @@ int aout_OutputNew (audio_output_t *aout,
>audio_sample_format_t *restrict fmt,
> fmt->i_format = (fmt->i_bitspersample > 16) ? VLC_CODEC_FL32
> : VLC_CODEC_S16N;
>
>- i_forced_stereo_mode = var_GetInteger (aout, "stereo-mode");
>- if (i_forced_stereo_mode != AOUT_VAR_CHAN_UNSET)
>+ i_forced_output_mode = var_GetInteger (aout, "aout-mode");
>+ if (i_forced_output_mode != AOUT_VAR_CHAN_UNSET)
> {
>- if (i_forced_stereo_mode == AOUT_VAR_CHAN_LEFT
>- || i_forced_stereo_mode == AOUT_VAR_CHAN_RIGHT)
>+ if (i_forced_output_mode == AOUT_VAR_CHAN_LEFT
>+ || i_forced_output_mode == AOUT_VAR_CHAN_RIGHT)
> fmt->i_physical_channels = AOUT_CHAN_CENTER;
> else
> fmt->i_physical_channels = AOUT_CHANS_STEREO;
>@@ -573,8 +573,8 @@ int aout_OutputNew (audio_output_t *aout,
>audio_sample_format_t *restrict fmt,
> return -1;
> }
>
>- aout_PrepareStereoMode (aout, fmt, filters_cfg, input_chan_type,
>- i_nb_input_channels,
>i_forced_stereo_mode);
>+ aout_PrepareOutputMode (aout, fmt, filters_cfg, input_chan_type,
>+ i_nb_input_channels,
>i_forced_output_mode);
>
> aout_FormatPrepare (fmt);
> assert (fmt->i_bytes_per_frame > 0 && fmt->i_frame_length > 0);
>diff --git a/src/libvlc-module.c b/src/libvlc-module.c
>index 77ab8283ab..1840825992 100644
>--- a/src/libvlc-module.c
>+++ b/src/libvlc-module.c
>@@ -186,13 +186,13 @@ static const int pi_force_dolby_values[] = { 0,
>1, 2 };
> static const char *const ppsz_force_dolby_descriptions[] = {
> N_("Auto"), N_("On"), N_("Off") };
>
>-#define STEREO_MODE_TEXT N_("Stereo audio output mode")
>-static const int pi_stereo_mode_values[] = { AOUT_VAR_CHAN_UNSET,
>+#define AOUT_MODE_TEXT N_("Audio output mode")
>+static const int pi_aout_mode_values[] = { AOUT_VAR_CHAN_UNSET,
> AOUT_VAR_CHAN_STEREO, AOUT_VAR_CHAN_RSTEREO,
> AOUT_VAR_CHAN_LEFT, AOUT_VAR_CHAN_RIGHT, AOUT_VAR_CHAN_DOLBYS,
> AOUT_VAR_CHAN_HEADPHONES,
> };
>-static const char *const ppsz_stereo_mode_texts[] = { N_("Unset"),
>+static const char *const ppsz_aout_mode_texts[] = { N_("Unset"),
> N_("Stereo"), N_("Reverse stereo"),
> N_("Left"), N_("Right"), N_("Dolby Surround"),
> N_("Headphones"),
>@@ -1506,8 +1506,9 @@ vlc_module_begin ()
> add_integer( "force-dolby-surround", 0, FORCE_DOLBY_TEXT,
> FORCE_DOLBY_LONGTEXT, false )
>change_integer_list( pi_force_dolby_values,
>ppsz_force_dolby_descriptions )
>- add_integer( "stereo-mode", 0, STEREO_MODE_TEXT, STEREO_MODE_TEXT,
>true )
>- change_integer_list( pi_stereo_mode_values,
>ppsz_stereo_mode_texts )
>+ add_integer( "aout-mode", 0, AOUT_MODE_TEXT, AOUT_MODE_TEXT, true
>)
>+ change_integer_list( pi_aout_mode_values, ppsz_aout_mode_texts
>)
>+ add_obsolete_integer( "stereo-mode" ) /* deprecated since 4.0 */
> add_integer( "audio-desync", 0, DESYNC_TEXT,
> DESYNC_LONGTEXT, true )
> change_safe ()
>--
>2.11.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
The stereo mode variable was specifically added to replace the earlier non-persistent non-CLI setting for stereo inputs. Adding surround outpout for stereo input does not seem to make much sense. I don't agree here.
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
More information about the vlc-devel
mailing list