Re: [Spice-devel] [PATCH v4 03/17] sound: Rename {Record, Playback}Channel to *ChannelClient

2016-12-01 Thread Christophe Fergeau
On Thu, Dec 01, 2016 at 11:24:25AM +, Frediano Ziglio wrote:
> Make easier to understand that they refer to client and not
> all channel.
> 
> Specifically:
> - RecordChannel -> RecordChannelClient
> - PlaybackChannel -> PlaybackChannelClient
> - playback_channel -> playback_client
> - record_channel -> record_client
> 
> Signed-off-by: Frediano Ziglio 
> ---
>  server/sound.c | 368 +-
>  1 file changed, 184 insertions(+), 184 deletions(-)

> @@ -1194,12 +1194,12 @@ static void snd_set_playback_peer(RedChannel 
> *channel, RedClient *client, RedsSt
>int num_caps, uint32_t *caps)
>  {
>  SndWorker *worker = g_object_get_data(G_OBJECT(channel), "sound-worker");
> -PlaybackChannel *playback_channel;
> +PlaybackChannelClient *playback_client;
>  
>  snd_disconnect_channel(worker->connection);
>  
> -if (!(playback_channel = (PlaybackChannel *)__new_channel(worker,
> -  
> sizeof(*playback_channel),
> +if (!(playback_client = (PlaybackChannelClient *)__new_channel(worker,
> +  
> sizeof(*playback_client),
>
> SPICE_CHANNEL_PLAYBACK,
>client,
>stream,

Alignment

> @@ -1440,12 +1440,12 @@ static void snd_set_record_peer(RedChannel *channel, 
> RedClient *client, RedsStre
>  int num_caps, uint32_t *caps)
>  {
>  SndWorker *worker = g_object_get_data(G_OBJECT(channel), "sound-worker");
> -RecordChannel *record_channel;
> +RecordChannelClient *record_client;
>  
>  snd_disconnect_channel(worker->connection);
>  
> -if (!(record_channel = (RecordChannel *)__new_channel(worker,
> -  
> sizeof(*record_channel),
> +if (!(record_client = (RecordChannelClient *)__new_channel(worker,
> +  
> sizeof(*record_client),
>
> SPICE_CHANNEL_RECORD,
>client,
>stream,

Alignment too

Acked-by: Christophe Fergeau 


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH v4 03/17] sound: Rename {Record, Playback}Channel to *ChannelClient

2016-12-01 Thread Frediano Ziglio
Make easier to understand that they refer to client and not
all channel.

Specifically:
- RecordChannel -> RecordChannelClient
- PlaybackChannel -> PlaybackChannelClient
- playback_channel -> playback_client
- record_channel -> record_client

Signed-off-by: Frediano Ziglio 
---
 server/sound.c | 368 +-
 1 file changed, 184 insertions(+), 184 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index 02adf79..bafdd1e 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -116,17 +116,17 @@ struct SndChannelClient {
 snd_channel_cleanup_channel_proc cleanup;
 };
 
-typedef struct PlaybackChannel PlaybackChannel;
+typedef struct PlaybackChannelClient PlaybackChannelClient;
 
 typedef struct AudioFrame AudioFrame;
 struct AudioFrame {
 uint32_t time;
 uint32_t samples[SND_CODEC_MAX_FRAME_SIZE];
-PlaybackChannel *channel;
+PlaybackChannelClient *client;
 AudioFrame *next;
 };
 
-struct PlaybackChannel {
+struct PlaybackChannelClient {
 SndChannelClient base;
 AudioFrame frames[3];
 AudioFrame *free_frames;
@@ -163,7 +163,7 @@ struct SpiceRecordState {
 struct SndWorker worker;
 };
 
-typedef struct RecordChannel {
+typedef struct RecordChannelClient {
 SndChannelClient base;
 uint32_t samples[RECORD_SAMPLES_SIZE];
 uint32_t write_pos;
@@ -173,7 +173,7 @@ typedef struct RecordChannel {
 uint32_t start_time;
 SndCodec codec;
 uint8_t  decode_buf[SND_CODEC_MAX_FRAME_BYTES];
-} RecordChannel;
+} RecordChannelClient;
 
 /* A list of all Spice{Playback,Record}State objects */
 static SndWorker *workers;
@@ -233,20 +233,20 @@ static void snd_disconnect_channel(SndChannelClient 
*client)
 worker->connection = NULL;
 }
 
-static void snd_playback_free_frame(PlaybackChannel *playback_channel, 
AudioFrame *frame)
+static void snd_playback_free_frame(PlaybackChannelClient *playback_client, 
AudioFrame *frame)
 {
-frame->channel = playback_channel;
-frame->next = playback_channel->free_frames;
-playback_channel->free_frames = frame;
+frame->client = playback_client;
+frame->next = playback_client->free_frames;
+playback_client->free_frames = frame;
 }
 
 static void snd_playback_on_message_done(SndChannelClient *client)
 {
-PlaybackChannel *playback_channel = (PlaybackChannel *)client;
-if (playback_channel->in_progress) {
-snd_playback_free_frame(playback_channel, 
playback_channel->in_progress);
-playback_channel->in_progress = NULL;
-if (playback_channel->pending_frame) {
+PlaybackChannelClient *playback_client = (PlaybackChannelClient *)client;
+if (playback_client->in_progress) {
+snd_playback_free_frame(playback_client, playback_client->in_progress);
+playback_client->in_progress = NULL;
+if (playback_client->pending_frame) {
 client->command |= SND_PLAYBACK_PCM_MASK;
 }
 }
@@ -311,7 +311,7 @@ static int snd_send_data(SndChannelClient *client)
 return TRUE;
 }
 
-static int snd_record_handle_write(RecordChannel *record_channel, size_t size, 
void *message)
+static int snd_record_handle_write(RecordChannelClient *record_client, size_t 
size, void *message)
 {
 SpiceMsgcRecordPacket *packet;
 uint32_t write_pos;
@@ -319,39 +319,39 @@ static int snd_record_handle_write(RecordChannel 
*record_channel, size_t size, v
 uint32_t len;
 uint32_t now;
 
-if (!record_channel) {
+if (!record_client) {
 return FALSE;
 }
 
 packet = (SpiceMsgcRecordPacket *)message;
 
-if (record_channel->mode == SPICE_AUDIO_DATA_MODE_RAW) {
+if (record_client->mode == SPICE_AUDIO_DATA_MODE_RAW) {
 data = (uint32_t *)packet->data;
 size = packet->data_size >> 2;
 size = MIN(size, RECORD_SAMPLES_SIZE);
  } else {
 int decode_size;
-decode_size = sizeof(record_channel->decode_buf);
-if (snd_codec_decode(record_channel->codec, packet->data, 
packet->data_size,
-record_channel->decode_buf, &decode_size) != SND_CODEC_OK)
+decode_size = sizeof(record_client->decode_buf);
+if (snd_codec_decode(record_client->codec, packet->data, 
packet->data_size,
+record_client->decode_buf, &decode_size) != SND_CODEC_OK)
 return FALSE;
-data = (uint32_t *) record_channel->decode_buf;
+data = (uint32_t *) record_client->decode_buf;
 size = decode_size >> 2;
 }
 
-write_pos = record_channel->write_pos % RECORD_SAMPLES_SIZE;
-record_channel->write_pos += size;
+write_pos = record_client->write_pos % RECORD_SAMPLES_SIZE;
+record_client->write_pos += size;
 len = RECORD_SAMPLES_SIZE - write_pos;
 now = MIN(len, size);
 size -= now;
-memcpy(record_channel->samples + write_pos, data, now << 2);
+memcpy(record_client->samples + write_pos, data, now << 2);
 
 if (size) {
-memcpy(record_channel->samples, data 

[Spice-devel] [PATCH v4 03/17] sound: Rename {Record, Playback}Channel to *ChannelClient

2016-12-01 Thread Frediano Ziglio
Make easier to understand that they refer to client and not
all channel.

Specifically:
- RecordChannel -> RecordChannelClient
- PlaybackChannel -> PlaybackChannelClient
- playback_channel -> playback_client
- record_channel -> record_client

Signed-off-by: Frediano Ziglio 
---
 server/sound.c | 368 +-
 1 file changed, 184 insertions(+), 184 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index 02adf79..bafdd1e 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -116,17 +116,17 @@ struct SndChannelClient {
 snd_channel_cleanup_channel_proc cleanup;
 };
 
-typedef struct PlaybackChannel PlaybackChannel;
+typedef struct PlaybackChannelClient PlaybackChannelClient;
 
 typedef struct AudioFrame AudioFrame;
 struct AudioFrame {
 uint32_t time;
 uint32_t samples[SND_CODEC_MAX_FRAME_SIZE];
-PlaybackChannel *channel;
+PlaybackChannelClient *client;
 AudioFrame *next;
 };
 
-struct PlaybackChannel {
+struct PlaybackChannelClient {
 SndChannelClient base;
 AudioFrame frames[3];
 AudioFrame *free_frames;
@@ -163,7 +163,7 @@ struct SpiceRecordState {
 struct SndWorker worker;
 };
 
-typedef struct RecordChannel {
+typedef struct RecordChannelClient {
 SndChannelClient base;
 uint32_t samples[RECORD_SAMPLES_SIZE];
 uint32_t write_pos;
@@ -173,7 +173,7 @@ typedef struct RecordChannel {
 uint32_t start_time;
 SndCodec codec;
 uint8_t  decode_buf[SND_CODEC_MAX_FRAME_BYTES];
-} RecordChannel;
+} RecordChannelClient;
 
 /* A list of all Spice{Playback,Record}State objects */
 static SndWorker *workers;
@@ -233,20 +233,20 @@ static void snd_disconnect_channel(SndChannelClient 
*client)
 worker->connection = NULL;
 }
 
-static void snd_playback_free_frame(PlaybackChannel *playback_channel, 
AudioFrame *frame)
+static void snd_playback_free_frame(PlaybackChannelClient *playback_client, 
AudioFrame *frame)
 {
-frame->channel = playback_channel;
-frame->next = playback_channel->free_frames;
-playback_channel->free_frames = frame;
+frame->client = playback_client;
+frame->next = playback_client->free_frames;
+playback_client->free_frames = frame;
 }
 
 static void snd_playback_on_message_done(SndChannelClient *client)
 {
-PlaybackChannel *playback_channel = (PlaybackChannel *)client;
-if (playback_channel->in_progress) {
-snd_playback_free_frame(playback_channel, 
playback_channel->in_progress);
-playback_channel->in_progress = NULL;
-if (playback_channel->pending_frame) {
+PlaybackChannelClient *playback_client = (PlaybackChannelClient *)client;
+if (playback_client->in_progress) {
+snd_playback_free_frame(playback_client, playback_client->in_progress);
+playback_client->in_progress = NULL;
+if (playback_client->pending_frame) {
 client->command |= SND_PLAYBACK_PCM_MASK;
 }
 }
@@ -311,7 +311,7 @@ static int snd_send_data(SndChannelClient *client)
 return TRUE;
 }
 
-static int snd_record_handle_write(RecordChannel *record_channel, size_t size, 
void *message)
+static int snd_record_handle_write(RecordChannelClient *record_client, size_t 
size, void *message)
 {
 SpiceMsgcRecordPacket *packet;
 uint32_t write_pos;
@@ -319,39 +319,39 @@ static int snd_record_handle_write(RecordChannel 
*record_channel, size_t size, v
 uint32_t len;
 uint32_t now;
 
-if (!record_channel) {
+if (!record_client) {
 return FALSE;
 }
 
 packet = (SpiceMsgcRecordPacket *)message;
 
-if (record_channel->mode == SPICE_AUDIO_DATA_MODE_RAW) {
+if (record_client->mode == SPICE_AUDIO_DATA_MODE_RAW) {
 data = (uint32_t *)packet->data;
 size = packet->data_size >> 2;
 size = MIN(size, RECORD_SAMPLES_SIZE);
  } else {
 int decode_size;
-decode_size = sizeof(record_channel->decode_buf);
-if (snd_codec_decode(record_channel->codec, packet->data, 
packet->data_size,
-record_channel->decode_buf, &decode_size) != SND_CODEC_OK)
+decode_size = sizeof(record_client->decode_buf);
+if (snd_codec_decode(record_client->codec, packet->data, 
packet->data_size,
+record_client->decode_buf, &decode_size) != SND_CODEC_OK)
 return FALSE;
-data = (uint32_t *) record_channel->decode_buf;
+data = (uint32_t *) record_client->decode_buf;
 size = decode_size >> 2;
 }
 
-write_pos = record_channel->write_pos % RECORD_SAMPLES_SIZE;
-record_channel->write_pos += size;
+write_pos = record_client->write_pos % RECORD_SAMPLES_SIZE;
+record_client->write_pos += size;
 len = RECORD_SAMPLES_SIZE - write_pos;
 now = MIN(len, size);
 size -= now;
-memcpy(record_channel->samples + write_pos, data, now << 2);
+memcpy(record_client->samples + write_pos, data, now << 2);
 
 if (size) {
-memcpy(record_channel->samples, data