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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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@xxxxxxxxxx>
> 
> Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

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);

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]