<html><head></head><body><div class="gmail_quote">Le 13 juillet 2017 23:19:01 GMT+08:00, Thomas Guillem <git@videolan.org> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">vlc | branch: master | Thomas Guillem <thomas@gllm.fr> | Tue Jul 11 13:05:20 2017 +0200| [9c6117e88eab4bb2c44f3294c622c17d194164ec] | committer: Thomas Guillem<br /><br />aout: increase stereo-mode lifecycle<br /><br />It's not reset anymore when the aout is restarted<br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> <a href="http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c6117e88eab4bb2c44f3294c622c17d194164ec">http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c6117e88eab4bb2c44f3294c622c17d194164ec</a><br /></blockquote>---<br /><br /> src/audio_output/dec.c | 7 -----<br /> src/audio_output/output.c | 73 ++++++++++++++++++++++++++---------------------<br /> 2 files changed, 41 insertions(+), 39 deletions(-)<br /><br />diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c<br />index bceb817faf..d50a656d35 100644<br />--- a/src/audio_output/dec.c<br />+++ b/src/audio_output/dec.c<br />@@ -69,11 +69,6 @@ int aout_DecNew( audio_output_t *p_aout,<br /> return -1;<br /> }<br /> <br />- var_Create (p_aout, "stereo-mode", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);<br />- vlc_value_t txt;<br />- txt.psz_string = _("Stereo audio mode");<br />- var_Change (p_aout, "stereo-mode", VLC_VAR_SETTEXT, &txt, NULL);<br />-<br /> aout_owner_t *owner = aout_owner(p_aout);<br /> <br /> /* TODO: reduce lock scope depending on decoder's real need */<br />@@ -108,7 +103,6 @@ error:<br /> aout_volume_Delete (owner->volume);<br /> owner->volume = NULL;<br /> aout_OutputUnlock (p_aout);<br />- var_Destroy (p_aout, "stereo-mode");<br /> return -1;<br /> }<br /> <br />@@ -138,7 +132,6 @@ void aout_DecDelete (audio_output_t *aout)<br /> aout_volume_Delete (owner->volume);<br /> owner->volume = NULL;<br /> aout_OutputUnlock (aout);<br />- var_Destroy (aout, "stereo-mode");<br /> }<br /> <br /> static int aout_CheckReady (audio_output_t *aout)<br />diff --git a/src/audio_output/output.c b/src/audio_output/output.c<br />index d9ac95a78a..1092e58e0b 100644<br />--- a/src/audio_output/output.c<br />+++ b/src/audio_output/output.c<br />@@ -320,6 +320,13 @@ audio_output_t *aout_New (vlc_object_t *parent)<br /> &val, &text);<br /> }<br /> <br />+ /* Stereo mode */<br />+ var_Create (aout, "stereo-mode", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);<br />+ var_AddCallback (aout, "stereo-mode", StereoModeCallback, NULL);<br />+ vlc_value_t txt;<br />+ txt.psz_string = _("Stereo audio mode");<br />+ var_Change (aout, "stereo-mode", VLC_VAR_SETTEXT, &txt, NULL);<br />+<br /> /* Equalizer */<br /> var_Create (aout, "equalizer-preamp", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);<br /> var_Create (aout, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT);<br />@@ -348,6 +355,7 @@ void aout_Destroy (audio_output_t *aout)<br /> var_DelCallback (aout, "mute", var_Copy, aout->obj.parent);<br /> var_SetFloat (aout, "volume", -1.f);<br /> var_DelCallback (aout, "volume", var_Copy, aout->obj.parent);<br />+ var_DelCallback (aout, "stereo-mode", StereoModeCallback, NULL);<br /> vlc_object_release (aout);<br /> }<br /> <br />@@ -397,8 +405,35 @@ int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt)<br /> return -1;<br /> }<br /> <br />+ /* Fill Stereo mode choices */<br />+ var_Change (aout, "stereo-mode", VLC_VAR_CLEARCHOICES, NULL, NULL);<br />+ vlc_value_t val, txt, default_val;<br />+ val.i_int = 0;<br />+ if (fmt->i_physical_channels == AOUT_CHANS_STEREO)<br />+ {<br />+ if (fmt->i_original_channels & AOUT_CHAN_DOLBYSTEREO)<br />+ {<br />+ default_val.i_int = val.i_int = AOUT_VAR_CHAN_DOLBYS;<br />+ txt.psz_string = _("Dolby Surround");<br />+ }<br />+ else<br />+ {<br />+ default_val.i_int = val.i_int = AOUT_VAR_CHAN_STEREO;<br />+ txt.psz_string = _("Stereo");<br />+ }<br />+ var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br />+ val.i_int = AOUT_VAR_CHAN_LEFT;<br />+ txt.psz_string = _("Left");<br />+ var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br />+ val.i_int = AOUT_VAR_CHAN_RIGHT;<br />+ txt.psz_string = _("Right");<br />+ var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br />+ val.i_int = AOUT_VAR_CHAN_RSTEREO;<br />+ txt.psz_string = _("Reverse stereo");<br />+ var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br />+ }<br />+<br /> /* The user may have selected a different channels configuration. */<br />- var_AddCallback (aout, "stereo-mode", StereoModeCallback, NULL);<br /> switch (var_GetInteger (aout, "stereo-mode"))<br /> {<br /> case AOUT_VAR_CHAN_RSTEREO:<br />@@ -417,41 +452,16 @@ int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt)<br /> fmt->i_original_channels = AOUT_CHANS_STEREO|AOUT_CHAN_DOLBYSTEREO;<br /> break;<br /> default:<br />- {<br />- if ((fmt->i_original_channels & AOUT_CHAN_PHYSMASK)<br />- != AOUT_CHANS_STEREO)<br />- break;<br />-<br />- vlc_value_t val, txt;<br />- val.i_int = 0;<br />- var_Change (aout, "stereo-mode", VLC_VAR_DELCHOICE, &val, NULL);<br />- if (fmt->i_original_channels & AOUT_CHAN_DOLBYSTEREO)<br />- {<br />- val.i_int = AOUT_VAR_CHAN_DOLBYS;<br />- txt.psz_string = _("Dolby Surround");<br />- }<br />- else<br />- {<br />- val.i_int = AOUT_VAR_CHAN_STEREO;<br />- txt.psz_string = _("Stereo");<br />- }<br />- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br />- var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE, &val, NULL);<br />- val.i_int = AOUT_VAR_CHAN_LEFT;<br />- txt.psz_string = _("Left");<br />- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br /> if (fmt->i_original_channels & AOUT_CHAN_DUALMONO)<br /> { /* Go directly to the left channel. */<br /> fmt->i_original_channels = AOUT_CHAN_LEFT;<br />+ val.i_int = AOUT_VAR_CHAN_LEFT;<br /> var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE, &val, NULL);<br /> }<br />- val.i_int = AOUT_VAR_CHAN_RIGHT;<br />- txt.psz_string = _("Right");<br />- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br />- val.i_int = AOUT_VAR_CHAN_RSTEREO;<br />- txt.psz_string = _("Reverse stereo");<br />- var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);<br />- }<br />+ else<br />+ var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE, &default_val,<br />+ NULL);<br />+ break;<br /> }<br /> <br /> aout_FormatPrepare (fmt);<br />@@ -470,7 +480,6 @@ void aout_OutputDelete (audio_output_t *aout)<br /> {<br /> aout_OutputAssertLocked (aout);<br /> <br />- var_DelCallback (aout, "stereo-mode", StereoModeCallback, NULL);<br /> if (aout->stop != NULL)<br /> aout->stop (aout);<br /> }<br /><br /><hr /><br />vlc-commits mailing list<br />vlc-commits@videolan.org<br /><a href="https://mailman.videolan.org/listinfo/vlc-commits">https://mailman.videolan.org/listinfo/vlc-commits</a><br /></pre></blockquote></div><br clear="all">This is very wrong. The setting was always meant for thr current audio track. Reverse stereo or dual-mono are indeed track properties.<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>