[vlc-devel] [vlc-commits] aout: increase stereo-mode lifecycle
Thomas Guillem
thomas at gllm.fr
Fri Jul 14 09:42:30 CEST 2017
On Fri, Jul 14, 2017, at 02:57, Rémi Denis-Courmont wrote:
> Le 13 juillet 2017 23:19:01 GMT+08:00, Thomas Guillem <git at videolan.org> a écrit :>> vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jul 11 13:05:20 2017 +0200| [9c6117e88eab4bb2c44f3294c622c17d194164ec] | committer: Thomas Guillem
>> >>
>>
>> aout: increase stereo-mode lifecycle
>>
>>
>>
>> It's not reset anymore when the aout is restarted
>>
>>
>>
>>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c6117e88eab4bb2c44f3294c622c17d194164ec>> ---
>>
>>
>>
>> src/audio_output/dec.c | 7 -----
>>
>> src/audio_output/output.c | 73 ++++++++++++++++++++++++++---------------------
>> >> 2 files changed, 41 insertions(+), 39 deletions(-)
>>
>>
>>
>> diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
>>
>> index bceb817faf..d50a656d35 100644
>>
>> --- a/src/audio_output/dec.c
>>
>> +++ b/src/audio_output/dec.c
>>
>> @@ -69,11 +69,6 @@ int aout_DecNew( audio_output_t *p_aout,
>>
>> return -1;
>>
>> }
>>
>>
>>
>> - var_Create (p_aout, "stereo-mode", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
>> >> - vlc_value_t txt;
>>
>> - txt.psz_string = _("Stereo audio mode");
>>
>> - var_Change (p_aout, "stereo-mode", VLC_VAR_SETTEXT, &txt, NULL);
>> >> -
>>
>> aout_owner_t *owner = aout_owner(p_aout);
>>
>>
>>
>> /* TODO: reduce lock scope depending on decoder's real need */
>> >> @@ -108,7 +103,6 @@ error:
>>
>> aout_volume_Delete (owner->volume);
>>
>> owner->volume = NULL;
>>
>> aout_OutputUnlock (p_aout);
>>
>> - var_Destroy (p_aout, "stereo-mode");
>>
>> return -1;
>>
>> }
>>
>>
>>
>> @@ -138,7 +132,6 @@ void aout_DecDelete (audio_output_t *aout)
>>
>> aout_volume_Delete (owner->volume);
>>
>> owner->volume = NULL;
>>
>> aout_OutputUnlock (aout);
>>
>> - var_Destroy (aout, "stereo-mode");
>>
>> }
>>
>>
>>
>> static int aout_CheckReady (audio_output_t *aout)
>>
>> diff --git a/src/audio_output/output.c b/src/audio_output/output.c
>> >> index d9ac95a78a..1092e58e0b 100644
>>
>> --- a/src/audio_output/output.c
>>
>> +++ b/src/audio_output/output.c
>>
>> @@ -320,6 +320,13 @@ audio_output_t *aout_New (vlc_object_t *parent)
>> >> &val, &text);
>>
>> }
>>
>>
>>
>> + /* Stereo mode */
>>
>> + var_Create (aout, "stereo-mode", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
>> >> + var_AddCallback (aout, "stereo-mode", StereoModeCallback, NULL);
>> >> + vlc_value_t txt;
>>
>> + txt.psz_string = _("Stereo audio mode");
>>
>> + var_Change (aout, "stereo-mode", VLC_VAR_SETTEXT, &txt, NULL);
>> >> +
>>
>> /* Equalizer */
>>
>> var_Create (aout, "equalizer-preamp", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
>> >> var_Create (aout, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
>> >> @@ -348,6 +355,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);
>> >> vlc_object_release (aout);
>>
>> }
>>
>>
>>
>> @@ -397,8 +405,35 @@ int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt)
>> >> return -1;
>>
>> }
>>
>>
>>
>> + /* Fill Stereo mode choices */
>>
>> + var_Change (aout, "stereo-mode", VLC_VAR_CLEARCHOICES, NULL, NULL);
>> >> + vlc_value_t val, txt, default_val;
>>
>> + val.i_int = 0;
>>
>> + if (fmt->i_physical_channels == AOUT_CHANS_STEREO)
>>
>> + {
>>
>> + if (fmt->i_original_channels & AOUT_CHAN_DOLBYSTEREO)
>>
>> + {
>>
>> + default_val.i_int = val.i_int = AOUT_VAR_CHAN_DOLBYS;
>> >> + txt.psz_string = _("Dolby Surround");
>>
>> + }
>>
>> + else
>>
>> + {
>>
>> + default_val.i_int = val.i_int = AOUT_VAR_CHAN_STEREO;
>> >> + txt.psz_string = _("Stereo");
>>
>> + }
>>
>> + var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>> >> + val.i_int = AOUT_VAR_CHAN_LEFT;
>>
>> + txt.psz_string = _("Left");
>>
>> + var_Change (aout, "stereo-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);
>> >> + val.i_int = AOUT_VAR_CHAN_RSTEREO;
>>
>> + txt.psz_string = _("Reverse stereo");
>>
>> + var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>> >> + }
>>
>> +
>>
>> /* The user may have selected a different channels configuration. */
>> >> - var_AddCallback (aout, "stereo-mode", StereoModeCallback, NULL);
>> >> switch (var_GetInteger (aout, "stereo-mode"))
>>
>> {
>>
>> case AOUT_VAR_CHAN_RSTEREO:
>>
>> @@ -417,41 +452,16 @@ int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt)
>> >> fmt->i_original_channels = AOUT_CHANS_STEREO|AOUT_CHAN_DOLBYSTEREO;
>> >> break;
>>
>> default:
>>
>> - {
>>
>> - if ((fmt->i_original_channels & AOUT_CHAN_PHYSMASK)
>> >> - != AOUT_CHANS_STEREO)
>> >> - break;
>>
>> -
>>
>> - vlc_value_t val, txt;
>>
>> - val.i_int = 0;
>>
>> - var_Change (aout, "stereo-mode", VLC_VAR_DELCHOICE, &val, NULL);
>> >> - if (fmt->i_original_channels & AOUT_CHAN_DOLBYSTEREO)
>> >> - {
>>
>> - val.i_int = AOUT_VAR_CHAN_DOLBYS;
>>
>> - txt.psz_string = _("Dolby Surround");
>>
>> - }
>>
>> - else
>>
>> - {
>>
>> - val.i_int = AOUT_VAR_CHAN_STEREO;
>>
>> - txt.psz_string = _("Stereo");
>>
>> - }
>>
>> - var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>> >> - var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE, &val, NULL);
>> >> - val.i_int = AOUT_VAR_CHAN_LEFT;
>>
>> - txt.psz_string = _("Left");
>>
>> - var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
>> >> if (fmt->i_original_channels & AOUT_CHAN_DUALMONO)
>>
>> { /* Go directly to the left channel. */
>>
>> fmt->i_original_channels = AOUT_CHAN_LEFT;
>>
>> + val.i_int = AOUT_VAR_CHAN_LEFT;
>>
>> var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE, &val, NULL);
>> >> }
>>
>> - val.i_int = AOUT_VAR_CHAN_RIGHT;
>>
>> - txt.psz_string = _("Right");
>>
>> - var_Change (aout, "stereo-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);
>> >> - }
>>
>> + else
>>
>> + var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE, &default_val,
>> >> + NULL);
>>
>> + break;
>>
>> }
>>
>>
>>
>> aout_FormatPrepare (fmt);
>>
>> @@ -470,7 +480,6 @@ void aout_OutputDelete (audio_output_t *aout)
>> >> {
>>
>> aout_OutputAssertLocked (aout);
>>
>>
>>
>> - var_DelCallback (aout, "stereo-mode", StereoModeCallback, NULL);
>> >> if (aout->stop != NULL)
>>
>> aout->stop (aout);
>>
>> }
>>
>>
>>
>>
>>
>> vlc-commits mailing list
>>
>> vlc-commits at videolan.org
>>
>> https://mailman.videolan.org/listinfo/vlc-commits
>>
>
> This is very wrong. The setting was always meant for thr current audio track. Reverse stereo or dual-mono are indeed track properties.
Indeed, it's logical to have this settings per audio track, but as the aout is now restarted very often for X reasons, this settings had no effect at all.
I'll try to find a better solution.
> --
> Rémi Denis-Courmont
> Typed on an inconvenient virtual keyboard
> _________________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170714/e579237f/attachment.html>
More information about the vlc-devel
mailing list