[Spice-devel] [spice-server 09/17] sound: Add separate SND_MUTE_MASK

Frediano Ziglio fziglio at redhat.com
Wed Jan 11 14:46:50 UTC 2017


> 
> Currently MUTE and VOLUME commands use the same VOLUME mask. This commit
> introduces a separate SND_MUTE_MASK for MUTE commands to make things
> a bit more clear.
> 
> Based on a patch from Frediano Ziglio <fziglio at redhat.com>
> 
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano

> ---
>  server/sound.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/server/sound.c b/server/sound.c
> index e1d6805..7941ea2 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -55,6 +55,7 @@ enum SndCommand {
>      SND_MIGRATE,
>      SND_CTRL,
>      SND_VOLUME,
> +    SND_MUTE,
>      SND_END_COMMAND,
>  };
>  
> @@ -67,6 +68,8 @@ enum PlaybackCommand {
>  #define SND_MIGRATE_MASK (1 << SND_MIGRATE)
>  #define SND_CTRL_MASK (1 << SND_CTRL)
>  #define SND_VOLUME_MASK (1 << SND_VOLUME)
> +#define SND_MUTE_MASK (1 << SND_MUTE)
> +#define SND_VOLUME_MUTE_MASK (SND_VOLUME_MASK|SND_MUTE_MASK)
>  
>  #define SND_PLAYBACK_MODE_MASK (1 << SND_PLAYBACK_MODE)
>  #define SND_PLAYBACK_PCM_MASK (1 << SND_PLAYBACK_PCM)
> @@ -872,12 +875,17 @@ static void snd_playback_send(void* data)
>              client->command &= ~SND_CTRL_MASK;
>          }
>          if (client->command & SND_VOLUME_MASK) {
> -            if (!snd_playback_send_volume(playback_client) ||
> -                !snd_playback_send_mute(playback_client)) {
> +            if (!snd_playback_send_volume(playback_client)) {
>                  return;
>              }
>              client->command &= ~SND_VOLUME_MASK;
>          }
> +        if (client->command & SND_MUTE_MASK) {
> +            if (!snd_playback_send_mute(playback_client)) {
> +                return;
> +            }
> +            client->command &= ~SND_MUTE_MASK;
> +        }
>          if (client->command & SND_MIGRATE_MASK) {
>              if (!snd_playback_send_migrate(playback_client)) {
>                  return;
> @@ -910,12 +918,17 @@ static void snd_record_send(void* data)
>              client->command &= ~SND_CTRL_MASK;
>          }
>          if (client->command & SND_VOLUME_MASK) {
> -            if (!snd_record_send_volume(record_client) ||
> -                !snd_record_send_mute(record_client)) {
> +            if (!snd_record_send_volume(record_client)) {
>                  return;
>              }
>              client->command &= ~SND_VOLUME_MASK;
>          }
> +        if (client->command & SND_MUTE_MASK) {
> +            if (!snd_record_send_mute(record_client)) {
> +                return;
> +            }
> +            client->command &= ~SND_MUTE_MASK;
> +        }
>          if (client->command & SND_MIGRATE_MASK) {
>              if (!snd_record_send_migrate(record_client)) {
>                  return;
> @@ -1259,7 +1272,7 @@ static void on_new_playback_channel_client(SndChannel
> *channel, SndChannelClient
>          snd_set_command(client, SND_CTRL_MASK);
>      }
>      if (channel->volume.volume_nchannels) {
> -        snd_set_command(client, SND_VOLUME_MASK);
> +        snd_set_command(client, SND_VOLUME_MUTE_MASK);
>      }
>      if (client->active) {
>          reds_disable_mm_time(reds);
> @@ -1515,7 +1528,7 @@ static void on_new_record_channel_client(SndChannel
> *channel, SndChannelClient *
>  
>      channel->connection = client;
>      if (channel->volume.volume_nchannels) {
> -        snd_set_command(client, SND_VOLUME_MASK);
> +        snd_set_command(client, SND_VOLUME_MUTE_MASK);
>      }
>      if (client->active) {
>          snd_set_command(client, SND_CTRL_MASK);



More information about the Spice-devel mailing list