From 7ff07e94a3e66dfcea6bd6e290a07a41a2712098 Mon Sep 17 00:00:00 2001 From: kamjagin Date: Wed, 14 Aug 2013 13:33:47 +0200 Subject: [PATCH 1/3] Fix for bug Bug #3215. Added HAVE_QTKIT as a separate mode from HAVE_QUICKTIME --- CMakeLists.txt | 4 ++-- cmake/OpenCVFindLibsVideo.cmake | 2 ++ cmake/templates/cvconfig.h.cmake | 3 +++ modules/highgui/CMakeLists.txt | 2 +- modules/highgui/src/cap.cpp | 9 +++++---- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46881c453..0e745e7f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -745,8 +745,8 @@ if(DEFINED WITH_GIGEAPI) endif(DEFINED WITH_GIGEAPI) if(DEFINED WITH_QUICKTIME) - status(" QuickTime:" WITH_QUICKTIME THEN YES ELSE NO) - status(" QTKit:" WITH_QUICKTIME THEN NO ELSE YES) + status(" QuickTime:" HAVE_QUICKTIME THEN YES ELSE NO) + status(" QTKit:" HAVE_QTKIT THEN YES ELSE NO) endif(DEFINED WITH_QUICKTIME) if(DEFINED WITH_UNICAP) diff --git a/cmake/OpenCVFindLibsVideo.cmake b/cmake/OpenCVFindLibsVideo.cmake index 027b53668..d80531bf4 100644 --- a/cmake/OpenCVFindLibsVideo.cmake +++ b/cmake/OpenCVFindLibsVideo.cmake @@ -244,4 +244,6 @@ endif() # --- QuickTime --- if(WITH_QUICKTIME) set(HAVE_QUICKTIME YES) +elseif(APPLE) + set(HAVE_QTKIT YES) endif() diff --git a/cmake/templates/cvconfig.h.cmake b/cmake/templates/cvconfig.h.cmake index 7587eef6b..833d1eb3d 100644 --- a/cmake/templates/cvconfig.h.cmake +++ b/cmake/templates/cvconfig.h.cmake @@ -133,6 +133,9 @@ /* QuickTime video libraries */ #cmakedefine HAVE_QUICKTIME +/* QTKit video libraries */ +#cmakedefine HAVE_QTKIT + /* Intel Threading Building Blocks */ #cmakedefine HAVE_TBB diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 3d7667b65..b49d93a96 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -213,7 +213,7 @@ endif() if(HAVE_QUICKTIME) list(APPEND highgui_srcs src/cap_qt.cpp) list(APPEND HIGHGUI_LIBRARIES "-framework Carbon" "-framework QuickTime" "-framework CoreFoundation" "-framework QuartzCore") -elseif(APPLE) +elseif(HAVE_QTKIT) list(APPEND highgui_srcs src/cap_qtkit.mm) list(APPEND HIGHGUI_LIBRARIES "-framework QTKit" "-framework QuartzCore" "-framework AppKit") endif() diff --git a/modules/highgui/src/cap.cpp b/modules/highgui/src/cap.cpp index b5cdc5e9f..e9242b849 100644 --- a/modules/highgui/src/cap.cpp +++ b/modules/highgui/src/cap.cpp @@ -135,7 +135,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) #ifdef HAVE_MIL CV_CAP_MIL, #endif -#ifdef HAVE_QUICKTIME +if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT) CV_CAP_QT, #endif #ifdef HAVE_UNICAP @@ -185,6 +185,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) defined(HAVE_CMU1394) || \ defined(HAVE_MIL) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_UNICAP) || \ defined(HAVE_PVAPI) || \ defined(HAVE_OPENNI) || \ @@ -277,7 +278,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) break; #endif -#ifdef HAVE_QUICKTIME +#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT) case CV_CAP_QT: capture = cvCreateCameraCapture_QT (index); if (capture) @@ -378,7 +379,7 @@ CV_IMPL CvCapture * cvCreateFileCapture (const char * filename) result = cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename); #endif -#ifdef HAVE_QUICKTIME +#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT) if (! result) result = cvCreateFileCapture_QT (filename); #endif @@ -436,7 +437,7 @@ CV_IMPL CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, result = cvCreateVideoWriter_AVFoundation(filename, fourcc, fps, frameSize, is_color); #endif -#ifdef HAVE_QUICKTIME +#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT) if(!result) result = cvCreateVideoWriter_QT(filename, fourcc, fps, frameSize, is_color); #endif From c24c1a5926c139ea1b5c48fda7e9332a69e00719 Mon Sep 17 00:00:00 2001 From: kamjagin Date: Wed, 14 Aug 2013 13:40:50 +0200 Subject: [PATCH 2/3] added HAVE_QTKIT to tests --- modules/gpu/perf/perf_video.cpp | 1 + modules/gpu/test/test_bgfg.cpp | 1 + modules/highgui/perf/perf_precomp.hpp | 2 ++ modules/highgui/test/test_precomp.hpp | 3 +++ 4 files changed, 7 insertions(+) diff --git a/modules/gpu/perf/perf_video.cpp b/modules/gpu/perf/perf_video.cpp index 672d657b2..f0f33970f 100644 --- a/modules/gpu/perf/perf_video.cpp +++ b/modules/gpu/perf/perf_video.cpp @@ -49,6 +49,7 @@ using namespace perf; #if defined(HAVE_XINE) || \ defined(HAVE_GSTREAMER) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_AVFOUNDATION) || \ defined(HAVE_FFMPEG) || \ defined(WIN32) /* assume that we have ffmpeg */ diff --git a/modules/gpu/test/test_bgfg.cpp b/modules/gpu/test/test_bgfg.cpp index 0ab89842d..6ef93c51b 100644 --- a/modules/gpu/test/test_bgfg.cpp +++ b/modules/gpu/test/test_bgfg.cpp @@ -49,6 +49,7 @@ using namespace cvtest; #if defined(HAVE_XINE) || \ defined(HAVE_GSTREAMER) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_AVFOUNDATION) || \ defined(HAVE_FFMPEG) || \ defined(WIN32) /* assume that we have ffmpeg */ diff --git a/modules/highgui/perf/perf_precomp.hpp b/modules/highgui/perf/perf_precomp.hpp index d6b28b6d2..7a9ea8adc 100644 --- a/modules/highgui/perf/perf_precomp.hpp +++ b/modules/highgui/perf/perf_precomp.hpp @@ -19,6 +19,7 @@ #if defined(HAVE_XINE) || \ defined(HAVE_GSTREAMER) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_AVFOUNDATION) || \ defined(HAVE_FFMPEG) || \ defined(HAVE_MSMF) || \ @@ -33,6 +34,7 @@ #if /*defined(HAVE_XINE) || */\ defined(HAVE_GSTREAMER) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_AVFOUNDATION) || \ defined(HAVE_FFMPEG) || \ defined(HAVE_MSMF) || \ diff --git a/modules/highgui/test/test_precomp.hpp b/modules/highgui/test/test_precomp.hpp index 5e030810f..7e9f4c63a 100644 --- a/modules/highgui/test/test_precomp.hpp +++ b/modules/highgui/test/test_precomp.hpp @@ -27,6 +27,7 @@ defined(HAVE_CMU1394) || \ defined(HAVE_MIL) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_UNICAP) || \ defined(HAVE_PVAPI) || \ defined(HAVE_OPENNI) || \ @@ -43,6 +44,7 @@ #if defined(HAVE_XINE) || \ defined(HAVE_GSTREAMER) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_AVFOUNDATION) || \ /*defined(HAVE_OPENNI) || too specialized */ \ defined(HAVE_FFMPEG) || \ @@ -55,6 +57,7 @@ #if /*defined(HAVE_XINE) || */\ defined(HAVE_GSTREAMER) || \ defined(HAVE_QUICKTIME) || \ + defined(HAVE_QTKIT) || \ defined(HAVE_AVFOUNDATION) || \ defined(HAVE_FFMPEG) || \ defined(HAVE_MSMF) From 69287c936bb5c3a6d62169c72e48211a49efcd9f Mon Sep 17 00:00:00 2001 From: kamjagin Date: Wed, 14 Aug 2013 14:25:46 +0200 Subject: [PATCH 3/3] missed # in if defined --- modules/highgui/src/cap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/highgui/src/cap.cpp b/modules/highgui/src/cap.cpp index e9242b849..c97db180f 100644 --- a/modules/highgui/src/cap.cpp +++ b/modules/highgui/src/cap.cpp @@ -135,7 +135,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) #ifdef HAVE_MIL CV_CAP_MIL, #endif -if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT) +#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT) CV_CAP_QT, #endif #ifdef HAVE_UNICAP