[Spice-commits] 2 commits - configure.ac src/channel-display.c

Pavel Grunt pgrunt at kemper.freedesktop.org
Mon Feb 6 10:40:39 UTC 2017


 configure.ac          |    2 +-
 src/channel-display.c |   41 ++++++++++++++++++-----------------------
 2 files changed, 19 insertions(+), 24 deletions(-)

New commits:
commit 9eac89e5a4b4ca7e170f4a53a78ea2525ce30c2d
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Fri Feb 3 14:27:01 2017 +0100

    streaming: Unify codec checking
    
    Avoid copy-pasting to add a new codec
    
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/src/channel-display.c b/src/channel-display.c
index 06d433b..ad92fab 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -701,6 +701,18 @@ static HDC create_compatible_dc(void)
 
 static void spice_display_channel_reset_capabilities(SpiceChannel *channel)
 {
+    guint i;
+    static const struct {
+        SpiceVideoCodecType type;
+        int cap;
+        const gchar name[8];
+    } gst_codecs[] = {
+        {SPICE_VIDEO_CODEC_TYPE_MJPEG, SPICE_DISPLAY_CAP_CODEC_MJPEG, "mjpeg"},
+        {SPICE_VIDEO_CODEC_TYPE_VP8, SPICE_DISPLAY_CAP_CODEC_VP8, "vp8"},
+        {SPICE_VIDEO_CODEC_TYPE_H264, SPICE_DISPLAY_CAP_CODEC_H264, "h264"},
+        {SPICE_VIDEO_CODEC_TYPE_VP9, SPICE_DISPLAY_CAP_CODEC_VP9, "vp9"},
+    };
+
     spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_SIZED_STREAM);
     spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_MONITORS_CONFIG);
     spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_COMPOSITE);
@@ -718,29 +730,12 @@ static void spice_display_channel_reset_capabilities(SpiceChannel *channel)
 #ifdef HAVE_BUILTIN_MJPEG
     spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_CODEC_MJPEG);
 #endif
-    if (gstvideo_has_codec(SPICE_VIDEO_CODEC_TYPE_MJPEG)) {
-        spice_channel_set_capability(SPICE_CHANNEL(channel),
-                                     SPICE_DISPLAY_CAP_CODEC_MJPEG);
-    } else {
-        SPICE_DEBUG("GStreamer does not support the mjpeg codec");
-    }
-    if (gstvideo_has_codec(SPICE_VIDEO_CODEC_TYPE_VP8)) {
-        spice_channel_set_capability(SPICE_CHANNEL(channel),
-                                     SPICE_DISPLAY_CAP_CODEC_VP8);
-    } else {
-        SPICE_DEBUG("GStreamer does not support the vp8 codec");
-    }
-    if (gstvideo_has_codec(SPICE_VIDEO_CODEC_TYPE_H264)) {
-        spice_channel_set_capability(SPICE_CHANNEL(channel),
-                                     SPICE_DISPLAY_CAP_CODEC_H264);
-    } else {
-        SPICE_DEBUG("GStreamer does not support the h264 codec");
-    }
-    if (gstvideo_has_codec(SPICE_VIDEO_CODEC_TYPE_VP9)) {
-        spice_channel_set_capability(SPICE_CHANNEL(channel),
-                                     SPICE_DISPLAY_CAP_CODEC_VP9);
-    } else {
-        SPICE_DEBUG("GStreamer does not support the vp9 codec");
+    for (i = 0; i < G_N_ELEMENTS(gst_codecs); i++) {
+        if (gstvideo_has_codec(gst_codecs[i].type)) {
+            spice_channel_set_capability(SPICE_CHANNEL(channel), gst_codecs[i].cap);
+        } else {
+            SPICE_DEBUG("GStreamer does not support the %s codec", gst_codecs[i].name);
+        }
     }
 }
 
commit 71d60859d6b04569db8b60117a42e8f6f9a85804
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Fri Feb 3 13:52:10 2017 +0100

    build-sys: Add VP9 check
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/configure.ac b/configure.ac
index ee083e4..463fbe0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,7 +265,7 @@ AS_IF([test "x$enable_gstvideo" != "xno"],
          [gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-video-1.0],
          [missing_gstreamer_elements=""
           SPICE_CHECK_GSTREAMER_ELEMENTS($GST_INSPECT_1_0, [gst-plugins-base 1.0], [appsrc videoconvert appsink])
-          SPICE_CHECK_GSTREAMER_ELEMENTS($GST_INSPECT_1_0, [gst-plugins-good 1.0], [jpegdec vp8dec])
+          SPICE_CHECK_GSTREAMER_ELEMENTS($GST_INSPECT_1_0, [gst-plugins-good 1.0], [jpegdec vp8dec vp9dec])
           SPICE_CHECK_GSTREAMER_ELEMENTS($GST_INSPECT_1_0, [gst-plugins-bad 1.0], [h264parse])
           SPICE_CHECK_GSTREAMER_ELEMENTS($GST_INSPECT_1_0, [gstreamer-libav 1.0], [avdec_h264])
           AS_IF([test x"$missing_gstreamer_elements" = "xyes"],


More information about the Spice-commits mailing list