streaming: Allow disabling support for the builtin MJPEG video decoder

This makes it possible to test the GStreamer video decoder with MJPEG
streams.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
This commit is contained in:
Francois Gouget 2015-05-28 19:02:12 +02:00 committed by Pavel Grunt
parent 8891be2c2d
commit 3c11ac2c87
4 changed files with 24 additions and 1 deletions

View File

@ -289,6 +289,17 @@ AS_IF([test "x$enable_gstvideo" != "xno"],
)
AM_CONDITIONAL([HAVE_GSTVIDEO], [test "x$have_gstvideo" = "xyes"])
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([HAVE_BUILTIN_MJPEG], 1, [Use the builtin mjpeg decoder?])])
AM_CONDITIONAL(HAVE_BUILTIN_MJPEG, [test "x$enable_builtin_mjpeg" != "xno"])
AS_IF([test "x$enable_builtin_mjpeg$enable_gstvideo" = "xnono"],
[SPICE_WARNING([No builtin MJPEG or GStreamer decoder, video will not be streamed])])
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
AC_MSG_CHECKING([for jpeglib.h])
AC_TRY_CPP(

View File

@ -242,7 +242,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 \
@ -330,6 +329,12 @@ libspice_client_glib_2_0_la_SOURCES += \
$(NULL)
endif
if HAVE_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 \

View File

@ -68,7 +68,9 @@ struct VideoDecoder {
* @stream: The associated video stream.
* @return: A pointer to a structure implementing the VideoDecoder methods.
*/
#ifdef HAVE_BUILTIN_MJPEG
VideoDecoder* create_mjpeg_decoder(int codec_type, display_stream *stream);
#endif
#ifdef HAVE_GSTVIDEO
VideoDecoder* create_gstreamer_decoder(int codec_type, display_stream *stream);
gboolean gstvideo_init(void);

View File

@ -717,8 +717,11 @@ static void spice_display_channel_reset_capabilities(SpiceChannel *channel)
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_GL_SCANOUT);
#endif
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_MULTI_CODEC);
#ifdef HAVE_BUILTIN_MJPEG
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_CODEC_MJPEG);
#endif
if (gstvideo_init()) {
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_CODEC_MJPEG);
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_CODEC_VP8);
spice_channel_set_capability(SPICE_CHANNEL(channel), SPICE_DISPLAY_CAP_CODEC_H264);
}
@ -1098,9 +1101,11 @@ static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
display_update_stream_region(st);
switch (op->codec_type) {
#ifdef HAVE_BUILTIN_MJPEG
case SPICE_VIDEO_CODEC_TYPE_MJPEG:
st->video_decoder = create_mjpeg_decoder(op->codec_type, st);
break;
#endif
default:
#ifdef HAVE_GSTVIDEO
st->video_decoder = create_gstreamer_decoder(op->codec_type, st);