From 073a7ff95acedd3bcc61e5552c629695292125d0 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 23 Sep 2014 22:06:12 +0200 Subject: [PATCH 1/2] Fixed CMake issue with FFMPEG highgui configuration Currently, FFMPEG source files are included in highgui project file regardless of CMake WITH_FFMPEG option. After applying this PR FFMPEG files are included only if WITH_FFMPEG option is enabled. --- modules/highgui/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 9abd960191..3a7826ad4e 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -54,13 +54,11 @@ source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs}) set(highgui_hdrs src/precomp.hpp src/utils.hpp - src/cap_ffmpeg_impl.hpp ) set(highgui_srcs src/cap.cpp src/cap_images.cpp - src/cap_ffmpeg.cpp src/loadsave.cpp src/utils.cpp src/window.cpp @@ -186,6 +184,8 @@ if(HAVE_XIMEA) endif(HAVE_XIMEA) if(HAVE_FFMPEG) + list(APPEND highgui_hdrs src/cap_ffmpeg_impl.hpp) + list(APPEND highgui_srcs src/cap_ffmpeg.cpp) if(UNIX AND BZIP2_LIBRARIES) list(APPEND HIGHGUI_LIBRARIES ${BZIP2_LIBRARIES}) endif() From 93d1ceae436ec8244af263494c38884cf9ccc55e Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 23 Sep 2014 23:48:37 +0200 Subject: [PATCH 2/2] Use FFMPEG capture only if HAVE_FFMPEG flag is defined. --- modules/highgui/src/cap.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/highgui/src/cap.cpp b/modules/highgui/src/cap.cpp index f3dc8b9787..491e388559 100644 --- a/modules/highgui/src/cap.cpp +++ b/modules/highgui/src/cap.cpp @@ -368,8 +368,10 @@ CV_IMPL CvCapture * cvCreateFileCapture (const char * filename) { CvCapture * result = 0; +#ifdef HAVE_FFMPEG if (! result) result = cvCreateFileCapture_FFMPEG_proxy (filename); +#endif #ifdef HAVE_VFW if (! result) @@ -426,8 +428,10 @@ CV_IMPL CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, if(!fourcc || !fps) result = cvCreateVideoWriter_Images(filename); +#ifdef HAVE_FFMPEG if(!result) result = cvCreateVideoWriter_FFMPEG_proxy (filename, fourcc, fps, frameSize, is_color); +#endif #ifdef HAVE_VFW if(!result) @@ -459,6 +463,19 @@ CV_IMPL CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, result = cvCreateVideoWriter_GStreamer(filename, fourcc, fps, frameSize, is_color); #endif +#if !defined(HAVE_FFMPEG) && \ + !defined(HAVE_VFW) && \ + !defined(HAVE_MSMF) && \ + !defined(HAVE_AVFOUNDATION) && \ + !defined(HAVE_QUICKTIME) && \ + !defined(HAVE_QTKIT) && \ + !defined(HAVE_GSTREAMER) +// If none of the writers is used +// these statements suppress 'unused parameter' warnings. + (void)frameSize; + (void)is_color; +#endif + if(!result) result = cvCreateVideoWriter_Images(filename);