[Spice-devel,v5,19/20] spice-gtk: Make it possible to disable support for the builtin MJPEG video decoder.

Submitted by Francois Gouget on Aug. 27, 2015, 7:03 p.m.

Details

Message ID alpine.DEB.2.20.1508272044570.22172@amboise
State New
Headers show

Not browsing as part of any series.

Commit Message

Francois Gouget Aug. 27, 2015, 7:03 p.m.
This makes it possible to test the GStreamer video decoder with MJPEG streams.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
---

Changes since take 2:
 - None.


 configure.ac          | 8 ++++++++
 src/Makefile.am       | 7 ++++++-
 src/channel-display.c | 2 ++
 3 files changed, 16 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/configure.ac b/configure.ac
index 8ee71ca..d20f3de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -357,6 +357,14 @@  AM_CONDITIONAL([HAVE_GSTVIDEO], [test "x$have_gst_video" = "xyes"])]
 AC_SUBST(GSTVIDEO_CFLAGS)
 AC_SUBST(GSTVIDEO_LIBS)
 
+AC_ARG_ENABLE([builtin-mjpeg],
+  AS_HELP_STRING([--enable-builtin-mjpeg], [Enable the builtin mjpeg video decoder @<:@default=yes@:>@]),
+  [],
+  enable_builtin_mjpeg="yes")
+AS_IF([test "x$enable_builtin_mjpeg" = "xyes"],
+      [AC_DEFINE([WITH_BUILTIN_MJPEG], 1, [Use the builtin mjpeg decoder?])])
+AM_CONDITIONAL(WITH_BUILTIN_MJPEG, [test "x$enable_builtin_mjpeg" != "xno"])
+
 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
     AC_MSG_CHECKING([for jpeglib.h])
     AC_TRY_CPP(
diff --git a/src/Makefile.am b/src/Makefile.am
index 925c75f..e744ce9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -255,7 +255,6 @@  libspice_client_glib_2_0_la_SOURCES =			\
 	channel-cursor.c				\
 	channel-display.c				\
 	channel-display-priv.h				\
-	channel-display-mjpeg.c				\
 	channel-inputs.c				\
 	channel-main.c					\
 	channel-playback.c				\
@@ -342,6 +341,12 @@  libspice_client_glib_2_0_la_SOURCES +=	\
 	$(NULL)
 endif
 
+if WITH_BUILTIN_MJPEG
+libspice_client_glib_2_0_la_SOURCES +=	\
+	channel-display-mjpeg.c		\
+	$(NULL)
+endif
+
 if HAVE_GSTVIDEO
 libspice_client_glib_2_0_la_SOURCES +=	\
 	channel-display-gst.c		\
diff --git a/src/channel-display.c b/src/channel-display.c
index e9cbf8d..ff305cf 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1009,9 +1009,11 @@  static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
     display_update_stream_region(st);
 
     switch (op->codec_type) {
+#ifdef WITH_BUILTIN_MJPEG
     case SPICE_VIDEO_CODEC_TYPE_MJPEG:
         st->video_decoder = create_mjpeg_decoder(op->codec_type, st);
         break;
+#endif
     default:
         st->video_decoder = create_gstreamer_decoder(op->codec_type, st);
     }

Comments

On Thu, Aug 27, 2015 at 09:03:13PM +0200, Francois Gouget wrote:
> This makes it possible to test the GStreamer video decoder with MJPEG streams.
> 
> Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> ---
> 
> Changes since take 2:
>  - None.
> 
> 
>  configure.ac          | 8 ++++++++
>  src/Makefile.am       | 7 ++++++-
>  src/channel-display.c | 2 ++
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 8ee71ca..d20f3de 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -357,6 +357,14 @@ AM_CONDITIONAL([HAVE_GSTVIDEO], [test "x$have_gst_video" = "xyes"])]
>  AC_SUBST(GSTVIDEO_CFLAGS)
>  AC_SUBST(GSTVIDEO_LIBS)
>  
> +AC_ARG_ENABLE([builtin-mjpeg],
> +  AS_HELP_STRING([--enable-builtin-mjpeg], [Enable the builtin mjpeg video decoder @<:@default=yes@:>@]),
> +  [],
> +  enable_builtin_mjpeg="yes")
> +AS_IF([test "x$enable_builtin_mjpeg" = "xyes"],
> +      [AC_DEFINE([WITH_BUILTIN_MJPEG], 1, [Use the builtin mjpeg decoder?])])
> +AM_CONDITIONAL(WITH_BUILTIN_MJPEG, [test "x$enable_builtin_mjpeg" != "xno"])
> +

I think we need to error out if --disable-builtin-mjpeg is used and
gstreamer support is disabled as the client is expected to support
mjpeg.

>  AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
>      AC_MSG_CHECKING([for jpeglib.h])
>      AC_TRY_CPP(
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 925c75f..e744ce9 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -255,7 +255,6 @@ libspice_client_glib_2_0_la_SOURCES =			\
>  	channel-cursor.c				\
>  	channel-display.c				\
>  	channel-display-priv.h				\
> -	channel-display-mjpeg.c				\
>  	channel-inputs.c				\
>  	channel-main.c					\
>  	channel-playback.c				\
> @@ -342,6 +341,12 @@ libspice_client_glib_2_0_la_SOURCES +=	\
>  	$(NULL)
>  endif
>  
> +if WITH_BUILTIN_MJPEG
> +libspice_client_glib_2_0_la_SOURCES +=	\
> +	channel-display-mjpeg.c		\
> +	$(NULL)
> +endif
> +
>  if HAVE_GSTVIDEO
>  libspice_client_glib_2_0_la_SOURCES +=	\
>  	channel-display-gst.c		\
> diff --git a/src/channel-display.c b/src/channel-display.c
> index e9cbf8d..ff305cf 100644
> --- a/src/channel-display.c
> +++ b/src/channel-display.c
> @@ -1009,9 +1009,11 @@ static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
>      display_update_stream_region(st);
>  
>      switch (op->codec_type) {
> +#ifdef WITH_BUILTIN_MJPEG
>      case SPICE_VIDEO_CODEC_TYPE_MJPEG:
>          st->video_decoder = create_mjpeg_decoder(op->codec_type, st);
>          break;
> +#endif

I'd wrap the prototype in channel-display-priv.h in #ifdef too.

Looks good otherwise,

Christophe