From 38bb0db9dbec08666c8a64b3e4ead8fadf15c980 Mon Sep 17 00:00:00 2001 From: Samuel Martin Date: Mon, 6 Oct 2014 19:54:34 +0200 Subject: [PATCH] cmake: fix gstreamer check conditions The current situation of the Gstreamer detection does not always honor all the configurations set by the user, among this: - if both WITH_GSTREAMER and WITH_GSTREAMER_0_10 are off, but Gstreamer 0.10 is installed in the system, Gstreamer 0.10 support will be enable; - if both WITH_GSTREAMER and WITH_GSTREAMER_0_10 are on, only checks for Gstreamer 0.10 will be run. This patch fixes the Gstreamer detection like this: | -DWITH_... | Package installed || OpenCV | | GSTREAMER | GSTREAMER_0_10 | gst-1.x | gst-0.10 || gst. support | +===========+================+=========+==========##==============+ | OFF | OFF | - | - || none | | OFF | ON | - | no || none | | OFF | ON | - | yes || gst-0.10 | | ON | OFF | no | no || none | | ON | OFF | no | yes || gst-0.10 | | ON | OFF | yes | - || gst-1.x | | ON | ON | yes | - || gst-1.x | Signed-off-by: Samuel Martin --- cmake/OpenCVFindLibsVideo.cmake | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cmake/OpenCVFindLibsVideo.cmake b/cmake/OpenCVFindLibsVideo.cmake index 6ac9411b5e..ba2a3f716c 100644 --- a/cmake/OpenCVFindLibsVideo.cmake +++ b/cmake/OpenCVFindLibsVideo.cmake @@ -13,7 +13,7 @@ endif(WITH_VFW) # --- GStreamer --- ocv_clear_vars(HAVE_GSTREAMER) # try to find gstreamer 1.x first -if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10) +if(WITH_GSTREAMER) CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE) CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO) CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP) @@ -29,10 +29,18 @@ if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10) set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION}) endif() -endif(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10) +endif(WITH_GSTREAMER) -# if gstreamer 1.x was not found, or we specified we wanted 0.10, try to find it -if(WITH_GSTREAMER_0_10 OR NOT HAVE_GSTREAMER) +# gstreamer support was requested but could not find gstreamer 1.x, +# so fallback/try to find gstreamer 0.10 +if(WITH_GSTREAMER AND NOT HAVE_GSTREAMER) + set(WITH_GSTREAMER_0_10 ON) +endif() + +# if gstreamer 1.x was not found (fallback on gstreamer 0.10), or we specified +# we wanted gstreamer 0.10 support, +# then try to find it if not gstreamer support has not been found so far. +if(WITH_GSTREAMER_0_10 AND NOT HAVE_GSTREAMER) CHECK_MODULE(gstreamer-base-0.10 HAVE_GSTREAMER_BASE) CHECK_MODULE(gstreamer-video-0.10 HAVE_GSTREAMER_VIDEO) CHECK_MODULE(gstreamer-app-0.10 HAVE_GSTREAMER_APP) @@ -47,7 +55,7 @@ if(WITH_GSTREAMER_0_10 OR NOT HAVE_GSTREAMER) set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-0.10_VERSION}) set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-0.10_VERSION}) endif() -endif(WITH_GSTREAMER_0_10 OR NOT HAVE_GSTREAMER) +endif(WITH_GSTREAMER_0_10 AND NOT HAVE_GSTREAMER) # --- unicap --- ocv_clear_vars(HAVE_UNICAP)