Skip to content

Commit 9ff63a4

Browse files
committed
Merge pull request opencv#7314 from alalek:backport_7266
2 parents d68e350 + c314178 commit 9ff63a4

File tree

4 files changed

+1383
-23
lines changed

4 files changed

+1383
-23
lines changed

CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ endif()
137137
# Optional 3rd party components
138138
# ===================================================
139139
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) )
140-
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS)
140+
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON IF APPLE)
141141
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
142142
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT IOS) )
143143
OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" OFF IF (NOT ANDROID AND NOT IOS AND NOT CMAKE_CROSSCOMPILING) )
@@ -162,7 +162,8 @@ OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON
162162
OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS) )
163163
OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS) )
164164
OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 )
165-
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE )
165+
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O" OFF IF APPLE )
166+
OCV_OPTION(WITH_QTKIT "Use QTKit Video I/O backend" OFF IF APPLE )
166167
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS) )
167168
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
168169
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF WIN32 )
@@ -879,10 +880,6 @@ if(ANDROID)
879880
endif()
880881
endif()
881882

882-
if(DEFINED WITH_AVFOUNDATION)
883-
status(" AVFoundation:" WITH_AVFOUNDATION THEN YES ELSE NO)
884-
endif(DEFINED WITH_AVFOUNDATION)
885-
886883
if(DEFINED WITH_FFMPEG)
887884
if(WIN32)
888885
status(" FFMPEG:" WITH_FFMPEG THEN "YES (prebuilt binaries)" ELSE NO)
@@ -923,10 +920,15 @@ if(DEFINED WITH_GIGEAPI)
923920
status(" GigEVisionSDK:" HAVE_GIGE_API THEN YES ELSE NO)
924921
endif(DEFINED WITH_GIGEAPI)
925922

926-
if(DEFINED WITH_QUICKTIME)
923+
if(DEFINED APPLE)
924+
status(" AVFoundation:" HAVE_AVFOUNDATION THEN YES ELSE NO)
925+
if(WITH_QUICKTIME OR HAVE_QUICKTIME)
927926
status(" QuickTime:" HAVE_QUICKTIME THEN YES ELSE NO)
928-
status(" QTKit:" HAVE_QTKIT THEN YES ELSE NO)
929-
endif(DEFINED WITH_QUICKTIME)
927+
endif()
928+
if(WITH_QTKIT OR HAVE_QTKIT)
929+
status(" QTKit:" HAVE_QTKIT THEN "YES (deprecated)" ELSE NO)
930+
endif()
931+
endif(DEFINED APPLE)
930932

931933
if(DEFINED WITH_UNICAP)
932934
status(" UniCap:" HAVE_UNICAP THEN "YES (ver ${ALIASOF_libunicap_VERSION})" ELSE NO)

cmake/OpenCVFindLibsVideo.cmake

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,19 +273,18 @@ if(WIN32)
273273
endif()
274274
endif(WIN32)
275275

276-
# --- Apple AV Foundation ---
277-
if(WITH_AVFOUNDATION)
278-
set(HAVE_AVFOUNDATION YES)
279-
endif()
280-
281-
# --- QuickTime ---
282-
if (NOT IOS)
283-
if(WITH_QUICKTIME)
284-
set(HAVE_QUICKTIME YES)
285-
elseif(APPLE)
286-
set(HAVE_QTKIT YES)
276+
if(APPLE)
277+
if(WITH_AVFOUNDATION)
278+
set(HAVE_AVFOUNDATION YES)
287279
endif()
288-
endif()
280+
if(NOT IOS)
281+
if(WITH_QUICKTIME)
282+
set(HAVE_QUICKTIME YES)
283+
elseif(WITH_QTKIT)
284+
set(HAVE_QTKIT YES)
285+
endif()
286+
endif()
287+
endif(APPLE)
289288

290289
# --- Intel Perceptual Computing SDK ---
291290
if(WITH_INTELPERC)

modules/highgui/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,13 @@ if(HAVE_IMAGEIO AND IOS)
215215
endif()
216216

217217
if(HAVE_AVFOUNDATION)
218-
list(APPEND highgui_srcs src/cap_avfoundation.mm)
219-
list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
218+
if(IOS)
219+
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation.mm)
220+
list(APPEND HIGHGUI_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
221+
else()
222+
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation_mac.mm)
223+
list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa" "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreImage" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore")
224+
endif()
220225
endif()
221226

222227
if(HAVE_QUICKTIME)

0 commit comments

Comments
 (0)