[Spice-devel] [PATCH spice-html5] Display: Implement change preferred compression message
Jeremy White
jwhite at codeweavers.com
Thu May 25 18:12:49 UTC 2017
Hi Tomáš,
This patch looks essentially correct to me.
But could you also add constants for the image_compression enums? i.e.
SPICE_IMAGE_COMPRESSION_INVALID and friends?
Cheers,
Jeremy
On 05/24/2017 06:08 AM, Tomáš Bohdálek wrote:
> ---
> display.js | 9 +++++++++
> enums.js | 1 +
> spicemsg.js | 20 ++++++++++++++++++++
> 3 files changed, 30 insertions(+)
>
> diff --git a/display.js b/display.js
> index 7719b23..501ef03 100644
> --- a/display.js
> +++ b/display.js
> @@ -1245,3 +1245,12 @@ function listen_for_video_events(stream)
> if (STREAM_DEBUG > 1)
> video_2_events.forEach(video_debug_listen_for_one_event, stream.video);
> }
> +
> +SpiceDisplayConn.prototype.change_preferred_compression = function(compression_id)
> +{
> + var msg = new SpiceMiniData();
> + var compression = new SpiceMsgcDisplayPreferredCompression(compression_id);
> +
> + msg.build_msg(SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION, compression);
> + this.send_msg(msg);
> +}
> \ No newline at end of file
> diff --git a/enums.js b/enums.js
> index b6e013c..f25afe6 100644
> --- a/enums.js
> +++ b/enums.js
> @@ -134,6 +134,7 @@ var SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT = 319;
>
> var SPICE_MSGC_DISPLAY_INIT = 101;
> var SPICE_MSGC_DISPLAY_STREAM_REPORT = 102;
> +var SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION = 103;
>
> var SPICE_MSG_INPUTS_INIT = 101;
> var SPICE_MSG_INPUTS_KEY_MODIFIERS = 102;
> diff --git a/spicemsg.js b/spicemsg.js
> index 3619996..7b9494f 100644
> --- a/spicemsg.js
> +++ b/spicemsg.js
> @@ -1296,3 +1296,23 @@ SpiceMsgPortInit.prototype =
> this.name = a.slice(offset, offset + namesize - 1);
> }
> }
> +
> +function SpiceMsgcDisplayPreferredCompression(compression)
> +{
> + this.image_compression = compression;
> +}
> +
> +SpiceMsgcDisplayPreferredCompression.prototype =
> +{
> + to_buffer: function(a, at)
> + {
> + at = at || 0;
> + var dv = new SpiceDataView(a);
> + dv.setUint8(at, this.image_compression, true); at += 1;
> + return at;
> + },
> + buffer_size: function()
> + {
> + return 1;
> + }
> +}
> \ No newline at end of file
>
More information about the Spice-devel
mailing list