[vlc-devel] [PATCH 1/3] libvlc: introduce 'Muted' as a whole state, not as volume 0

Francois Cartegnie fcvlcdev at free.fr
Thu Jan 7 21:27:31 CET 2010


Le jeudi 7 janvier 2010, Rémi Denis-Courmont a écrit :
> > int __aout_ToggleMute( vlc_object_t * p_object, audio_volume_t *
> >  pi_volume )
> >  {
> > +    return aout_SetMute( p_object, pi_volume, !aout_IsMuted( p_object )
> > ); +}
>
> I was under the impression we had a var_ToggleBool() to do exactly that,
> but atomically.

Well, we're not in the case:
var_SetBool( "foo", !var_GetBool( "foo" ) );
There's some job done in SetMute().

So, if we want atomic operations, we need to spinlock the whole operations:
On mute:
* read mute
* toggle mute var
* read volume
* backup volume
* set volume to X
On unmute
* read mute
* toggle mute var
* read saved volume
* set volume to X

Francois




More information about the vlc-devel mailing list