Add audio instruction.
This commit is contained in:
parent
ebdc70058e
commit
601e75b4f4
@ -271,6 +271,25 @@ int guac_protocol_send_select(guac_socket* socket, const char* protocol);
|
|||||||
*/
|
*/
|
||||||
int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
|
int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
|
||||||
|
|
||||||
|
/* MEDIA INSTRUCTIONS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends an audio instruction over the given guac_socket connection.
|
||||||
|
*
|
||||||
|
* If an error occurs sending the instruction, a non-zero value is
|
||||||
|
* returned, and guac_error is set appropriately.
|
||||||
|
*
|
||||||
|
* @param socket The guac_socket connection to use.
|
||||||
|
* @param channel The index of the audio channel the sound should play on.
|
||||||
|
* @param mimetype The mimetype of the data being sent.
|
||||||
|
* @param duration The duration of the sound being sent, in milliseconds.
|
||||||
|
* @param data The audio data to be sent.
|
||||||
|
* @param size The number of bytes of audio data to send.
|
||||||
|
* @return Zero on success, non-zero on error.
|
||||||
|
*/
|
||||||
|
int guac_protocol_send_audio(guac_socket* socket, int channel,
|
||||||
|
const char* mimetype, int duration, void* data, int size);
|
||||||
|
|
||||||
/* DRAWING INSTRUCTIONS */
|
/* DRAWING INSTRUCTIONS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -399,6 +399,26 @@ int guac_protocol_send_arc(guac_socket* socket, const guac_layer* layer,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int guac_protocol_send_audio(guac_socket* socket, int channel,
|
||||||
|
const char* mimetype, int duration, void* data, int size) {
|
||||||
|
|
||||||
|
int base64_length = (size + 2) / 3 * 4;
|
||||||
|
|
||||||
|
return
|
||||||
|
guac_socket_write_string(socket, "5.audio,")
|
||||||
|
|| __guac_socket_write_length_int(socket, channel)
|
||||||
|
|| guac_socket_write_string(socket, ",")
|
||||||
|
|| __guac_socket_write_length_string(socket, mimetype)
|
||||||
|
|| guac_socket_write_string(socket, ",")
|
||||||
|
|| __guac_socket_write_length_int(socket, duration)
|
||||||
|
|| guac_socket_write_string(socket, ",")
|
||||||
|
|| guac_socket_write_int(socket, base64_length)
|
||||||
|
|| guac_socket_write_string(socket, ".")
|
||||||
|
|| guac_socket_write_base64(socket, data, size)
|
||||||
|
|| guac_socket_flush_base64(socket)
|
||||||
|
|| guac_socket_write_string(socket, ";");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int guac_protocol_send_cfill(guac_socket* socket,
|
int guac_protocol_send_cfill(guac_socket* socket,
|
||||||
guac_composite_mode mode, const guac_layer* layer,
|
guac_composite_mode mode, const guac_layer* layer,
|
||||||
|
Loading…
Reference in New Issue
Block a user