[Spice-devel] [PATCH spice-html5] Display: Implement change preferred compression message

Tomáš Bohdálek tom.bohdalek at gmail.com
Wed May 24 11:08:57 UTC 2017


---
 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
-- 
2.9.4



More information about the Spice-devel mailing list