Blame SOURCES/0013-stream-channel-Allows-to-register-callback-to-get-ne.patch

ad1357
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
ad1357
From: Frediano Ziglio <fziglio@redhat.com>
ad1357
Date: Sat, 21 Jan 2017 19:08:12 +0000
ad1357
Subject: [spice-server] stream-channel: Allows to register callback to get new
ad1357
 stream request
ad1357
ad1357
The channel needs to communicate when it receive a new
ad1357
stream request from the guest.
ad1357
ad1357
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
ad1357
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
ad1357
---
ad1357
 server/stream-channel.c | 12 ++++++++++++
ad1357
 server/stream-channel.h |  6 ++++++
ad1357
 2 files changed, 18 insertions(+)
ad1357
ad1357
diff --git a/server/stream-channel.c b/server/stream-channel.c
ad1357
index 59f566f50..be6f7c7d1 100644
ad1357
--- a/server/stream-channel.c
ad1357
+++ b/server/stream-channel.c
ad1357
@@ -70,6 +70,10 @@ struct StreamChannel {
ad1357
     int stream_id;
ad1357
     /* size of the current video stream */
ad1357
     unsigned width, height;
ad1357
+
ad1357
+    /* callback to notify when a stream should be started or stopped */
ad1357
+    stream_channel_start_proc start_cb;
ad1357
+    void *start_opaque;
ad1357
 };
ad1357
 
ad1357
 struct StreamChannelClass {
ad1357
@@ -382,3 +386,11 @@ stream_channel_send_data(StreamChannel *channel, const void *data, size_t size,
ad1357
     memcpy(item->data.data, data, size);
ad1357
     red_channel_pipes_add(red_channel, &item->base);
ad1357
 }
ad1357
+
ad1357
+void
ad1357
+stream_channel_register_start_cb(StreamChannel *channel,
ad1357
+                                 stream_channel_start_proc cb, void *opaque)
ad1357
+{
ad1357
+    channel->start_cb = cb;
ad1357
+    channel->start_opaque = opaque;
ad1357
+}
ad1357
diff --git a/server/stream-channel.h b/server/stream-channel.h
ad1357
index 156a75d31..ba098df49 100644
ad1357
--- a/server/stream-channel.h
ad1357
+++ b/server/stream-channel.h
ad1357
@@ -49,6 +49,7 @@ GType stream_channel_get_type(void) G_GNUC_CONST;
ad1357
 StreamChannel* stream_channel_new(RedsState *server, uint32_t id);
ad1357
 
ad1357
 struct StreamMsgFormat;
ad1357
+struct StreamMsgStartStop;
ad1357
 
ad1357
 void stream_channel_change_format(StreamChannel *channel,
ad1357
                                   const struct StreamMsgFormat *fmt);
ad1357
@@ -56,6 +57,11 @@ void stream_channel_send_data(StreamChannel *channel,
ad1357
                               const void *data, size_t size,
ad1357
                               uint32_t mm_time);
ad1357
 
ad1357
+typedef void (*stream_channel_start_proc)(void *opaque, struct StreamMsgStartStop *start,
ad1357
+                                          StreamChannel *channel);
ad1357
+void stream_channel_register_start_cb(StreamChannel *channel,
ad1357
+                                      stream_channel_start_proc cb, void *opaque);
ad1357
+
ad1357
 G_END_DECLS
ad1357
 
ad1357
 #endif /* STREAM_CHANNEL_H_ */