[Spice-devel,qxl,7/11] Add SpiceVideoCodecs and $XSPICE_VIDEO_CODECS for specifying video codec preferences.

Submitted by Francois Gouget on May 13, 2015, 8:28 p.m.

Details

Message ID alpine.DEB.2.11.1505132109340.6925@amboise
State New
Headers show

Not browsing as part of any series.

Commit Message

Francois Gouget May 13, 2015, 8:28 p.m.
---
 examples/spiceqxl.xorg.conf.example |  7 +++++++
 src/qxl.h                           |  1 +
 src/qxl_driver.c                    |  2 ++
 src/spiceqxl_spice_server.c         | 16 ++++++++++++++++
 4 files changed, 26 insertions(+)

Patch hide | download patch | download mbox

diff --git a/examples/spiceqxl.xorg.conf.example b/examples/spiceqxl.xorg.conf.example
index d15f7f2..a82c2be 100644
--- a/examples/spiceqxl.xorg.conf.example
+++ b/examples/spiceqxl.xorg.conf.example
@@ -51,6 +51,13 @@  Section "Device"
     # defaults to filter.
     #Option "SpiceStreamingVideo" ""
 
+    # Set video codecs to use.  Provide a semicolon list of
+    # codecs, in preference order.  Each codec requires an encoder
+    # which can be one of spice or gstreamer, and then a codec type,
+    # for instance mjpeg or vp8. The default is spice:mjpeg,
+    # which uses the builtin mjpeg encoder.
+    #Option "SpiceVideoCodecs" ""
+
     # Set zlib glz wan compression. Options are auto, never, always.
     # defaults to auto.
     #Option "SpiceZlibGlzWanCompression" ""
diff --git a/src/qxl.h b/src/qxl.h
index f46bc58..14449b8 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -158,6 +158,7 @@  enum {
     OPTION_SURFACE_BUFFER_SIZE,
     OPTION_COMMAND_BUFFER_SIZE,
     OPTION_SPICE_SMARTCARD_FILE,
+    OPTION_SPICE_VIDEO_CODECS,
 #endif
     OPTION_COUNT,
 };
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 942067f..88b38db 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -155,6 +155,8 @@  const OptionInfoRec DefaultOptions[] =
       "CommandBufferSize",        OPTV_INTEGER,    {DEFAULT_COMMAND_BUFFER_SIZE}, FALSE},
     { OPTION_SPICE_SMARTCARD_FILE,
       "SpiceSmartcardFile",       OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_VIDEO_CODECS,
+      "SpiceVideoCodecs",         OPTV_STRING,    {0}, FALSE},
 #endif
 
     { -1, NULL, OPTV_NONE, {0}, FALSE }
diff --git a/src/spiceqxl_spice_server.c b/src/spiceqxl_spice_server.c
index 14ee752..d74b29d 100644
--- a/src/spiceqxl_spice_server.c
+++ b/src/spiceqxl_spice_server.c
@@ -173,6 +173,9 @@  void xspice_set_spice_server_options(OptionInfoPtr options)
     const char *streaming_video =
         get_str_option(options, OPTION_SPICE_STREAMING_VIDEO,
                        "XSPICE_STREAMING_VIDEO");
+    const char *video_codecs =
+        get_str_option(options, OPTION_SPICE_VIDEO_CODECS,
+                       "XSPICE_VIDEO_CODECS");
     int agent_mouse =
         get_bool_option(options, OPTION_SPICE_AGENT_MOUSE,
                         "XSPICE_AGENT_MOUSE");
@@ -295,6 +298,19 @@  void xspice_set_spice_server_options(OptionInfoPtr options)
         spice_server_set_streaming_video(spice_server, streaming_video_opt);
     }
 
+    if (video_codecs) {
+#if SPICE_SERVER_VERSION >= 0x000c06 /* 0.12.6 */
+        if (spice_server_set_video_codecs(spice_server, video_codecs))
+        {
+            fprintf(stderr, "spice: invalid video encoder %s\n", video_codecs);
+            exit(1);
+        }
+#else
+        fprintf(stderr, "spice: video_codecs are not available (spice >= 0.12.6 required)\n");
+        exit(1);
+#endif
+    }
+
     spice_server_set_agent_mouse
         (spice_server, agent_mouse);
     spice_server_set_playback_compression

Comments

looks fine

On Wed, May 13, 2015 at 10:28 PM, Francois Gouget <fgouget@codeweavers.com>
wrote:

