[Spice-devel] [PATCH spice-html5 2/3] Implement support for sized data streams.
Christophe Fergeau
cfergeau at redhat.com
Thu Jun 4 01:28:16 PDT 2015
Hey,
Not very familiar with the html5 code, but looks good
On Wed, Jun 03, 2015 at 05:22:54PM -0500, Jeremy White wrote:
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
> display.js | 60 ++++++++++++++++++++++++++++++++++++++----------------------
> enums.js | 11 +++++++++++
> spiceconn.js | 4 ++++
> spicemsg.js | 23 +++++++++++++++++++++++
> 4 files changed, 76 insertions(+), 22 deletions(-)
>
> diff --git a/display.js b/display.js
> index a749dae..7027230 100644
> --- a/display.js
> +++ b/display.js
> @@ -487,32 +487,21 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
> }
> if (this.streams[m.base.id].codec_type === SPICE_VIDEO_CODEC_TYPE_MJPEG)
> {
> - var tmpstr = "data:image/jpeg,";
> - var img = new Image;
> - var i;
> - for (i = 0; i < m.data.length; i++)
> - {
> - tmpstr += '%';
> - if (m.data[i] < 16)
> - tmpstr += '0';
> - tmpstr += m.data[i].toString(16);
> - }
> - var strm_base = new SpiceMsgDisplayBase();
> - strm_base.surface_id = this.streams[m.base.id].surface_id;
> - strm_base.box = this.streams[m.base.id].dest;
> - strm_base.clip = this.streams[m.base.id].clip;
> - img.o =
> - { base: strm_base,
> - tag: "mjpeg." + m.base.id,
> - descriptor: null,
> - sc : this,
> - };
> - img.onload = handle_draw_jpeg_onload;
> - img.src = tmpstr;
> + process_mjpeg_stream_data(this, m);
> +
> }
> return true;
> }
>
> + if (msg.type == SPICE_MSG_DISPLAY_STREAM_DATA_SIZED)
> + {
> + var m = new SpiceMsgDisplayStreamDataSized(msg.data);
> + if (this.streams[m.base.id].codec_type === SPICE_VIDEO_CODEC_TYPE_MJPEG)
> + process_mjpeg_stream_data(this, m);
> + return true;
> + }
> +
> +
> if (msg.type == SPICE_MSG_DISPLAY_STREAM_CLIP)
> {
> var m = new SpiceMsgDisplayStreamClip(msg.data);
> @@ -821,3 +810,30 @@ function handle_draw_jpeg_onload()
> this.o.sc.surfaces[this.o.base.surface_id].draw_count++;
> }
> }
> +
> +function process_mjpeg_stream_data(sc, m)
> +{
> + var tmpstr = "data:image/jpeg,";
> + var img = new Image;
> + var i;
> + for (i = 0; i < m.data.length; i++)
> + {
> + tmpstr += '%';
> + if (m.data[i] < 16)
> + tmpstr += '0';
> + tmpstr += m.data[i].toString(16);
> + }
> + var strm_base = new SpiceMsgDisplayBase();
> + strm_base.surface_id = sc.streams[m.base.id].surface_id;
> + strm_base.box = m.dest || sc.streams[m.base.id].dest;
> + strm_base.clip = sc.streams[m.base.id].clip;
> + img.o =
> + { base: strm_base,
> + tag: "mjpeg." + m.base.id,
> + descriptor: null,
> + sc : sc,
> + };
> + img.onload = handle_draw_jpeg_onload;
> + img.src = tmpstr;
> +}
> +
> diff --git a/enums.js b/enums.js
> index 17d77cb..7f55e46 100644
> --- a/enums.js
> +++ b/enums.js
> @@ -127,6 +127,10 @@ var SPICE_MSG_DISPLAY_DRAW_TRANSPARENT = 312;
> var SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND = 313;
> var SPICE_MSG_DISPLAY_SURFACE_CREATE = 314;
> var SPICE_MSG_DISPLAY_SURFACE_DESTROY = 315;
> +var SPICE_MSG_DISPLAY_STREAM_DATA_SIZED = 316;
> +var SPICE_MSG_DISPLAY_MONITORS_CONFIG = 317;
> +var SPICE_MSG_DISPLAY_DRAW_COMPOSITE = 318;
> +var SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT = 319;
>
> var SPICE_MSGC_DISPLAY_INIT = 101;
>
> @@ -171,6 +175,13 @@ var SPICE_MAIN_CAP_NAME_AND_UUID = 1;
> var SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS = 2;
> var SPICE_MAIN_CAP_SEAMLESS_MIGRATE = 3;
>
> +var SPICE_DISPLAY_CAP_SIZED_STREAM = 0;
> +var SPICE_DISPLAY_CAP_MONITORS_CONFIG = 1;
> +var SPICE_DISPLAY_CAP_COMPOSITE = 2;
> +var SPICE_DISPLAY_CAP_A8_SURFACE = 3;
> +var SPICE_DISPLAY_CAP_STREAM_REPORT = 4;
> +var SPICE_DISPLAY_CAP_LZ4_COMPRESSION = 5;
> +
I guess not all of these new constants are needed for this commit, but
they are there for completeness?
ACK.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150604/46ebbca1/attachment-0001.sig>
More information about the Spice-devel
mailing list