[Spice-devel] [PATCH v3 05/17] sound: Rename SndWorker to SndChannel

Frediano Ziglio fziglio at redhat.com
Tue Nov 29 14:57:05 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/sound.c | 68 +++++++++++++++++++++++++--------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index c3bb566..6650094 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -79,12 +79,12 @@ typedef int (*snd_channel_handle_message_proc)(SndChannelClient *client, size_t 
 typedef void (*snd_channel_on_message_done_proc)(SndChannelClient *client);
 typedef void (*snd_channel_cleanup_channel_proc)(SndChannelClient *client);
 
-typedef struct SndWorker SndWorker;
+typedef struct SndChannel SndChannel;
 
 /* Connects an audio client to a Spice client */
 struct SndChannelClient {
     RedsStream *stream;
-    SndWorker *worker;
+    SndChannel *worker;
     spice_parse_channel_func_t parser;
     int refs;
 
@@ -145,10 +145,10 @@ typedef struct SpiceVolumeState {
 } SpiceVolumeState;
 
 /* Base class for SpicePlaybackState and SpiceRecordState */
-struct SndWorker {
+struct SndChannel {
     RedChannel *base_channel;
     SndChannelClient *connection; /* Only one client is supported */
-    SndWorker *next; /* For the global SndWorker list */
+    SndChannel *next; /* For the global SndChannel list */
 
     int active;
     SpiceVolumeState volume;
@@ -156,11 +156,11 @@ struct SndWorker {
 };
 
 struct SpicePlaybackState {
-    struct SndWorker worker;
+    struct SndChannel worker;
 };
 
 struct SpiceRecordState {
-    struct SndWorker worker;
+    struct SndChannel worker;
 };
 
 typedef struct RecordChannelClient {
@@ -176,11 +176,11 @@ typedef struct RecordChannelClient {
 } RecordChannelClient;
 
 /* A list of all Spice{Playback,Record}State objects */
-static SndWorker *workers;
+static SndChannel *workers;
 
 static void snd_receive(SndChannelClient *client);
-static void snd_playback_start(SndWorker *worker);
-static void snd_record_start(SndWorker *worker);
+static void snd_playback_start(SndChannel *worker);
+static void snd_record_start(SndChannel *worker);
 
 static SndChannelClient *snd_channel_ref(SndChannelClient *client)
 {
@@ -206,7 +206,7 @@ static RedsState* snd_channel_get_server(SndChannelClient *client)
 
 static void snd_disconnect_channel(SndChannelClient *client)
 {
-    SndWorker *worker;
+    SndChannel *worker;
     RedsState *reds;
     RedChannel *red_channel;
     uint32_t type;
@@ -384,7 +384,7 @@ static int snd_record_handle_message(SndChannelClient *client, size_t size, uint
         return snd_record_handle_write((RecordChannelClient *)client, size, message);
     case SPICE_MSGC_RECORD_MODE: {
         SpiceMsgcRecordMode *mode = (SpiceMsgcRecordMode *)message;
-        SndWorker *worker = client->worker;
+        SndChannel *worker = client->worker;
         record_client->mode_time = mode->time;
         if (mode->mode != SPICE_AUDIO_DATA_MODE_RAW) {
             if (snd_codec_is_capable(mode->mode, worker->frequency)) {
@@ -873,7 +873,7 @@ static void snd_record_send(void* data)
     }
 }
 
-static SndChannelClient *__new_channel(SndWorker *worker, int size, uint32_t channel_id,
+static SndChannelClient *__new_channel(SndChannel *worker, int size, uint32_t channel_id,
                                  RedClient *red_client,
                                  RedsStream *stream,
                                  int migrate,
@@ -970,12 +970,12 @@ error1:
 
 static void snd_disconnect_channel_client(RedChannelClient *rcc)
 {
-    SndWorker *worker;
+    SndChannel *worker;
     RedChannel *channel = red_channel_client_get_channel(rcc);
     uint32_t type;
 
     spice_assert(channel);
-    worker = (SndWorker *)g_object_get_data(G_OBJECT(channel), "sound-worker");
+    worker = (SndChannel *)g_object_get_data(G_OBJECT(channel), "sound-worker");
     spice_assert(worker);
     g_object_get(channel, "channel-type", &type, NULL);
 
@@ -1026,7 +1026,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_set_mute(SpicePlaybackInstance *si
     snd_playback_send_mute(playback_client);
 }
 
-static void snd_playback_start(SndWorker *worker)
+static void snd_playback_start(SndChannel *worker)
 {
     SndChannelClient *client = worker->connection;
 
@@ -1122,7 +1122,7 @@ SPICE_GNUC_VISIBLE void spice_server_playback_put_samples(SpicePlaybackInstance 
 
 void snd_set_playback_latency(RedClient *client, uint32_t latency)
 {
-    SndWorker *now = workers;
+    SndChannel *now = workers;
 
     for (; now; now = now->next) {
         uint32_t type;
@@ -1159,7 +1159,7 @@ static int snd_desired_audio_mode(int playback_compression, int frequency,
     return SPICE_AUDIO_DATA_MODE_RAW;
 }
 
-static void on_new_playback_channel(SndWorker *worker, SndChannelClient *snd_channel)
+static void on_new_playback_channel(SndChannel *worker, SndChannelClient *snd_channel)
 {
     RedsState *reds = red_channel_get_server(worker->base_channel);
 
@@ -1193,7 +1193,7 @@ static void snd_set_playback_peer(RedChannel *channel, RedClient *client, RedsSt
                                   int migration, int num_common_caps, uint32_t *common_caps,
                                   int num_caps, uint32_t *caps)
 {
-    SndWorker *worker = g_object_get_data(G_OBJECT(channel), "sound-worker");
+    SndChannel *worker = g_object_get_data(G_OBJECT(channel), "sound-worker");
     PlaybackChannelClient *playback_client;
 
     snd_disconnect_channel(worker->connection);
@@ -1246,12 +1246,12 @@ static void snd_set_playback_peer(RedChannel *channel, RedClient *client, RedsSt
 
 static void snd_record_migrate_channel_client(RedChannelClient *rcc)
 {
-    SndWorker *worker;
+    SndChannel *worker;
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
     spice_debug(NULL);
     spice_assert(channel);
-    worker = (SndWorker *)g_object_get_data(G_OBJECT(channel), "sound-worker");
+    worker = (SndChannel *)g_object_get_data(G_OBJECT(channel), "sound-worker");
     spice_assert(worker);
 
     if (worker->connection) {
@@ -1293,7 +1293,7 @@ SPICE_GNUC_VISIBLE void spice_server_record_set_mute(SpiceRecordInstance *sin, u
     snd_record_send_mute(record_client);
 }
 
-static void snd_record_start(SndWorker *worker)
+static void snd_record_start(SndChannel *worker)
 {
     SndChannelClient *client = worker->connection;
     RecordChannelClient *record_client = SPICE_CONTAINEROF(client, RecordChannelClient, base);
@@ -1356,7 +1356,7 @@ SPICE_GNUC_VISIBLE uint32_t spice_server_record_get_samples(SpiceRecordInstance 
     len = MIN(record_client->write_pos - record_client->read_pos, bufsize);
 
     if (len < bufsize) {
-        SndWorker *worker = record_client->base.worker;
+        SndChannel *worker = record_client->base.worker;
         snd_receive(&record_client->base);
         if (!worker->connection) {
             return 0;
@@ -1387,7 +1387,7 @@ static uint32_t snd_get_best_rate(SndChannelClient *client, uint32_t cap_opus)
     return SND_CODEC_CELT_PLAYBACK_FREQ;
 }
 
-static void snd_set_rate(SndWorker *worker, uint32_t frequency, uint32_t cap_opus)
+static void snd_set_rate(SndChannel *worker, uint32_t frequency, uint32_t cap_opus)
 {
     RedChannel *client = worker->base_channel;
     worker->frequency = frequency;
@@ -1416,7 +1416,7 @@ SPICE_GNUC_VISIBLE void spice_server_set_record_rate(SpiceRecordInstance *sin, u
     snd_set_rate(&sin->st->worker, frequency, SPICE_RECORD_CAP_OPUS);
 }
 
-static void on_new_record_channel(SndWorker *worker, SndChannelClient *snd_channel)
+static void on_new_record_channel(SndChannel *worker, SndChannelClient *snd_channel)
 {
     spice_assert(snd_channel);
 
@@ -1439,7 +1439,7 @@ static void snd_set_record_peer(RedChannel *channel, RedClient *client, RedsStre
                                 int migration, int num_common_caps, uint32_t *common_caps,
                                 int num_caps, uint32_t *caps)
 {
-    SndWorker *worker = g_object_get_data(G_OBJECT(channel), "sound-worker");
+    SndChannel *worker = g_object_get_data(G_OBJECT(channel), "sound-worker");
     RecordChannelClient *record_client;
 
     snd_disconnect_channel(worker->connection);
@@ -1470,11 +1470,11 @@ static void snd_set_record_peer(RedChannel *channel, RedClient *client, RedsStre
 
 static void snd_playback_migrate_channel_client(RedChannelClient *rcc)
 {
-    SndWorker *worker;
+    SndChannel *worker;
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
     spice_assert(channel);
-    worker = (SndWorker *)g_object_get_data(G_OBJECT(channel), "sound-worker");
+    worker = (SndChannel *)g_object_get_data(G_OBJECT(channel), "sound-worker");
     spice_assert(worker);
     spice_debug(NULL);
 
@@ -1485,15 +1485,15 @@ static void snd_playback_migrate_channel_client(RedChannelClient *rcc)
     }
 }
 
-static void add_worker(SndWorker *worker)
+static void add_worker(SndChannel *worker)
 {
     worker->next = workers;
     workers = worker;
 }
 
-static void remove_worker(SndWorker *worker)
+static void remove_worker(SndChannel *worker)
 {
-    SndWorker **now = &workers;
+    SndChannel **now = &workers;
     while (*now) {
         if (*now == worker) {
             *now = worker->next;
@@ -1506,7 +1506,7 @@ static void remove_worker(SndWorker *worker)
 
 void snd_attach_playback(RedsState *reds, SpicePlaybackInstance *sin)
 {
-    SndWorker *playback_worker;
+    SndChannel *playback_worker;
     RedChannel *channel;
     ClientCbs client_cbs = { NULL, };
 
@@ -1535,7 +1535,7 @@ void snd_attach_playback(RedsState *reds, SpicePlaybackInstance *sin)
 
 void snd_attach_record(RedsState *reds, SpiceRecordInstance *sin)
 {
-    SndWorker *record_worker;
+    SndChannel *record_worker;
     RedChannel *channel;
     ClientCbs client_cbs = { NULL, };
 
@@ -1560,7 +1560,7 @@ void snd_attach_record(RedsState *reds, SpiceRecordInstance *sin)
     reds_register_channel(reds, channel);
 }
 
-static void snd_detach_common(SndWorker *worker)
+static void snd_detach_common(SndChannel *worker)
 {
     if (!worker) {
         return;
@@ -1599,7 +1599,7 @@ void snd_detach_record(SpiceRecordInstance *sin)
 
 void snd_set_playback_compression(int on)
 {
-    SndWorker *now = workers;
+    SndChannel *now = workers;
 
     for (; now; now = now->next) {
         uint32_t type;
-- 
git-series 0.9.1


More information about the Spice-devel mailing list