[PATCH spice-html5 2/4] Display: Implement change preferred compression message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tomáš Bohdálek <tom.bohdalek@xxxxxxxxx>

---
 display.js  | 16 ++++++++++++++++
 enums.js    | 10 ++++++++++
 spicemsg.js | 20 ++++++++++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/display.js b/display.js
index 7719b23..60c79b4 100644
--- a/display.js
+++ b/display.js
@@ -1245,3 +1245,19 @@ 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 ch = this.channel_type();
+    if (!this.channel_test_capability(SPICE_DISPLAY_CAP_PREF_COMPRESSION))
+    {
+        this.log_warn(ch + " does not have capability to change the preferred compression");
+        return;
+    }
+
+    var msg = new SpiceMiniData();
+    var compression = new SpiceMsgcDisplayPreferredCompression(compression_id);
+
+    msg.build_msg(SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION, compression);
+    this.send_msg(msg);
+}
diff --git a/enums.js b/enums.js
index b6e013c..b37cb20 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;
@@ -243,6 +244,15 @@ var SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS = 106;
 var SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB   = 107;
 var SPICE_IMAGE_TYPE_JPEG_ALPHA     = 108;
 
+var SPICE_IMAGE_COMPRESSION_INVALID = 0,
+    SPICE_IMAGE_COMPRESSION_OFF     = 1,
+    SPICE_IMAGE_COMPRESSION_AUTO_GLZ = 2,
+    SPICE_IMAGE_COMPRESSION_AUTO_LZ = 3,
+    SPICE_IMAGE_COMPRESSION_QUIC    = 4,
+    SPICE_IMAGE_COMPRESSION_GLZ     = 5,
+    SPICE_IMAGE_COMPRESSION_LZ      = 6,
+    SPICE_IMAGE_COMPRESSION_LZ4     = 7;
+
 var SPICE_IMAGE_FLAGS_CACHE_ME = (1 << 0),
     SPICE_IMAGE_FLAGS_HIGH_BITS_SET = (1 << 1),
     SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME = (1 << 2);
diff --git a/spicemsg.js b/spicemsg.js
index 3619996..8a9eeed 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;
+    }
+}
-- 
2.13.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]