[Spice-devel] [PATCH v2 1/2] autotools: Add automake conditional for gstreamer

Snir Sheriber ssheribe at redhat.com
Wed Jan 18 13:29:45 UTC 2017


Adding conditional for having gstreamer_0_10 or gstreamer_1_0
(and also a preprocessor symbol), removing the previous conditionals
and update relevant ifdefs with the newly defined changes
---
 configure.ac                       | 7 +++++--
 server/Makefile.am                 | 8 +-------
 server/reds.c                      | 4 ++--
 server/tests/test-codecs-parsing.c | 4 ++--
 server/video-encoder.h             | 2 +-
 5 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index a78b4ec..499cd81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,7 +85,6 @@ if test "x$enable_gstreamer" != "xno" && test "x$enable_gstreamer" != "x0.10"; t
           fi
     ])
 fi
-AM_CONDITIONAL(HAVE_GSTREAMER_1_0, test "x$have_gstreamer_1_0" = "xyes")
 
 if test "x$enable_gstreamer" != "xno" && test "x$enable_gstreamer" != "x1.0"; then
     SPICE_CHECK_GSTREAMER(GSTREAMER_0_10, 0.10, [gstreamer-0.10 gstreamer-base-0.10 gstreamer-app-0.10 gstreamer-video-0.10],
@@ -100,7 +99,11 @@ if test "x$enable_gstreamer" != "xno" && test "x$enable_gstreamer" != "x1.0"; th
          fi
     ])
 fi
-AM_CONDITIONAL(HAVE_GSTREAMER_0_10, test "x$have_gstreamer_0_10" = "xyes")
+AS_IF([test "x$have_gstreamer_0_10" = "xyes" || test "x$have_gstreamer_1_0" = "xyes"],
+      [AC_DEFINE([HAVE_GSTREAMER], [1], [Define if supporting GStreamer 0.10 or 1.0])
+      AM_CONDITIONAL(HAVE_GSTREAMER, true)], [
+      AM_CONDITIONAL(HAVE_GSTREAMER, false)
+])
 
 AS_IF([test "x$enable_gstreamer" = "xyes"],
       [AC_MSG_ERROR("GStreamer support requested but not found")],
diff --git a/server/Makefile.am b/server/Makefile.am
index 90ff779..ab7593a 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -186,13 +186,7 @@ libserver_la_SOURCES +=	\
 	$(NULL)
 endif
 
-if HAVE_GSTREAMER_0_10
-libserver_la_SOURCES +=	\
-	gstreamer-encoder.c			\
-	$(NULL)
-endif
-
-if HAVE_GSTREAMER_1_0
+if HAVE_GSTREAMER
 libserver_la_SOURCES +=	\
 	gstreamer-encoder.c			\
 	$(NULL)
diff --git a/server/reds.c b/server/reds.c
index e061e4d..bdb10e1 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3405,7 +3405,7 @@ err:
 }
 
 static const char default_renderer[] = "sw";
-#if defined(HAVE_GSTREAMER_1_0) || defined(HAVE_GSTREAMER_0_10)
+#if defined(HAVE_GSTREAMER)
 #define GSTREAMER_CODECS "gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8;"
 #else
 #define GSTREAMER_CODECS ""
@@ -3491,7 +3491,7 @@ static const EnumNames video_encoder_names[] = {
 
 static const new_video_encoder_t video_encoder_procs[] = {
     &mjpeg_encoder_new,
-#if defined(HAVE_GSTREAMER_1_0) || defined(HAVE_GSTREAMER_0_10)
+#if defined(HAVE_GSTREAMER)
     &gstreamer_encoder_new,
 #else
     NULL,
diff --git a/server/tests/test-codecs-parsing.c b/server/tests/test-codecs-parsing.c
index 5af2e5d..9799d72 100644
--- a/server/tests/test-codecs-parsing.c
+++ b/server/tests/test-codecs-parsing.c
@@ -32,7 +32,7 @@ static void codecs_good(void)
         "spice:mjpeg;;;",
         "spice:mjpeg;;spice:mjpeg;;;",
         ";;spice:mjpeg;;spice:mjpeg;;;",
-#if defined(HAVE_GSTREAMER_1_0) || defined(HAVE_GSTREAMER_0_10)
+#if defined(HAVE_GSTREAMER)
         "gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8;",
         ";;spice:mjpeg;;gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8;",
 #endif
@@ -117,7 +117,7 @@ static void codecs_bad(void)
             "*spice: unknown video codec unknown_codec",
             TRUE,
         },
-#if !defined(HAVE_GSTREAMER_1_0) && !defined(HAVE_GSTREAMER_0_10)
+#if !defined(HAVE_GSTREAMER)
         {
             "gstreamer:mjpeg",
             G_LOG_LEVEL_WARNING,
diff --git a/server/video-encoder.h b/server/video-encoder.h
index a4cd2b3..1ca9461 100644
--- a/server/video-encoder.h
+++ b/server/video-encoder.h
@@ -198,7 +198,7 @@ VideoEncoder* mjpeg_encoder_new(SpiceVideoCodecType codec_type,
                                 VideoEncoderRateControlCbs *cbs,
                                 bitmap_ref_t bitmap_ref,
                                 bitmap_unref_t bitmap_unref);
-#if defined(HAVE_GSTREAMER_1_0) || defined(HAVE_GSTREAMER_0_10)
+#if defined(HAVE_GSTREAMER)
 VideoEncoder* gstreamer_encoder_new(SpiceVideoCodecType codec_type,
                                     uint64_t starting_bit_rate,
                                     VideoEncoderRateControlCbs *cbs,
-- 
2.9.3



More information about the Spice-devel mailing list