diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b0958241f..3fe53c069b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -414,7 +414,7 @@ set(WITH_JPEG ON CACHE BOOL "Include JPEG support") set(WITH_JASPER ON CACHE BOOL "Include JPEG2K support") set(WITH_TIFF ON CACHE BOOL "Include TIFF support") set(WITH_OPENEXR ON CACHE BOOL "Include ILM support via OpenEXR") -endif() + if(UNIX) set(WITH_FFMPEG ON CACHE BOOL "Include FFMPEG support") @@ -429,11 +429,17 @@ if(UNIX) set(WITH_1394 ON CACHE BOOL "Include IEEE1394 support") endif() +endif() + if(APPLE) set(WITH_CARBON OFF CACHE BOOL "Use Carbon for UI instead of Cocoa") set(WITH_QUICKTIME OFF CACHE BOOL "Use QuickTime for Video I/O insted of QTKit") endif() +if(IOS) + set(WITH_AVFOUNDATION ON CACHE BOOL "Use AVFoundation for Video I/O") +endif() + set(WITH_TBB OFF CACHE BOOL "Include Intel TBB support") set(WITH_IPP OFF CACHE BOOL "Include Intel IPP support") set(WITH_EIGEN ON CACHE BOOL "Include Eigen2/Eigen3 support") diff --git a/cvconfig.h.cmake b/cvconfig.h.cmake index 4bd16dda90..602c12d19f 100644 --- a/cvconfig.h.cmake +++ b/cvconfig.h.cmake @@ -100,6 +100,9 @@ /* QuickTime video libraries */ #cmakedefine HAVE_QUICKTIME +/* AVFoundation video libraries */ +#cmakedefine HAVE_AVFOUNDATION + /* TIFF codec */ #cmakedefine HAVE_TIFF diff --git a/ios/cmake/Toolchains/Toolchain-iPhoneSimulator_Xcode.cmake b/ios/cmake/Toolchains/Toolchain-iPhoneSimulator_Xcode.cmake index 30189cc260..85bb17bdc5 100644 --- a/ios/cmake/Toolchains/Toolchain-iPhoneSimulator_Xcode.cmake +++ b/ios/cmake/Toolchains/Toolchain-iPhoneSimulator_Xcode.cmake @@ -1,4 +1,4 @@ -message (STATUS "Setting up iPhoneOS toolchain") +message (STATUS "Setting up iPhoneSimulator toolchain") set (IPHONESIMULATOR TRUE) # Standard settings @@ -21,4 +21,4 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -message (STATUS "iPhoneOS toolchain loaded") \ No newline at end of file +message (STATUS "iPhoneSimulator toolchain loaded") \ No newline at end of file diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 5712eb366d..26e5ea50dd 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -125,9 +125,7 @@ if(WIN32) endif() endif() -if(UNIX) - if(NOT IOS) - +if(UNIX) if(NOT HAVE_QT) if(HAVE_GTK) set(highgui_srcs ${highgui_srcs} src/window_gtk.cpp) @@ -174,8 +172,6 @@ if(UNIX) endif() endif() - endif(NOT IOS) - foreach(P ${HIGHGUI_INCLUDE_DIRS}) include_directories(${P}) endforeach() @@ -192,8 +188,11 @@ if(WITH_OPENNI AND HAVE_OPENNI) endif() #YV -if(APPLE AND NOT IOS) - add_definitions(-DHAVE_QUICKTIME=1) +if(APPLE) + if (NOT IOS) + add_definitions(-DHAVE_QUICKTIME=1) + endif() + if(NOT OPENCV_BUILD_3RDPARTY_LIBS) add_definitions(-DHAVE_IMAGEIO=1) endif() @@ -211,15 +210,19 @@ if(APPLE AND NOT IOS) if(WITH_QUICKTIME) set(highgui_srcs ${highgui_srcs} src/cap_qt.cpp) else() - set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm) + if (WITH_AVFOUNDATION) + add_definitions(-DHAVE_AVFOUNDATION=1) + set(highgui_srcs ${highgui_srcs} src/cap_avfoundation.mm) + else() + set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm) + endif() endif() + + + +endif(APPLE) -endif(APPLE AND NOT IOS) -if (IOS) - add_definitions(-DHAVE_IMAGEIO=1) - set(highgui_srcs ${highgui_srcs} src/cap_avfoundation.mm) -endif() if(WITH_ANDROID_CAMERA) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../androidcamera/include") diff --git a/modules/highgui/src/cap.cpp b/modules/highgui/src/cap.cpp index 5f7268407d..d0daec7d9d 100644 --- a/modules/highgui/src/cap.cpp +++ b/modules/highgui/src/cap.cpp @@ -157,7 +157,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) defined(HAVE_DC1394_2) || defined(HAVE_DC1394) || defined(HAVE_CMU1394) || \ defined(HAVE_GSTREAMER) || defined(HAVE_MIL) || defined(HAVE_QUICKTIME) || \ defined(HAVE_UNICAP) || defined(HAVE_PVAPI) || defined(HAVE_OPENNI) || defined(HAVE_ANDROID_NATIVE_CAMERA) || \ - defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) + defined(HAVE_AVFOUNDATION) // local variable to memorize the captured device CvCapture *capture; #endif @@ -281,7 +281,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) break; #endif - #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR + #ifdef HAVE_AVFOUNDATION case CV_CAP_AVFOUNDATION: capture = cvCreateCameraCapture_AVFoundation (index); if (capture) @@ -321,7 +321,7 @@ CV_IMPL CvCapture * cvCreateFileCapture (const char * filename) result = cvCreateFileCapture_QT (filename); #endif - #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR + #ifdef HAVE_AVFOUNDATION if (! result) result = cvCreateFileCapture_AVFoundation (filename); #endif @@ -354,7 +354,7 @@ CV_IMPL CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, result = cvCreateVideoWriter_XINE(filename, fourcc, fps, frameSize, is_color); #endif */ - #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR + #ifdef HAVE_AVFOUNDATION if (! result) result = cvCreateVideoWriter_AVFoundation(filename, fourcc, fps, frameSize, is_color); #endif diff --git a/modules/highgui/src/precomp.hpp b/modules/highgui/src/precomp.hpp index b4980bff25..87e6cac1bb 100644 --- a/modules/highgui/src/precomp.hpp +++ b/modules/highgui/src/precomp.hpp @@ -134,6 +134,8 @@ CvCapture* cvCreateCameraCapture_DShow( int index ); CvCapture* cvCreateCameraCapture_OpenNI( int index ); CvCapture* cvCreateCameraCapture_Android( int index ); CvCapture* cvCreateCameraCapture_XIMEA( int index ); +CvCapture* cvCreateCameraCapture_AVFoundation(int index); + CVAPI(int) cvHaveImageReader(const char* filename); CVAPI(int) cvHaveImageWriter(const char* filename); @@ -143,6 +145,9 @@ CvVideoWriter* cvCreateVideoWriter_Images(const char* filename); CvCapture* cvCreateFileCapture_XINE (const char* filename); + + + #define CV_CAP_GSTREAMER_1394 0 #define CV_CAP_GSTREAMER_V4L 1 #define CV_CAP_GSTREAMER_V4L2 2 @@ -161,6 +166,11 @@ CvCapture * cvCreateCameraCapture_QT (const int index); CvVideoWriter* cvCreateVideoWriter_QT ( const char* filename, int fourcc, double fps, CvSize frameSize, int is_color ); +CvCapture* cvCreateFileCapture_AVFoundation (const char * filename); +CvVideoWriter* cvCreateVideoWriter_AVFoundation( const char* filename, int fourcc, + double fps, CvSize frameSize, int is_color ); + + CvCapture * cvCreateCameraCapture_Unicap (const int index); CvCapture * cvCreateCameraCapture_PvAPI (const int index); CvVideoWriter* cvCreateVideoWriter_GStreamer( const char* filename, int fourcc,