GUAC-240: Add function for streaming JPEG images via img instruction.
This commit is contained in:
parent
995373e74b
commit
1263965511
@ -24,6 +24,7 @@
|
||||
|
||||
#include "client.h"
|
||||
#include "client-handlers.h"
|
||||
#include "encode-jpeg.h"
|
||||
#include "encode-png.h"
|
||||
#include "error.h"
|
||||
#include "instruction.h"
|
||||
@ -397,3 +398,24 @@ void guac_client_stream_png(guac_client* client, guac_socket* socket,
|
||||
|
||||
}
|
||||
|
||||
void guac_client_stream_jpeg(guac_client* client, guac_socket* socket,
|
||||
guac_composite_mode mode, const guac_layer* layer, int x, int y,
|
||||
cairo_surface_t* surface, int quality) {
|
||||
|
||||
/* Allocate new stream for image */
|
||||
guac_stream* stream = guac_client_alloc_stream(client);
|
||||
|
||||
/* Declare stream as containing image data */
|
||||
guac_protocol_send_img(socket, stream, mode, layer, "image/jpeg", x, y);
|
||||
|
||||
/* Write JPEG data */
|
||||
guac_jpeg_write(socket, stream, surface, quality);
|
||||
|
||||
/* Terminate stream */
|
||||
guac_protocol_send_end(socket, stream);
|
||||
|
||||
/* Free allocated stream */
|
||||
guac_client_free_stream(client, stream);
|
||||
|
||||
}
|
||||
|
||||
|
@ -661,6 +661,39 @@ void guac_client_stream_png(guac_client* client, guac_socket* socket,
|
||||
guac_composite_mode mode, const guac_layer* layer, int x, int y,
|
||||
cairo_surface_t* surface);
|
||||
|
||||
/**
|
||||
* Streams the image data of the given surface over an image stream ("img"
|
||||
* instruction) as JPEG-encoded data at the given quality. The image stream
|
||||
* will be automatically allocated and freed.
|
||||
*
|
||||
* @param client
|
||||
* The Guacamole client from which the image stream should be allocated.
|
||||
*
|
||||
* @param socket
|
||||
* The socket over which instructions associated with the image stream
|
||||
* should be sent.
|
||||
*
|
||||
* @param mode
|
||||
* The composite mode to use when rendering the image over the given layer.
|
||||
*
|
||||
* @param layer
|
||||
* The destination layer.
|
||||
*
|
||||
* @param x
|
||||
* The X coordinate of the upper-left corner of the destination rectangle
|
||||
* within the given layer.
|
||||
*
|
||||
* @param y
|
||||
* The Y coordinate of the upper-left corner of the destination rectangle
|
||||
* within the given layer.
|
||||
*
|
||||
* @param surface
|
||||
* A Cairo surface containing the image data to be streamed.
|
||||
*/
|
||||
void guac_client_stream_jpeg(guac_client* client, guac_socket* socket,
|
||||
guac_composite_mode mode, const guac_layer* layer, int x, int y,
|
||||
cairo_surface_t* surface, int quality);
|
||||
|
||||
/**
|
||||
* The default Guacamole client layer, layer 0.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user