> ---
>  examples/spiceqxl.xorg.conf.example |  7 +++++++
>  src/qxl.h                           |  1 +
>  src/qxl_driver.c                    |  2 ++
>  src/spiceqxl_spice_server.c         | 16 ++++++++++++++++
>  4 files changed, 26 insertions(+)
>
> diff --git a/examples/spiceqxl.xorg.conf.example
> b/examples/spiceqxl.xorg.conf.example
> index d15f7f2..a82c2be 100644
> --- a/examples/spiceqxl.xorg.conf.example
> +++ b/examples/spiceqxl.xorg.conf.example
> @@ -51,6 +51,13 @@ Section "Device"
>      # defaults to filter.
>      #Option "SpiceStreamingVideo" ""
>
> +    # Set video codecs to use.  Provide a semicolon list of
> +    # codecs, in preference order.  Each codec requires an encoder
> +    # which can be one of spice or gstreamer, and then a codec type,
> +    # for instance mjpeg or vp8. The default is spice:mjpeg,
> +    # which uses the builtin mjpeg encoder.
> +    #Option "SpiceVideoCodecs" ""
> +
>      # Set zlib glz wan compression. Options are auto, never, always.
>      # defaults to auto.
>      #Option "SpiceZlibGlzWanCompression" ""
> diff --git a/src/qxl.h b/src/qxl.h
> index f46bc58..14449b8 100644
> --- a/src/qxl.h
> +++ b/src/qxl.h
> @@ -158,6 +158,7 @@ enum {
>      OPTION_SURFACE_BUFFER_SIZE,
>      OPTION_COMMAND_BUFFER_SIZE,
>      OPTION_SPICE_SMARTCARD_FILE,
> +    OPTION_SPICE_VIDEO_CODECS,
>  #endif
>      OPTION_COUNT,
>  };
> diff --git a/src/qxl_driver.c b/src/qxl_driver.c
> index 942067f..88b38db 100644
> --- a/src/qxl_driver.c
> +++ b/src/qxl_driver.c
> @@ -155,6 +155,8 @@ const OptionInfoRec DefaultOptions[] =
>        "CommandBufferSize",        OPTV_INTEGER,
> {DEFAULT_COMMAND_BUFFER_SIZE}, FALSE},
>      { OPTION_SPICE_SMARTCARD_FILE,
>        "SpiceSmartcardFile",       OPTV_STRING,    {0}, FALSE},
> +    { OPTION_SPICE_VIDEO_CODECS,
> +      "SpiceVideoCodecs",         OPTV_STRING,    {0}, FALSE},
>  #endif
>
>      { -1, NULL, OPTV_NONE, {0}, FALSE }
> diff --git a/src/spiceqxl_spice_server.c b/src/spiceqxl_spice_server.c
> index 14ee752..d74b29d 100644
> --- a/src/spiceqxl_spice_server.c
> +++ b/src/spiceqxl_spice_server.c
> @@ -173,6 +173,9 @@ void xspice_set_spice_server_options(OptionInfoPtr
> options)
>      const char *streaming_video =
>          get_str_option(options, OPTION_SPICE_STREAMING_VIDEO,
>                         "XSPICE_STREAMING_VIDEO");
> +    const char *video_codecs =
> +        get_str_option(options, OPTION_SPICE_VIDEO_CODECS,
> +                       "XSPICE_VIDEO_CODECS");
>      int agent_mouse =
>          get_bool_option(options, OPTION_SPICE_AGENT_MOUSE,
>                          "XSPICE_AGENT_MOUSE");
> @@ -295,6 +298,19 @@ void xspice_set_spice_server_options(OptionInfoPtr
> options)
>          spice_server_set_streaming_video(spice_server,
> streaming_video_opt);
>      }
>
> +    if (video_codecs) {
> +#if SPICE_SERVER_VERSION >= 0x000c06 /* 0.12.6 */
> +        if (spice_server_set_video_codecs(spice_server, video_codecs))
> +        {
> +            fprintf(stderr, "spice: invalid video encoder %s\n",
> video_codecs);
> +            exit(1);
> +        }
> +#else
> +        fprintf(stderr, "spice: video_codecs are not available (spice >=
> 0.12.6 required)\n");
> +        exit(1);
> +#endif
> +    }
> +
>      spice_server_set_agent_mouse
>          (spice_server, agent_mouse);
>      spice_server_set_playback_compression
> --
> 2.1.4
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>