[Spice-devel,v9,00/24] Add GStreamer support for video streaming

Submitted by Uri Lublin on Feb. 3, 2016, 10:34 a.m.

Details

Message ID 56B1D7C4.8080001@redhat.com
State New
Headers show

Not browsing as part of any series.

Patch hide | download patch | download mbox

diff --git a/qemu-options.hx b/qemu-options.hx
index 215d00d..70024ce 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1051,6 +1051,7 @@  DEF("spice", HAS_ARG, QEMU_OPTION_spice,
      "       [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
      "       [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"
      " [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
+    "       [,video-codecs=list-of-codecs]\n"
      "   enable spice\n"
      "   at least one of {port, tls-port} is mandatory\n",
      QEMU_ARCH_ALL)
@@ -1142,6 +1143,11 @@  Enable/disable audio stream compression (using 
celt 0.5.1).  Default is on.
  @item seamless-migration=[on|off]
  Enable/disable spice seamless migration. Default is off.

+@item video-codecs=list-of-codecs]
+Set spice video codecs. The list items are separated by semicolons (;)
+Current supported codecs are spice:mjpeg gstreamer:[mjpeg|v8|h264]
+Default is spice:mjpeg
+
  @end table
  ETEXI

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 6a62d71..769d162 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -496,6 +496,9 @@  static QemuOptsList qemu_spice_opts = {
          }, {
              .name = "seamless-migration",
              .type = QEMU_OPT_BOOL,
+        }, {
+            .name = "video-codecs",
+            .type = QEMU_OPT_STRING,
          },
          { /* end of list */ }
      },
@@ -794,6 +797,25 @@  void qemu_spice_init(void)

      seamless_migration = qemu_opt_get_bool(opts, "seamless-migration", 0);
      spice_server_set_seamless_migration(spice_server, seamless_migration);
+
+    str = qemu_opt_get(opts, "video-codecs");
+ #if SPICE_SERVER_VERSION >= 0x000c07 /* 0.12.7 */
+    if (str) {
+        if (spice_server_set_video_codecs(spice_server, str)) {
+            error_report("spice: invalid video encoder %s", str);
+            exit(1);
+        }
+    } else {
+        spice_server_set_video_codecs(spice_server, "spice:mjpeg");
+    }
+#else
+    if (str) {
+        error_report("this qemu build does not support the "
+                     "\"video-codecs\" option");
+        exit(1);
+    }
+#endif
+
      if (spice_server_init(spice_server, &core_interface) != 0) {
          error_report("failed to initialize spice server");
          exit(1);