summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ui/qemu-spice.h15
-rw-r--r--qapi/ui.json5
-rw-r--r--qemu-options.hx9
-rw-r--r--ui/spice-core.c26
4 files changed, 50 insertions, 5 deletions
diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
index 21fe195e18..a5fbc44706 100644
--- a/include/ui/qemu-spice.h
+++ b/include/ui/qemu-spice.h
@@ -40,10 +40,17 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
#define SPICE_NEEDS_SET_MM_TIME 0
#endif
-#if defined(SPICE_SERVER_VERSION) && (SPICE_SERVER_VERSION >= 0x000f00)
-#define SPICE_HAS_ATTACHED_WORKER 1
-#else
-#define SPICE_HAS_ATTACHED_WORKER 0
+#if defined(SPICE_SERVER_VERSION)
+# if (SPICE_SERVER_VERSION >= 0x000d02)
+# define SPICE_HAS_VIDEO_CODECS 1
+# else
+# define SPICE_HAS_VIDEO_CODECS 0
+# endif
+# if (SPICE_SERVER_VERSION >= 0x000f00)
+# define SPICE_HAS_ATTACHED_WORKER 1
+# else
+# define SPICE_HAS_ATTACHED_WORKER 0
+# endif
#endif
#else /* CONFIG_SPICE */
diff --git a/qapi/ui.json b/qapi/ui.json
index 0abba3e930..42e73ac7d6 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
@@ -304,6 +304,8 @@
# - 'spice' uses SASL or direct TLS authentication, depending on command
# line options
#
+# @video-codecs: Video codecs used by the SPICE server.
+#
# @mouse-mode: The mode in which the mouse cursor is displayed currently. Can
# be determined by the client or the server, or unknown if spice
# server doesn't provide this information. (since: 1.1)
@@ -315,7 +317,8 @@
{ 'struct': 'SpiceInfo',
'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port': 'int',
'*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',
- 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']},
+ '*video-codecs': 'str', 'mouse-mode': 'SpiceQueryMouseMode',
+ '*channels': ['SpiceChannel']},
'if': 'CONFIG_SPICE' }
##
diff --git a/qemu-options.hx b/qemu-options.hx
index 7f99d15b23..5c90fc4e3c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2137,6 +2137,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
" [,jpeg-wan-compression=[auto|never|always]]\n"
" [,zlib-glz-wan-compression=[auto|never|always]]\n"
" [,streaming-video=[off|all|filter]][,disable-copy-paste=on|off]\n"
+ " [,video-codecs=[auto|<encoder>:<codec>[;<encoder2>:<codec2>]]\n"
" [,disable-agent-file-xfer=on|off][,agent-mouse=[on|off]]\n"
" [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
" [,gl=[on|off]][,rendernode=<file>]\n"
@@ -2224,6 +2225,14 @@ SRST
``streaming-video=[off|all|filter]``
Configure video stream detection. Default is off.
+ ``video-codecs=[auto|<encoder>:<codec>[;<encoder2>:<codec2>]]``
+ Configure what video codecs to use. It is a semicolon separated list
+ of encoder/codec pairs to try, in preference order. An encoder type
+ of ``spice`` selects built-in codecs. An encoder of ``gstreamer``
+ indicates gstreamer. The codec is the type of encoder, e.g. mjpeg,
+ vp8, etc., where ``auto`` selects the default preference order.
+ Default is ``spice:mjpeg``.
+
``agent-mouse=[on|off]``
Enable/disable passing mouse events via vdagent. Default is on.
diff --git a/ui/spice-core.c b/ui/spice-core.c
index c3ac20ad43..49fdcdf7e1 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -470,6 +470,11 @@ static QemuOptsList qemu_spice_opts = {
},{
.name = "streaming-video",
.type = QEMU_OPT_STRING,
+#ifdef SPICE_HAS_VIDEO_CODECS
+ },{
+ .name = "video-codecs",
+ .type = QEMU_OPT_STRING,
+#endif
},{
.name = "agent-mouse",
.type = QEMU_OPT_BOOL,
@@ -507,6 +512,9 @@ static SpiceInfo *qmp_query_spice_real(Error **errp)
unsigned int major;
unsigned int minor;
unsigned int micro;
+#ifdef SPICE_HAS_VIDEO_CODECS
+ const char *video_codecs;
+#endif
info = g_malloc0(sizeof(*info));
@@ -543,6 +551,14 @@ static SpiceInfo *qmp_query_spice_real(Error **errp)
info->tls_port = tls_port;
}
+#ifdef SPICE_HAS_VIDEO_CODECS
+ info->has_video_codecs = true;
+ video_codecs = spice_server_get_video_codecs(spice_server);
+ info->video_codecs = g_strdup(video_codecs);
+#else
+ info->has_video_codecs = false;
+#endif
+
info->mouse_mode = spice_server_is_server_mouse(spice_server) ?
SPICE_QUERY_MOUSE_MODE_SERVER :
SPICE_QUERY_MOUSE_MODE_CLIENT;
@@ -800,6 +816,16 @@ static void qemu_spice_init(void)
spice_server_set_streaming_video(spice_server, SPICE_STREAM_VIDEO_OFF);
}
+#ifdef SPICE_HAS_VIDEO_CODECS
+ str = qemu_opt_get(opts, "video-codecs");
+ if (str) {
+ if (spice_server_set_video_codecs(spice_server, str)) {
+ error_report("Invalid SPICE video codecs");
+ exit(1);
+ }
+ }
+#endif
+
spice_server_set_agent_mouse
(spice_server, qemu_opt_get_bool(opts, "agent-mouse", 1));
spice_server_set_playback_compression