[RFC PATCH 12/16] stream-channel: Allows to register callback to get new stream request

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

 



The channel needs to communicate when it receive a new
stream request from the guest.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/stream-channel.c | 11 +++++++++++
 server/stream-channel.h |  6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/server/stream-channel.c b/server/stream-channel.c
index 2ea7c57..87aebbb 100644
--- a/server/stream-channel.c
+++ b/server/stream-channel.c
@@ -62,6 +62,9 @@ struct StreamChannel {
 
     int stream_id;
     unsigned width, height;
+
+    stream_channel_start_proc start_cb;
+    void *start_opaque;
 };
 
 struct StreamChannelClass {
@@ -400,3 +403,11 @@ stream_channel_send_data(StreamChannel *channel, const void *data, size_t size)
     red_channel_pipes_new_add(red_channel, pipe_item_new_ref, item);
     red_pipe_item_unref(&item->base);
 }
+
+void
+stream_channel_register_start_cb(StreamChannel *channel,
+                                 stream_channel_start_proc cb, void *opaque)
+{
+    channel->start_cb = cb;
+    channel->start_opaque = opaque;
+}
diff --git a/server/stream-channel.h b/server/stream-channel.h
index bb66ac6..db2c8a9 100644
--- a/server/stream-channel.h
+++ b/server/stream-channel.h
@@ -48,11 +48,17 @@ GType stream_channel_get_type(void) G_GNUC_CONST;
 StreamChannel* stream_channel_new(RedsState *server);
 
 struct StreamMsgStreamFormat;
+struct StreamMsgStart;
 
 void stream_channel_change_format(StreamChannel *channel,
                                   const struct StreamMsgStreamFormat *fmt);
 void stream_channel_send_data(StreamChannel *channel, const void *data, size_t size);
 
+typedef void (*stream_channel_start_proc)(void *opaque, struct StreamMsgStart *start,
+                                          StreamChannel *channel);
+void stream_channel_register_start_cb(StreamChannel *channel,
+                                      stream_channel_start_proc cb, void *opaque);
+
 G_END_DECLS
 
 #endif /* STREAM_CHANNEL_H_ */
-- 
git-series 0.9.1
_______________________________________________
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]