[Spice-devel] [PATCH spice-html5 3/4] Display: Implement change preferred video codec type message

Jeremy White jwhite at codeweavers.com
Fri Sep 15 18:50:26 UTC 2017


Hi Tomáš,

On 09/07/2017 02:18 AM, Tomáš Bohdálek wrote:
> ---
>  display.js  | 16 ++++++++++++++++
>  enums.js    | 10 ++++++++++
>  spicemsg.js | 24 ++++++++++++++++++++++++
>  3 files changed, 50 insertions(+)
> 
> diff --git a/display.js b/display.js
> index 60c79b4..0868f91 100644
> --- a/display.js
> +++ b/display.js
> @@ -1261,3 +1261,19 @@ SpiceDisplayConn.prototype.change_preferred_compression = function(compression_i
>      msg.build_msg(SPICE_MSGC_DISPLAY_PREFERRED_COMPRESSION, compression);
>      this.send_msg(msg);
>  }
> +
> +SpiceDisplayConn.prototype.change_preferred_video_codec_type = function(video_codecs)
> +{
> +    var ch = this.channel_type();
> +    if (!this.channel_test_capability(SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE))
> +    {
> +        this.log_warn(ch + " does not have capability to change the preferred video codec type");
> +        return;
> +    }
> +
> +    var msg = new SpiceMiniData();
> +    var video_codec_type = new SpiceMsgcDisplayPreferredVideoCodecType(video_codecs);
> +
> +    msg.build_msg(SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE, video_codec_type);
> +    this.send_msg(msg);
> +}

Same nit - can this go higher in the file?

> diff --git a/enums.js b/enums.js
> index b37cb20..b69bf3e 100644
> --- a/enums.js
> +++ b/enums.js
> @@ -135,6 +135,8 @@ 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_MSGC_DISPLAY_GL_DRAW_DONE     = 104;
> +var SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE = 105;
>  
>  var SPICE_MSG_INPUTS_INIT               = 101;
>  var SPICE_MSG_INPUTS_KEY_MODIFIERS      = 102;
> @@ -197,6 +199,9 @@ var SPICE_DISPLAY_CAP_GL_SCANOUT          = 7;
>  var SPICE_DISPLAY_CAP_MULTI_CODEC         = 8;
>  var SPICE_DISPLAY_CAP_CODEC_MJPEG         = 9;
>  var SPICE_DISPLAY_CAP_CODEC_VP8           = 10;
> +var SPICE_DISPLAY_CAP_CODEC_H264          = 11;
> +var SPICE_DISPLAY_CAP_PREF_VIDEO_CODEC_TYPE = 12;
> +var SPICE_DISPLAY_CAP_CODEC_VP9           = 13;
>  
>  var SPICE_AUDIO_DATA_MODE_INVALID       = 0;
>  var SPICE_AUDIO_DATA_MODE_RAW           = 1;
> @@ -231,6 +236,11 @@ var SPICE_MOUSE_MODE_SERVER = (1 << 0),
>  var SPICE_CLIP_TYPE_NONE            = 0;
>  var SPICE_CLIP_TYPE_RECTS           = 1;
>  
> +var SPICE_VIDEO_CODEC_TYPE_MJPEG    = 1,
> +    SPICE_VIDEO_CODEC_TYPE_VP8      = 2,
> +    SPICE_VIDEO_CODEC_TYPE_H264     = 3,
> +    SPICE_VIDEO_CODEC_TYPE_VP9      = 4;

You've duplicated SPICE_VIDEO_CODEC_TYPE_MJPEG and VP8; those two were
already in this file.

Cheers,

Jeremy


More information about the Spice-devel mailing list