[Spice-devel,qxl,1/2] spiceqxl: Add SpiceVideoCodecs to specify video codec preferences

Submitted by Francois Gouget on July 6, 2016, 2:17 p.m.

Details

Message ID E1bKne6-00069L-1G@amboise
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Francois Gouget July 6, 2016, 2:17 p.m.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
---

Identical to the patch from v16, v15 and v14 before that.
https://lists.freedesktop.org/archives/spice-devel/2016-June/029942.html

 examples/spiceqxl.xorg.conf.example |  7 +++++++
 src/qxl.h                           |  1 +
 src/qxl_driver.c                    |  2 ++
 src/spiceqxl_spice_server.c         | 15 +++++++++++++++
 4 files changed, 25 insertions(+)

Patch hide | download patch | download mbox

diff --git a/examples/spiceqxl.xorg.conf.example b/examples/spiceqxl.xorg.conf.example
index ec6321e..b6f4840 100644
--- a/examples/spiceqxl.xorg.conf.example
+++ b/examples/spiceqxl.xorg.conf.example
@@ -52,6 +52,13 @@  Section "Device"
     # default: 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.
     # default: auto
     #Option "SpiceZlibGlzWanCompression" ""
diff --git a/src/qxl.h b/src/qxl.h
index ff55604..5cc8d05 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 e21addd..fc1b629 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -154,6 +154,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 b2b31ff..15b0531 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");
@@ -294,6 +297,18 @@  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(spice_server, playback_compression);
 

Comments

> +    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);

This should be 13.2, right?  Otherwise, both patches look good to me.

Cheers,

Jeremy
On Wed, 6 Jul 2016, Jeremy White wrote:

> > +    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);
> 
> This should be 13.2, right?  Otherwise, both patches look good to me.

Yes. Found the smoking gun in spice/server/spice-server.syms.
On 07/07/2016 08:09 AM, Francois Gouget wrote:
> On Wed, 6 Jul 2016, Jeremy White wrote:
> 
>>> +    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);
>>
>> This should be 13.2, right?  Otherwise, both patches look good to me.
> 
> Yes. Found the smoking gun in spice/server/spice-server.syms.

Thanks; the error message also needed a 13.2; I tweaked that and pushed
them both.

Cheers,

Jeremy