You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/03/31 00:40:39 UTC
[1/2] incubator-guacamole-server git commit: GUAC-1511: Add user
audio handler and definition. Handle received "audio" instructions.
Repository: incubator-guacamole-server
Updated Branches:
refs/heads/master 60bf39f82 -> f611ea7b6
GUAC-1511: Add user audio handler and definition. Handle received "audio" instructions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/bdbe1df4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/bdbe1df4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/bdbe1df4
Branch: refs/heads/master
Commit: bdbe1df43cd7545ec8a415d605922b8350b0c69b
Parents: e777faa
Author: Michael Jumper <mj...@apache.org>
Authored: Tue Mar 29 21:06:32 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed Mar 30 15:32:09 2016 -0700
----------------------------------------------------------------------
src/libguac/guacamole/user-fntypes.h | 23 +++++++++++++++++++++++
src/libguac/guacamole/user.h | 22 ++++++++++++++++++++++
src/libguac/user-handlers.c | 24 ++++++++++++++++++++++++
src/libguac/user-handlers.h | 7 +++++++
4 files changed, 76 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/bdbe1df4/src/libguac/guacamole/user-fntypes.h
----------------------------------------------------------------------
diff --git a/src/libguac/guacamole/user-fntypes.h b/src/libguac/guacamole/user-fntypes.h
index 1896bdb..13256c5 100644
--- a/src/libguac/guacamole/user-fntypes.h
+++ b/src/libguac/guacamole/user-fntypes.h
@@ -116,6 +116,29 @@ typedef int guac_user_mouse_handler(guac_user* user, int x, int y,
typedef int guac_user_key_handler(guac_user* user, int keysym, int pressed);
/**
+ * Handler for Guacamole audio streams received from a user. Each such audio
+ * stream begins when the user sends an "audio" instruction. To handle received
+ * data along this stream, implementations of this handler must assign blob and
+ * end handlers to the given stream object.
+ *
+ * @param user
+ * The user that opened the audio stream.
+ *
+ * @param stream
+ * The stream object allocated by libguac to represent the audio stream
+ * opened by the user.
+ *
+ * @param mimetype
+ * The mimetype of the data that will be sent along the stream.
+ *
+ * @return
+ * Zero if the opening of the audio stream has been handled successfully,
+ * or non-zero if an error occurs.
+ */
+typedef int guac_user_audio_handler(guac_user* user, guac_stream* stream,
+ char* mimetype);
+
+/**
* Handler for Guacamole clipboard streams received from a user. Each such
* clipboard stream begins when the user sends a "clipboard" instruction. To
* handle received data along this stream, implementations of this handler
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/bdbe1df4/src/libguac/guacamole/user.h
----------------------------------------------------------------------
diff --git a/src/libguac/guacamole/user.h b/src/libguac/guacamole/user.h
index d542b84..c791c2d 100644
--- a/src/libguac/guacamole/user.h
+++ b/src/libguac/guacamole/user.h
@@ -453,6 +453,28 @@ struct guac_user {
*/
guac_user_put_handler* put_handler;
+ /**
+ * Handler for audio events sent by the Guacamole web-client. This handler
+ * will be called whenever the web-client wishes to send a continuous
+ * stream of audio data from some arbitrary source (a microphone, for
+ * example).
+ *
+ * The handler takes a guac_stream, which contains the stream index and
+ * will persist through the duration of the transfer, and the mimetype
+ * of the data being transferred.
+ *
+ * Example:
+ * @code
+ * int audio_handler(guac_user* user, guac_stream* stream,
+ * char* mimetype);
+ *
+ * int guac_user_init(guac_user* user, int argc, char** argv) {
+ * user->audio_handler = audio_handler;
+ * }
+ * @endcode
+ */
+ guac_user_audio_handler* audio_handler;
+
};
/**
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/bdbe1df4/src/libguac/user-handlers.c
----------------------------------------------------------------------
diff --git a/src/libguac/user-handlers.c b/src/libguac/user-handlers.c
index f1c1f25..9cd558c 100644
--- a/src/libguac/user-handlers.c
+++ b/src/libguac/user-handlers.c
@@ -47,6 +47,7 @@ __guac_instruction_handler_mapping __guac_instruction_handler_map[] = {
{"end", __guac_handle_end},
{"get", __guac_handle_get},
{"put", __guac_handle_put},
+ {"audio", __guac_handle_audio},
{NULL, NULL}
};
@@ -267,6 +268,29 @@ static guac_stream* __init_input_stream(guac_user* user, int stream_index) {
}
+int __guac_handle_audio(guac_user* user, int argc, char** argv) {
+
+ /* Pull corresponding stream */
+ int stream_index = atoi(argv[0]);
+ guac_stream* stream = __init_input_stream(user, stream_index);
+ if (stream == NULL)
+ return 0;
+
+ /* If supported, call handler */
+ if (user->audio_handler)
+ return user->audio_handler(
+ user,
+ stream,
+ argv[1] /* mimetype */
+ );
+
+ /* Otherwise, abort */
+ guac_protocol_send_ack(user->socket, stream,
+ "Audio input unsupported", GUAC_PROTOCOL_STATUS_UNSUPPORTED);
+ return 0;
+
+}
+
int __guac_handle_clipboard(guac_user* user, int argc, char** argv) {
/* Pull corresponding stream */
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/bdbe1df4/src/libguac/user-handlers.h
----------------------------------------------------------------------
diff --git a/src/libguac/user-handlers.h b/src/libguac/user-handlers.h
index 4db9141..7a1b623 100644
--- a/src/libguac/user-handlers.h
+++ b/src/libguac/user-handlers.h
@@ -93,6 +93,13 @@ __guac_instruction_handler __guac_handle_mouse;
__guac_instruction_handler __guac_handle_key;
/**
+ * Internal initial handler for the audio instruction. When a audio
+ * instruction is received, this handler will be called. The client's audio
+ * handler will be invoked if defined.
+ */
+__guac_instruction_handler __guac_handle_audio;
+
+/**
* Internal initial handler for the clipboard instruction. When a clipboard
* instruction is received, this handler will be called. The client's clipboard
* handler will be invoked if defined.
[2/2] incubator-guacamole-server git commit: GUAC-1511: Merge libguac
audio input support.
Posted by jm...@apache.org.
GUAC-1511: Merge libguac audio input support.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/f611ea7b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/f611ea7b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/f611ea7b
Branch: refs/heads/master
Commit: f611ea7b65df1053322ab38b3c69c0b4394ece25
Parents: 60bf39f bdbe1df
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Mar 30 15:39:39 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Mar 30 15:39:39 2016 -0700
----------------------------------------------------------------------
src/libguac/guacamole/user-fntypes.h | 23 +++++++++++++++++++++++
src/libguac/guacamole/user.h | 22 ++++++++++++++++++++++
src/libguac/user-handlers.c | 24 ++++++++++++++++++++++++
src/libguac/user-handlers.h | 7 +++++++
4 files changed, 76 insertions(+)
----------------------------------------------------------------------