Adding support for WinRT(WinPhone 8/8.1 and Win Store) via CMake 3.1

- Substituted HAVE_WINRT with WINRT
- Fixed compilation issues in ocl.cpp and parallel.cpp
- Fixed compiler issue for WP8: "C2678: binary '+' : no operator found which takes a left-hand - Fixed gitignore
- Added #ifdef HAVE_OPENCL to remove compiler warnings in ocl.cpp
- Used NO_GETENV similar to '3rdparty\libjpeg\jmemmgr.c;
- Added ole32.lib for core module (for WindowsStore 8.0 builds)
- Made OpenCV_ARCH aware of ARM

Signed-off-by: Maxim Kostin <v-maxkos@microsoft.com>
pull/3700/head
Maxim Kostin 10 years ago
parent 5850a9b8c3
commit cdd23440c9
  1. 9
      .gitignore
  2. 4
      3rdparty/libpng/CMakeLists.txt
  3. 4
      3rdparty/libpng/opencv-libpng.patch
  4. 4
      3rdparty/libpng/pngpriv.h
  5. 4
      3rdparty/libtiff/CMakeLists.txt
  6. 94
      CMakeLists.txt
  7. 60
      cmake/OpenCVCRTLinkage.cmake
  8. 3
      cmake/OpenCVConfig.cmake
  9. 3
      cmake/OpenCVDetectCXXCompiler.cmake
  10. 3
      cmake/templates/cvconfig.h.in
  11. 11
      modules/core/CMakeLists.txt
  12. 10
      modules/core/src/glob.cpp
  13. 16
      modules/core/src/ocl.cpp
  14. 4
      modules/core/src/parallel.cpp
  15. 16
      modules/core/src/system.cpp
  16. 2
      modules/cudaarithm/CMakeLists.txt
  17. 2
      modules/cudacodec/CMakeLists.txt
  18. 2
      modules/cudafeatures2d/CMakeLists.txt
  19. 2
      modules/cudafilters/CMakeLists.txt
  20. 2
      modules/cudaimgproc/CMakeLists.txt
  21. 2
      modules/cudaoptflow/CMakeLists.txt
  22. 2
      modules/cudastereo/CMakeLists.txt
  23. 2
      modules/cudawarping/CMakeLists.txt
  24. 7
      modules/highgui/CMakeLists.txt
  25. 6
      modules/imgcodecs/CMakeLists.txt
  26. 2
      modules/java/CMakeLists.txt
  27. 2
      modules/python/CMakeLists.txt
  28. 2
      modules/superres/CMakeLists.txt
  29. 2
      modules/ts/CMakeLists.txt
  30. 2
      modules/ts/include/opencv2/ts.hpp
  31. 6
      modules/videoio/CMakeLists.txt
  32. 2
      modules/videoio/src/cap_ffmpeg.cpp
  33. 74
      modules/videoio/src/cap_msmf.cpp
  34. 36
      modules/videoio/src/cap_msmf.hpp

9
.gitignore vendored

@ -8,3 +8,12 @@
Thumbs.db Thumbs.db
tags tags
tegra/ tegra/
bin/
CMakeFiles/
*.sdf
*.opensdf
*.obj
*.stamp
*.depend
*.rule
*.tmp

@ -29,10 +29,6 @@ if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC) endif(MSVC)
if (HAVE_WINRT)
add_definitions(-DHAVE_WINRT)
endif()
add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs}) add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES}) target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES})

@ -7,7 +7,7 @@ index 07b2b0b..e7824b8 100644
/* Memory model/platform independent fns */ /* Memory model/platform independent fns */
#ifndef PNG_ABORT #ifndef PNG_ABORT
-# ifdef _WINDOWS_ -# ifdef _WINDOWS_
+# if defined(_WINDOWS_) && !defined(HAVE_WINRT) +# if defined(_WINDOWS_) && !defined(WINRT)
# define PNG_ABORT() ExitProcess(0) # define PNG_ABORT() ExitProcess(0)
# else # else
# define PNG_ABORT() abort() # define PNG_ABORT() abort()
@ -16,7 +16,7 @@ index 07b2b0b..e7824b8 100644
# define png_memset _fmemset # define png_memset _fmemset
#else #else
-# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */ -# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
+# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */ +# if defined(_WINDOWS_) && !defined(WINRT) /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr) # define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen lstrlenA # define png_strlen lstrlenA

@ -360,7 +360,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
/* Memory model/platform independent fns */ /* Memory model/platform independent fns */
#ifndef PNG_ABORT #ifndef PNG_ABORT
# if defined(_WINDOWS_) && !defined(HAVE_WINRT) # if defined(_WINDOWS_) && !defined(WINRT)
# define PNG_ABORT() ExitProcess(0) # define PNG_ABORT() ExitProcess(0)
# else # else
# define PNG_ABORT() abort() # define PNG_ABORT() abort()
@ -378,7 +378,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
# define png_memcpy _fmemcpy # define png_memcpy _fmemcpy
# define png_memset _fmemset # define png_memset _fmemset
#else #else
# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */ # if defined(_WINDOWS_) && !defined(WINRT) /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr) # define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen lstrlenA # define png_strlen lstrlenA

@ -17,7 +17,7 @@ check_include_file(string.h HAVE_STRING_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(unistd.h HAVE_UNISTD_H)
if(WIN32 AND NOT HAVE_WINRT) if(WIN32)
set(USE_WIN32_FILEIO 1) set(USE_WIN32_FILEIO 1)
endif() endif()
@ -79,7 +79,7 @@ set(lib_srcs
"${CMAKE_CURRENT_BINARY_DIR}/tif_config.h" "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h"
) )
if(WIN32 AND NOT HAVE_WINRT) if(WIN32)
list(APPEND lib_srcs tif_win32.c) list(APPEND lib_srcs tif_win32.c)
else() else()
list(APPEND lib_srcs tif_unix.c) list(APPEND lib_srcs tif_unix.c)

@ -12,6 +12,12 @@ include(cmake/OpenCVMinDepVersions.cmake)
if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3) if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3)
cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
elseif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
#Required to resolve linker error issues due to incompatibility with CMake v3.0+ policies.
#CMake fails to find _fseeko() which leads to subsequent linker error.
#See details here: http://www.cmake.org/Wiki/CMake/Policies
cmake_policy(VERSION 2.8)
else() else()
cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR) cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR)
endif() endif()
@ -33,6 +39,13 @@ else(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
endif(NOT CMAKE_TOOLCHAIN_FILE) endif(NOT CMAKE_TOOLCHAIN_FILE)
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
set(WINRT TRUE)
endif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
if(WINRT)
add_definitions(-DWINRT -DNO_GETENV)
endif()
if(POLICY CMP0022) if(POLICY CMP0022)
cmake_policy(SET CMP0022 OLD) cmake_policy(SET CMP0022 OLD)
@ -120,66 +133,66 @@ endif()
# Optional 3rd party components # Optional 3rd party components
# =================================================== # ===================================================
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS) OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS)
OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE ) OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE )
OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (NOT IOS) ) OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (NOT IOS) ) OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (NOT IOS) ) OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (NOT IOS AND NOT APPLE) ) OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (NOT IOS AND NOT APPLE) )
OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON) OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON IF (NOT WINRT) )
OCV_OPTION(WITH_VFW "Include Video for Windows support" ON IF WIN32 ) OCV_OPTION(WITH_VFW "Include Video for Windows support" ON IF WIN32 )
OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS)) OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT ANDROID) ) OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT ANDROID) )
OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF ) OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF )
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_IPP "Include Intel IPP support" ON IF (X86_64 OR X86) ) OCV_OPTION(WITH_IPP "Include Intel IPP support" ON IF (X86_64 OR X86) AND NOT WINRT)
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) ) OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
OCV_OPTION(WITH_JPEG "Include JPEG support" ON) OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS) ) OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) ) OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID) ) OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT WINRT) )
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_PNG "Include PNG support" ON) OCV_OPTION(WITH_PNG "Include PNG support" ON)
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 ) OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 AND NOT WINRT)
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE ) OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE )
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS) ) OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF) OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF)
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF WIN32 ) OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) )
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) ) OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) ) OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) )
OCV_OPTION(WITH_LIBV4L "Use libv4l for Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) ) OCV_OPTION(WITH_LIBV4L "Use libv4l for Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) )
OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON IF (WIN32 AND NOT ARM) ) OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON IF (WIN32 AND NOT ARM AND NOT WINRT) )
OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" OFF IF WIN32 ) OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" OFF IF WIN32 )
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID) ) OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT WINRT) )
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF) OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF)
OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" NOT ANDROID IF (NOT IOS) ) OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" NOT ANDROID IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENCL_SVM "Include OpenCL Shared Virtual Memory support" OFF ) # experimental OCV_OPTION(WITH_OPENCL_SVM "Include OpenCL Shared Virtual Memory support" OFF ) # experimental
OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON IF WIN32 ) OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON IF (WIN32 AND NOT WINRT) )
OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF WIN32 ) OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF (WIN32 AND NOT WINRT) )
OCV_OPTION(WITH_IPP_A "Include Intel IPP_A support" OFF IF (MSVC OR X86 OR X86_64) ) OCV_OPTION(WITH_IPP_A "Include Intel IPP_A support" OFF IF (MSVC OR X86 OR X86_64) )
OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
# OpenCV build components # OpenCV build components
# =================================================== # ===================================================
OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" NOT (ANDROID OR IOS) ) OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" NOT (ANDROID OR IOS) )
OCV_OPTION(BUILD_opencv_apps "Build utility applications (used for example to train classifiers)" (NOT ANDROID) IF (NOT IOS) ) OCV_OPTION(BUILD_opencv_apps "Build utility applications (used for example to train classifiers)" (NOT ANDROID AND NOT WINRT) IF (NOT IOS) )
OCV_OPTION(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID ) OCV_OPTION(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID )
OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" ON ) OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" ON IF NOT WINRT)
OCV_OPTION(BUILD_EXAMPLES "Build all examples" OFF ) OCV_OPTION(BUILD_EXAMPLES "Build all examples" OFF )
OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON ) OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON IF NOT WINRT)
OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS) ) OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS) ) OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS AND NOT WINRT) )
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON ) OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC ) OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF ) OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF )
@ -194,7 +207,7 @@ OCV_OPTION(BUILD_TIFF "Build libtiff from source" WIN32 O
OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR ANDROID OR APPLE ) OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR ANDROID OR APPLE )
OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR ANDROID OR APPLE ) OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR ANDROID OR APPLE )
OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR ANDROID OR APPLE ) OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR ANDROID OR APPLE )
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" WIN32 OR ANDROID OR APPLE ) OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (WIN32 OR ANDROID OR APPLE) AND NOT WINRT)
OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID ) OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID )
# OpenCV installation options # OpenCV installation options
@ -229,8 +242,6 @@ OCV_OPTION(ENABLE_NEON "Enable NEON instructions"
OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF CMAKE_COMPILER_IS_GNUCXX AND (ARM OR AARCH64 OR IOS) ) OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF CMAKE_COMPILER_IS_GNUCXX AND (ARM OR AARCH64 OR IOS) )
OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF ) OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF )
OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF ) OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF )
OCV_OPTION(ENABLE_WINRT_MODE "Build with Windows Runtime support" OFF IF WIN32 )
OCV_OPTION(ENABLE_WINRT_MODE_NATIVE "Build with Windows Runtime native C++ support" OFF IF WIN32 )
OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID ) OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF ) OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF )
@ -759,11 +770,12 @@ endif()
# ================== Windows RT features ================== # ================== Windows RT features ==================
if(WIN32) if(WIN32)
status("") status("")
status(" Windows RT support:" HAVE_WINRT THEN YES ELSE NO) status(" Windows RT support:" WINRT THEN YES ELSE NO)
if (ENABLE_WINRT_MODE OR ENABLE_WINRT_MODE_NATIVE) if(WINRT)
status(" Windows SDK v8.0:" ${WINDOWS_SDK_PATH}) status(" Building for Microsoft platform: " ${CMAKE_SYSTEM_NAME})
status(" Visual Studio 2012:" ${VISUAL_STUDIO_PATH}) status(" Building for architectures: " ${CMAKE_VS_EFFECTIVE_PLATFORMS})
endif() status(" Building for version: " ${CMAKE_SYSTEM_VERSION})
endif()
endif(WIN32) endif(WIN32)
# ========================== GUI ========================== # ========================== GUI ==========================
@ -913,7 +925,7 @@ endif(DEFINED WITH_OPENNI)
if(DEFINED WITH_OPENNI2) if(DEFINED WITH_OPENNI2)
status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (ver ${OPENNI2_VERSION_STRING}, build ${OPENNI2_VERSION_BUILD})" status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (ver ${OPENNI2_VERSION_STRING}, build ${OPENNI2_VERSION_BUILD})"
ELSE NO) ELSE NO)
endif(DEFINED WITH_OPENNI2) endif(DEFINED WITH_OPENNI2)
if(DEFINED WITH_PVAPI) if(DEFINED WITH_PVAPI)

@ -2,47 +2,37 @@ if(NOT MSVC)
message(FATAL_ERROR "CRT options are available only for MSVC") message(FATAL_ERROR "CRT options are available only for MSVC")
endif() endif()
#INCLUDE (CheckIncludeFiles) #if (${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore" OR ${CMAKE_SYSTEM_NAME} MATCHES "WindowsPhone")
# set(WINRT TRUE)
set(HAVE_WINRT FALSE) if (WINRT)
add_definitions(/DWINVER=_WIN32_WINNT_WIN8 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=_WIN32_WINNT_WIN8)
# search Windows Platform SDK
message(STATUS "Checking for Windows Platform SDK")
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
if(WINDOWS_SDK_PATH STREQUAL "")
set(HAVE_MSPDK FALSE)
message(STATUS "Windows Platform SDK 8.0 was not found")
else()
set(HAVE_MSPDK TRUE)
endif() endif()
#search for Visual Studio 11.0 install directory # Removing LNK4075 warnings for debug WinRT builds
message(STATUS "Checking for Visual Studio 2012") # "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification"
GET_FILENAME_COMPONENT(VISUAL_STUDIO_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] REALPATH CACHE) # "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification"
if(VISUAL_STUDIO_PATH STREQUAL "") if(MSVC AND WINRT)
set(HAVE_MSVC2012 FALSE) # Optional verification checks since we don't know existing contents of variables below
message(STATUS "Visual Studio 2012 was not found") string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
else() string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
set(HAVE_MSVC2012 TRUE) string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
endif() string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
try_compile(HAVE_WINRT_SDK string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
"${OpenCV_BINARY_DIR}" string(REPLACE "/OPT:REF " "/OPT:NORE F" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
"${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp") string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
if(ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
set(HAVE_WINRT TRUE) string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
set(HAVE_WINRT_CX TRUE) string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
elseif(ENABLE_WINRT_MODE_NATIVE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
set(HAVE_WINRT TRUE)
set(HAVE_WINRT_CX FALSE)
endif()
if(HAVE_WINRT) # Mandatory
add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602) set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /appcontainer") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /appcontainer") set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /appcontainer")
endif() endif()
if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT) if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)

@ -65,6 +65,9 @@ if(MSVC)
if(CMAKE_CL_64) if(CMAKE_CL_64)
set(OpenCV_ARCH x64) set(OpenCV_ARCH x64)
set(OpenCV_TBB_ARCH intel64) set(OpenCV_TBB_ARCH intel64)
elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
# see Modules/CmakeGenericSystem.cmake
set(OpenCV_ARCH ARM)
else() else()
set(OpenCV_ARCH x86) set(OpenCV_ARCH x86)
set(OpenCV_TBB_ARCH ia32) set(OpenCV_TBB_ARCH ia32)

@ -127,6 +127,9 @@ endif()
if(MSVC) if(MSVC)
if(CMAKE_CL_64) if(CMAKE_CL_64)
set(OpenCV_ARCH x64) set(OpenCV_ARCH x64)
elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
# see Modules/CmakeGenericSystem.cmake
set(OpenCV_ARCH ARM)
else() else()
set(OpenCV_ARCH x86) set(OpenCV_ARCH x86)
endif() endif()

@ -169,9 +169,6 @@
/* Win32 UI */ /* Win32 UI */
#cmakedefine HAVE_WIN32UI #cmakedefine HAVE_WIN32UI
/* Windows Runtime support */
#cmakedefine HAVE_WINRT
/* XIMEA camera support */ /* XIMEA camera support */
#cmakedefine HAVE_XIMEA #cmakedefine HAVE_XIMEA

@ -1,11 +1,10 @@
set(the_description "The Core Functionality") set(the_description "The Core Functionality")
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev) ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev)
if(HAVE_WINRT_CX) set(extra_libs "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() if(WINRT AND CMAKE_SYSTEM_NAME MATCHES WindowsStore AND CMAKE_SYSTEM_VERSION MATCHES "8.0")
if(HAVE_WINRT) list(APPEND extra_libs ole32.lib)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"")
endif() endif()
if(HAVE_CUDA) if(HAVE_CUDA)
@ -22,7 +21,7 @@ ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail}) HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS}) ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS})
ocv_create_module() ocv_create_module(${extra_libs})
ocv_add_accuracy_tests() ocv_add_accuracy_tests()
ocv_add_perf_tests() ocv_add_perf_tests()

@ -56,14 +56,14 @@ namespace
struct DIR struct DIR
{ {
#ifdef HAVE_WINRT #ifdef WINRT
WIN32_FIND_DATAW data; WIN32_FIND_DATAW data;
#else #else
WIN32_FIND_DATA data; WIN32_FIND_DATA data;
#endif #endif
HANDLE handle; HANDLE handle;
dirent ent; dirent ent;
#ifdef HAVE_WINRT #ifdef WINRT
DIR() { } DIR() { }
~DIR() ~DIR()
{ {
@ -77,7 +77,7 @@ namespace
{ {
DIR* dir = new DIR; DIR* dir = new DIR;
dir->ent.d_name = 0; dir->ent.d_name = 0;
#ifdef HAVE_WINRT #ifdef WINRT
cv::String full_path = cv::String(path) + "\\*"; cv::String full_path = cv::String(path) + "\\*";
wchar_t wfull_path[MAX_PATH]; wchar_t wfull_path[MAX_PATH];
size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH); size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH);
@ -99,7 +99,7 @@ namespace
dirent* readdir(DIR* dir) dirent* readdir(DIR* dir)
{ {
#ifdef HAVE_WINRT #ifdef WINRT
if (dir->ent.d_name != 0) if (dir->ent.d_name != 0)
{ {
if (::FindNextFileW(dir->handle, &dir->data) != TRUE) if (::FindNextFileW(dir->handle, &dir->data) != TRUE)
@ -147,7 +147,7 @@ static bool isDir(const cv::String& path, DIR* dir)
else else
{ {
WIN32_FILE_ATTRIBUTE_DATA all_attrs; WIN32_FILE_ATTRIBUTE_DATA all_attrs;
#ifdef HAVE_WINRT #ifdef WINRT
wchar_t wpath[MAX_PATH]; wchar_t wpath[MAX_PATH];
size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH); size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1)); CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));

@ -64,7 +64,15 @@
// TODO Move to some common place // TODO Move to some common place
static bool getBoolParameter(const char* name, bool defaultValue) static bool getBoolParameter(const char* name, bool defaultValue)
{ {
/*
* If your system doesn't support getenv(), define NO_GETENV to disable
* this feature.
*/
#ifdef NO_GETENV
const char* envValue = NULL;
#else
const char* envValue = getenv(name); const char* envValue = getenv(name);
#endif
if (envValue == NULL) if (envValue == NULL)
{ {
return defaultValue; return defaultValue;
@ -85,7 +93,7 @@ static bool getBoolParameter(const char* name, bool defaultValue)
// TODO Move to some common place // TODO Move to some common place
static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue) static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue)
{ {
#ifdef HAVE_WINRT #ifdef NO_GETENV
const char* envValue = NULL; const char* envValue = NULL;
#else #else
const char* envValue = getenv(name); const char* envValue = getenv(name);
@ -728,7 +736,7 @@ static void* initOpenCLAndLoad(const char* funcname)
static HMODULE handle = 0; static HMODULE handle = 0;
if (!handle) if (!handle)
{ {
#ifndef HAVE_WINRT #ifndef WINRT
if(!initialized) if(!initialized)
{ {
handle = LoadLibraryA("OpenCL.dll"); handle = LoadLibraryA("OpenCL.dll");
@ -2190,6 +2198,7 @@ inline cl_int getStringInfo(Functor f, ObjectType obj, cl_uint name, std::string
return CL_SUCCESS; return CL_SUCCESS;
} }
#ifdef HAVE_OPENCL
static void split(const std::string &s, char delim, std::vector<std::string> &elems) static void split(const std::string &s, char delim, std::vector<std::string> &elems)
{ {
elems.clear(); elems.clear();
@ -2230,8 +2239,9 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr,
} }
return true; return true;
} }
#endif
#ifdef HAVE_WINRT #ifdef WINRT
static cl_device_id selectOpenCLDevice() static cl_device_id selectOpenCLDevice()
{ {
return NULL; return NULL;

@ -69,7 +69,7 @@
#define HAVE_GCD #define HAVE_GCD
#endif #endif
#if defined _MSC_VER && _MSC_VER >= 1600 #if defined _MSC_VER && _MSC_VER >= 1600 && !defined(WINRT)
#define HAVE_CONCURRENCY #define HAVE_CONCURRENCY
#endif #endif
@ -458,7 +458,7 @@ int cv::getNumberOfCPUs(void)
{ {
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
SYSTEM_INFO sysinfo; SYSTEM_INFO sysinfo;
#if defined(_M_ARM) || defined(_M_X64) || defined(HAVE_WINRT) #if defined(_M_ARM) || defined(_M_X64) || defined(WINRT)
GetNativeSystemInfo( &sysinfo ); GetNativeSystemInfo( &sysinfo );
#else #else
GetSystemInfo( &sysinfo ); GetSystemInfo( &sysinfo );

@ -109,7 +109,7 @@
#endif #endif
#endif #endif
#ifdef HAVE_WINRT #ifdef WINRT
#include <wrl/client.h> #include <wrl/client.h>
#ifndef __cplusplus_winrt #ifndef __cplusplus_winrt
#include <windows.storage.h> #include <windows.storage.h>
@ -159,7 +159,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
UINT(g.Data4[2]), UINT(g.Data4[3]), UINT(g.Data4[4]), UINT(g.Data4[2]), UINT(g.Data4[3]), UINT(g.Data4[4]),
UINT(g.Data4[5]), UINT(g.Data4[6]), UINT(g.Data4[7])); UINT(g.Data4[5]), UINT(g.Data4[6]), UINT(g.Data4[7]));
return prefix + std::wstring(guidStr); return prefix.append(std::wstring(guidStr));
} }
#endif #endif
@ -542,12 +542,12 @@ String format( const char* fmt, ... )
String tempfile( const char* suffix ) String tempfile( const char* suffix )
{ {
String fname; String fname;
#ifndef HAVE_WINRT #ifndef WINRT
const char *temp_dir = getenv("OPENCV_TEMP_PATH"); const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif #endif
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
#ifdef HAVE_WINRT #ifdef WINRT
RoInitialize(RO_INIT_MULTITHREADED); RoInitialize(RO_INIT_MULTITHREADED);
std::wstring temp_dir = L""; std::wstring temp_dir = L"";
const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str(); const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str();
@ -559,7 +559,7 @@ String tempfile( const char* suffix )
if (temp_file.empty()) if (temp_file.empty())
return String(); return String();
temp_file = temp_dir + std::wstring(L"\\") + temp_file; temp_file = temp_dir.append(std::wstring(L"\\")).append(temp_file);
DeleteFileW(temp_file.c_str()); DeleteFileW(temp_file.c_str());
char aname[MAX_PATH]; char aname[MAX_PATH];
@ -955,7 +955,7 @@ public:
#pragma warning(disable:4505) // unreferenced local function has been removed #pragma warning(disable:4505) // unreferenced local function has been removed
#endif #endif
#ifdef HAVE_WINRT #ifdef WINRT
// using C++11 thread attribute for local thread data // using C++11 thread attribute for local thread data
static __declspec( thread ) TLSStorage* g_tlsdata = NULL; static __declspec( thread ) TLSStorage* g_tlsdata = NULL;
@ -1006,10 +1006,10 @@ public:
} }
return d; return d;
} }
#endif //HAVE_WINRT #endif //WINRT
#if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE #if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
#ifdef HAVE_WINRT #ifdef WINRT
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model #pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
#endif #endif

@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaarithm) ocv_module_disable(cudaarithm)
endif() endif()

@ -1,4 +1,4 @@
if(IOS OR APPLE OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR APPLE OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudacodec) ocv_module_disable(cudacodec)
endif() endif()

@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudafeatures2d) ocv_module_disable(cudafeatures2d)
endif() endif()

@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudafilters) ocv_module_disable(cudafilters)
endif() endif()

@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaimgproc) ocv_module_disable(cudaimgproc)
endif() endif()

@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaoptflow) ocv_module_disable(cudaoptflow)
endif() endif()

@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudastereo) ocv_module_disable(cudastereo)
endif() endif()

@ -1,4 +1,4 @@
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudawarping) ocv_module_disable(cudawarping)
endif() endif()

@ -1,3 +1,7 @@
if (WINRT)
ocv_module_disable(highgui)
endif()
set(the_description "High-level GUI and Media I/O") set(the_description "High-level GUI and Media I/O")
ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL opencv_androidcamera) ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL opencv_androidcamera)
@ -7,7 +11,8 @@ ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL o
# Jose Luis Blanco, 2008 # Jose Luis Blanco, 2008
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(HAVE_WINRT_CX) # Compilation with /ZW is not allowed for *.c files
if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() endif()

@ -1,3 +1,7 @@
if(WINRT)
ocv_module_disable(imgcodecs)
endif()
set(the_description "Image codecs") set(the_description "Image codecs")
ocv_add_module(imgcodecs opencv_imgproc) ocv_add_module(imgcodecs opencv_imgproc)
@ -9,7 +13,7 @@ ocv_add_module(imgcodecs opencv_imgproc)
ocv_clear_vars(GRFMT_LIBS) ocv_clear_vars(GRFMT_LIBS)
if(HAVE_WINRT_CX) if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() endif()

@ -1,7 +1,7 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CMake file for java support # CMake file for java support
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(IOS OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)) if(IOS OR WINRT OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7))
OR BUILD_opencv_world OR BUILD_opencv_world
) )
ocv_module_disable(java) ocv_module_disable(java)

@ -9,7 +9,7 @@ if((WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
ocv_module_disable(python3) ocv_module_disable(python3)
endif() endif()
if(ANDROID OR IOS) if(ANDROID OR IOS OR WINRT)
ocv_module_disable(python2) ocv_module_disable(python2)
ocv_module_disable(python3) ocv_module_disable(python3)
endif() endif()

@ -1,4 +1,4 @@
if(IOS) if(IOS OR WINRT)
ocv_module_disable(superres) ocv_module_disable(superres)
endif() endif()

@ -1,6 +1,6 @@
set(the_description "The ts module") set(the_description "The ts module")
if(IOS) if(IOS OR WINRT)
ocv_module_disable(ts) ocv_module_disable(ts)
endif() endif()

@ -6,7 +6,7 @@
#include "cvconfig.h" #include "cvconfig.h"
#ifdef HAVE_WINRT #ifdef WINRT
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model #pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
#endif #endif

@ -1,3 +1,7 @@
if(WINRT)
ocv_module_disable(videoio)
endif()
set(the_description "Media I/O") set(the_description "Media I/O")
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera) ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera)
@ -7,7 +11,7 @@ ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidca
# Jose Luis Blanco, 2008 # Jose Luis Blanco, 2008
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(HAVE_WINRT_CX) if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() endif()

@ -85,7 +85,7 @@ private:
icvInitFFMPEG() icvInitFFMPEG()
{ {
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
# ifdef HAVE_WINRT # ifdef WINRT
const wchar_t* module_name = L"opencv_ffmpeg" const wchar_t* module_name = L"opencv_ffmpeg"
CVAUX_STRW(CV_MAJOR_VERSION) CVAUX_STRW(CV_MINOR_VERSION) CVAUX_STRW(CV_SUBMINOR_VERSION) CVAUX_STRW(CV_MAJOR_VERSION) CVAUX_STRW(CV_MINOR_VERSION) CVAUX_STRW(CV_SUBMINOR_VERSION)
#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__)

@ -86,7 +86,7 @@
#include <mferror.h> #include <mferror.h>
#ifdef HAVE_WINRT #ifdef WINRT
// for ComPtr usage // for ComPtr usage
#include <wrl/client.h> #include <wrl/client.h>
#ifdef __cplusplus_winrt #ifdef __cplusplus_winrt
@ -266,7 +266,7 @@ public:
#endif #endif
struct IMFMediaType; struct IMFMediaType;
#ifndef HAVE_WINRT #ifndef WINRT
struct IMFActivate; struct IMFActivate;
struct IMFMediaSource; struct IMFMediaSource;
#endif #endif
@ -406,7 +406,7 @@ private:
ImageGrabberCallback& operator=(const ImageGrabberCallback&); // Declared to fix compilation warning. ImageGrabberCallback& operator=(const ImageGrabberCallback&); // Declared to fix compilation warning.
}; };
#ifdef HAVE_WINRT #ifdef WINRT
extern const __declspec(selectany) WCHAR RuntimeClass_CV_ImageGrabberWinRT[] = L"cv.ImageGrabberWinRT"; extern const __declspec(selectany) WCHAR RuntimeClass_CV_ImageGrabberWinRT[] = L"cv.ImageGrabberWinRT";
class ImageGrabberWinRT : class ImageGrabberWinRT :
@ -547,7 +547,7 @@ public:
CamParametrs getParametrs(); CamParametrs getParametrs();
void setParametrs(CamParametrs parametrs); void setParametrs(CamParametrs parametrs);
void setEmergencyStopEvent(void *userData, void(*func)(int, void *)); void setEmergencyStopEvent(void *userData, void(*func)(int, void *));
#ifdef HAVE_WINRT #ifdef WINRT
long readInfoOfDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice, unsigned int Num); long readInfoOfDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice, unsigned int Num);
void waitForDevice() void waitForDevice()
{ {
@ -593,7 +593,7 @@ private:
std::map<UINT64, FrameRateMap> vd_CaptureFormats; std::map<UINT64, FrameRateMap> vd_CaptureFormats;
std::vector<MediaType> vd_CurrentFormats; std::vector<MediaType> vd_CurrentFormats;
IMFMediaSource *vd_pSource; IMFMediaSource *vd_pSource;
#ifdef HAVE_WINRT #ifdef WINRT
MAKE_WRL_AGILE_REF(_MediaCapture) vd_pMedCap; MAKE_WRL_AGILE_REF(_MediaCapture) vd_pMedCap;
EventRegistrationToken vd_cookie; EventRegistrationToken vd_cookie;
ImageGrabberWinRT *vd_pImGr; ImageGrabberWinRT *vd_pImGr;
@ -608,7 +608,7 @@ private:
long setDeviceFormat(IMFMediaSource *pSource, unsigned long dwFormatIndex); long setDeviceFormat(IMFMediaSource *pSource, unsigned long dwFormatIndex);
void buildLibraryofTypes(); void buildLibraryofTypes();
int findType(unsigned int size, unsigned int frameRate = 0); int findType(unsigned int size, unsigned int frameRate = 0);
#ifdef HAVE_WINRT #ifdef WINRT
HRESULT enumerateCaptureFormats(MAKE_WRL_REF(_MediaCapture) pSource); HRESULT enumerateCaptureFormats(MAKE_WRL_REF(_MediaCapture) pSource);
long setDeviceFormat(MAKE_WRL_REF(_MediaCapture) pSource, unsigned long dwFormatIndex, MAKE_WRL_REF(_AsyncAction)* pAction); long setDeviceFormat(MAKE_WRL_REF(_MediaCapture) pSource, unsigned long dwFormatIndex, MAKE_WRL_REF(_AsyncAction)* pAction);
long resetDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice); long resetDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice);
@ -627,7 +627,7 @@ class videoDevices
{ {
public: public:
~videoDevices(void); ~videoDevices(void);
#ifdef HAVE_WINRT #ifdef WINRT
long initDevices(_DeviceClass devClass); long initDevices(_DeviceClass devClass);
void waitInit() { void waitInit() {
if (vds_enumTask) { if (vds_enumTask) {
@ -646,7 +646,7 @@ public:
void clearDevices(); void clearDevices();
private: private:
UINT32 count; UINT32 count;
#ifdef HAVE_WINRT #ifdef WINRT
MAKE_WRL_REF(_AsyncAction) vds_enumTask; MAKE_WRL_REF(_AsyncAction) vds_enumTask;
#endif #endif
std::vector<videoDevice *> vds_Devices; std::vector<videoDevice *> vds_Devices;
@ -715,7 +715,7 @@ public:
bool setupDevice(int deviceID, unsigned int w, unsigned int h, unsigned int idealFramerate = 30); bool setupDevice(int deviceID, unsigned int w, unsigned int h, unsigned int idealFramerate = 30);
// Checking of recivig of new frame from video device with deviceID // Checking of recivig of new frame from video device with deviceID
bool isFrameNew(int deviceID); bool isFrameNew(int deviceID);
#ifdef HAVE_WINRT #ifdef WINRT
void waitForDevice(int deviceID); void waitForDevice(int deviceID);
#endif #endif
// Writing of Raw Data pixels from video device with deviceID with correction of RedAndBlue flipping flipRedAndBlue and vertical flipping flipImage // Writing of Raw Data pixels from video device with deviceID with correction of RedAndBlue flipping flipRedAndBlue and vertical flipping flipImage
@ -1237,7 +1237,7 @@ ImageGrabber::~ImageGrabber(void)
DebugPrintOut(L"IMAGEGRABBER VIDEODEVICE %i: Destroying instance of the ImageGrabber class\n", ig_DeviceID); DebugPrintOut(L"IMAGEGRABBER VIDEODEVICE %i: Destroying instance of the ImageGrabber class\n", ig_DeviceID);
} }
#ifdef HAVE_WINRT #ifdef WINRT
ImageGrabberWinRT::ImageGrabberWinRT(bool synchronous): ImageGrabberWinRT::ImageGrabberWinRT(bool synchronous):
ImageGrabberCallback(synchronous), ImageGrabberCallback(synchronous),
@ -1899,7 +1899,7 @@ Media_Foundation::~Media_Foundation(void)
bool Media_Foundation::buildListOfDevices() bool Media_Foundation::buildListOfDevices()
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
#ifdef HAVE_WINRT #ifdef WINRT
videoDevices *vDs = &videoDevices::getInstance(); videoDevices *vDs = &videoDevices::getInstance();
hr = vDs->initDevices(WRL_ENUM_GET(_DeviceClass, DeviceClass, VideoCapture)); hr = vDs->initDevices(WRL_ENUM_GET(_DeviceClass, DeviceClass, VideoCapture));
#else #else
@ -1987,7 +1987,7 @@ unsigned char * RawImage::getpPixels()
videoDevice::videoDevice(void): vd_IsSetuped(false), vd_LockOut(OpenLock), vd_pFriendlyName(NULL), videoDevice::videoDevice(void): vd_IsSetuped(false), vd_LockOut(OpenLock), vd_pFriendlyName(NULL),
vd_Width(0), vd_Height(0), vd_FrameRate(0), vd_pSource(NULL), vd_pImGrTh(NULL), vd_func(NULL), vd_userData(NULL) vd_Width(0), vd_Height(0), vd_FrameRate(0), vd_pSource(NULL), vd_pImGrTh(NULL), vd_func(NULL), vd_userData(NULL)
{ {
#ifdef HAVE_WINRT #ifdef WINRT
vd_pMedCap = nullptr; vd_pMedCap = nullptr;
vd_cookie.value = 0; vd_cookie.value = 0;
vd_pImGr = NULL; vd_pImGr = NULL;
@ -2075,7 +2075,7 @@ CamParametrs videoDevice::getParametrs()
return out; return out;
} }
#ifdef HAVE_WINRT #ifdef WINRT
long videoDevice::resetDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice) long videoDevice::resetDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice)
#else #else
long videoDevice::resetDevice(IMFActivate *pActivate) long videoDevice::resetDevice(IMFActivate *pActivate)
@ -2086,7 +2086,7 @@ long videoDevice::resetDevice(IMFActivate *pActivate)
if(vd_pFriendlyName) if(vd_pFriendlyName)
CoTaskMemFree(vd_pFriendlyName); CoTaskMemFree(vd_pFriendlyName);
vd_pFriendlyName = NULL; vd_pFriendlyName = NULL;
#ifdef HAVE_WINRT #ifdef WINRT
if (pDevice) if (pDevice)
{ {
ACTIVATE_OBJ(RuntimeClass_Windows_Media_Capture_MediaCapture, _MediaCapture, pIMedCap, hr) ACTIVATE_OBJ(RuntimeClass_Windows_Media_Capture_MediaCapture, _MediaCapture, pIMedCap, hr)
@ -2157,7 +2157,7 @@ long videoDevice::resetDevice(IMFActivate *pActivate)
return hr; return hr;
} }
#ifdef HAVE_WINRT #ifdef WINRT
long videoDevice::readInfoOfDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice, unsigned int Num) long videoDevice::readInfoOfDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice, unsigned int Num)
{ {
HRESULT hr = -1; HRESULT hr = -1;
@ -2173,7 +2173,7 @@ long videoDevice::readInfoOfDevice(IMFActivate *pActivate, unsigned int Num)
} }
#endif #endif
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
long videoDevice::checkDevice(_DeviceClass devClass, DEFINE_TASK<void>* pTask, MAKE_WRL_REF(_IDeviceInformation)* ppDevice) long videoDevice::checkDevice(_DeviceClass devClass, DEFINE_TASK<void>* pTask, MAKE_WRL_REF(_IDeviceInformation)* ppDevice)
{ {
@ -2273,7 +2273,7 @@ long videoDevice::initDevice()
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
CoInitialize(NULL); CoInitialize(NULL);
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
Concurrency::critical_section::scoped_lock _LockHolder(vd_lock); Concurrency::critical_section::scoped_lock _LockHolder(vd_lock);
MAKE_WRL_REF(_AsyncAction) pOldAction = vd_pAction; MAKE_WRL_REF(_AsyncAction) pOldAction = vd_pAction;
@ -2381,7 +2381,7 @@ void videoDevice::closeDevice()
{ {
vd_IsSetuped = false; vd_IsSetuped = false;
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) { if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) {
MAKE_WRL_REF(_AsyncAction) action; MAKE_WRL_REF(_AsyncAction) action;
@ -2535,7 +2535,7 @@ void videoDevice::buildLibraryofTypes()
} }
} }
#ifdef HAVE_WINRT #ifdef WINRT
long videoDevice::setDeviceFormat(MAKE_WRL_REF(_MediaCapture) pSource, unsigned long dwFormatIndex, MAKE_WRL_REF(_AsyncAction)* pAction) long videoDevice::setDeviceFormat(MAKE_WRL_REF(_MediaCapture) pSource, unsigned long dwFormatIndex, MAKE_WRL_REF(_AsyncAction)* pAction)
{ {
HRESULT hr; HRESULT hr;
@ -2596,7 +2596,7 @@ bool videoDevice::isDeviceSetup()
RawImage * videoDevice::getRawImageOut() RawImage * videoDevice::getRawImageOut()
{ {
if(!vd_IsSetuped) return NULL; if(!vd_IsSetuped) return NULL;
#ifdef HAVE_WINRT #ifdef WINRT
if(vd_pImGr) return vd_pImGr->getRawImage(); if(vd_pImGr) return vd_pImGr->getRawImage();
#endif #endif
if(vd_pImGrTh) if(vd_pImGrTh)
@ -2618,7 +2618,7 @@ bool videoDevice::isFrameNew()
vd_LockOut = RawDataLock; vd_LockOut = RawDataLock;
//must already be closed //must already be closed
#ifdef HAVE_WINRT #ifdef WINRT
if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) { if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) {
MAKE_WRL_REF(_AsyncAction) action; MAKE_WRL_REF(_AsyncAction) action;
if (FAILED(ImageGrabberWinRT::CreateInstance(&vd_pImGr))) return false; if (FAILED(ImageGrabberWinRT::CreateInstance(&vd_pImGr))) return false;
@ -2649,7 +2649,7 @@ bool videoDevice::isFrameNew()
vd_pImGrTh->start(); vd_pImGrTh->start();
return true; return true;
} }
#ifdef HAVE_WINRT #ifdef WINRT
if(vd_pImGr) if(vd_pImGr)
return vd_pImGr->getRawImage()->isNew(); return vd_pImGr->getRawImage()->isNew();
#endif #endif
@ -2678,7 +2678,7 @@ bool videoDevice::setupDevice(unsigned int id)
HRESULT hr = initDevice(); HRESULT hr = initDevice();
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
Concurrency::critical_section::scoped_lock _LockHolder(vd_lock); Concurrency::critical_section::scoped_lock _LockHolder(vd_lock);
MAKE_WRL_REF(_AsyncAction) pOldAction = vd_pAction; MAKE_WRL_REF(_AsyncAction) pOldAction = vd_pAction;
@ -2692,7 +2692,7 @@ bool videoDevice::setupDevice(unsigned int id)
vd_Height = vd_CurrentFormats[id].height; vd_Height = vd_CurrentFormats[id].height;
vd_FrameRate = vd_CurrentFormats[id].MF_MT_FRAME_RATE_NUMERATOR / vd_FrameRate = vd_CurrentFormats[id].MF_MT_FRAME_RATE_NUMERATOR /
vd_CurrentFormats[id].MF_MT_FRAME_RATE_DENOMINATOR; vd_CurrentFormats[id].MF_MT_FRAME_RATE_DENOMINATOR;
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) { if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) {
DEFINE_TASK<void> _task; DEFINE_TASK<void> _task;
@ -2710,7 +2710,7 @@ bool videoDevice::setupDevice(unsigned int id)
if(vd_IsSetuped) if(vd_IsSetuped)
DebugPrintOut(L"\n\nVIDEODEVICE %i: Device is setuped \n", vd_CurrentNumber); DebugPrintOut(L"\n\nVIDEODEVICE %i: Device is setuped \n", vd_CurrentNumber);
vd_PrevParametrs = getParametrs(); vd_PrevParametrs = getParametrs();
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
END_CREATE_ASYNC(hr)); END_CREATE_ASYNC(hr));
#endif #endif
@ -2749,7 +2749,7 @@ wchar_t *videoDevice::getName()
videoDevice::~videoDevice(void) videoDevice::~videoDevice(void)
{ {
closeDevice(); closeDevice();
#ifdef HAVE_WINRT #ifdef WINRT
RELEASE_WRL(vd_pMedCap) RELEASE_WRL(vd_pMedCap)
#endif #endif
SafeRelease(&vd_pSource); SafeRelease(&vd_pSource);
@ -2757,7 +2757,7 @@ videoDevice::~videoDevice(void)
CoTaskMemFree(vd_pFriendlyName); CoTaskMemFree(vd_pFriendlyName);
} }
#ifdef HAVE_WINRT #ifdef WINRT
HRESULT videoDevice::enumerateCaptureFormats(MAKE_WRL_REF(_MediaCapture) pSource) HRESULT videoDevice::enumerateCaptureFormats(MAKE_WRL_REF(_MediaCapture) pSource)
{ {
HRESULT hr; HRESULT hr;
@ -2831,7 +2831,7 @@ done:
videoDevices::videoDevices(void): count(0) videoDevices::videoDevices(void): count(0)
{ {
#ifdef HAVE_WINRT #ifdef WINRT
vds_enumTask = nullptr; vds_enumTask = nullptr;
#endif #endif
} }
@ -2862,7 +2862,7 @@ videoDevice * videoDevices::getDevice(unsigned int i)
return vds_Devices[i]; return vds_Devices[i];
} }
#ifdef HAVE_WINRT #ifdef WINRT
long videoDevices::initDevices(_DeviceClass devClass) long videoDevices::initDevices(_DeviceClass devClass)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
@ -3196,7 +3196,7 @@ bool videoInput::isFrameNew(int deviceID)
return false; return false;
} }
#ifdef HAVE_WINRT #ifdef WINRT
void videoInput::waitForDevice(int deviceID) void videoInput::waitForDevice(int deviceID)
{ {
if (deviceID < 0) if (deviceID < 0)
@ -3405,7 +3405,7 @@ unsigned int videoInput::listDevices(bool silent)
if(accessToDevices) if(accessToDevices)
{ {
videoDevices *VDS = &videoDevices::getInstance(); videoDevices *VDS = &videoDevices::getInstance();
#ifdef HAVE_WINRT #ifdef WINRT
VDS->waitInit(); VDS->waitInit();
#endif #endif
out = VDS->getCount(); out = VDS->getCount();
@ -3595,7 +3595,7 @@ protected:
int index, width, height, fourcc; int index, width, height, fourcc;
IplImage* frame; IplImage* frame;
videoInput VI; videoInput VI;
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
DEFINE_TASK<bool> openTask; DEFINE_TASK<bool> openTask;
Concurrency::critical_section lock; Concurrency::critical_section lock;
@ -3643,7 +3643,7 @@ void CvCaptureCAM_MSMF::close()
// Initialize camera input // Initialize camera input
bool CvCaptureCAM_MSMF::open( int _index ) bool CvCaptureCAM_MSMF::open( int _index )
{ {
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
SAVE_CURRENT_CONTEXT(context); SAVE_CURRENT_CONTEXT(context);
auto func = [_index, context, this](DEFINE_RET_VAL(bool)) -> DEFINE_RET_FORMAL(bool) { auto func = [_index, context, this](DEFINE_RET_VAL(bool)) -> DEFINE_RET_FORMAL(bool) {
@ -3656,14 +3656,14 @@ bool CvCaptureCAM_MSMF::open( int _index )
if (devices == 0) if (devices == 0)
return false; return false;
try_index = try_index < 0 ? 0 : (try_index > devices-1 ? devices-1 : try_index); try_index = try_index < 0 ? 0 : (try_index > devices-1 ? devices-1 : try_index);
#ifdef HAVE_WINRT #ifdef WINRT
HRESULT hr; HRESULT hr;
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
BEGIN_CALL_IN_CONTEXT(hr, context, this, try_index) BEGIN_CALL_IN_CONTEXT(hr, context, this, try_index)
#endif #endif
#endif #endif
VI.setupDevice(try_index, 0, 0, 0); // With maximum frame size. VI.setupDevice(try_index, 0, 0, 0); // With maximum frame size.
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
END_CALL_IN_CONTEXT_BASE END_CALL_IN_CONTEXT_BASE
VI.waitForDevice(try_index); VI.waitForDevice(try_index);
@ -3672,13 +3672,13 @@ bool CvCaptureCAM_MSMF::open( int _index )
#endif #endif
#endif #endif
if( !VI.isFrameNew(try_index) ) if( !VI.isFrameNew(try_index) )
#ifdef HAVE_WINRT #ifdef WINRT
hr = E_FAIL; hr = E_FAIL;
#else #else
return false; return false;
#endif #endif
index = try_index; index = try_index;
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef HAVE_CONCURRENCY #ifdef HAVE_CONCURRENCY
END_CALL_IN_CONTEXT_BASE END_CALL_IN_CONTEXT_BASE
RET_VAL(true) RET_VAL(true)

@ -1,4 +1,4 @@
#ifdef HAVE_WINRT #ifdef WINRT
#define ICustomStreamSink StreamSink #define ICustomStreamSink StreamSink
#ifndef __cplusplus_winrt #ifndef __cplusplus_winrt
@ -380,7 +380,7 @@ MAKE_ENUM(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypePairs[] = {
}; };
MAKE_MAP(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypeMap(StreamSinkMarkerTypePairs, StreamSinkMarkerTypePairs + sizeof(StreamSinkMarkerTypePairs) / sizeof(StreamSinkMarkerTypePairs[0])); MAKE_MAP(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypeMap(StreamSinkMarkerTypePairs, StreamSinkMarkerTypePairs + sizeof(StreamSinkMarkerTypePairs) / sizeof(StreamSinkMarkerTypePairs[0]));
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef __cplusplus_winrt #ifdef __cplusplus_winrt
#define _ContextCallback Concurrency::details::_ContextCallback #define _ContextCallback Concurrency::details::_ContextCallback
@ -1070,7 +1070,7 @@ protected:
}; };
class StreamSink : class StreamSink :
#ifdef HAVE_WINRT #ifdef WINRT
public Microsoft::WRL::RuntimeClass< public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::ClassicCom>, Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::ClassicCom>,
IMFStreamSink, IMFStreamSink,
@ -1100,7 +1100,7 @@ public:
if (riid == IID_IMarshal) { if (riid == IID_IMarshal) {
return MarshalQI(riid, ppv); return MarshalQI(riid, ppv);
} else { } else {
#ifdef HAVE_WINRT #ifdef WINRT
hr = RuntimeClassT::QueryInterface(riid, ppv); hr = RuntimeClassT::QueryInterface(riid, ppv);
#else #else
if (riid == IID_IUnknown || riid == IID_IMFStreamSink) { if (riid == IID_IUnknown || riid == IID_IMFStreamSink) {
@ -1126,7 +1126,7 @@ public:
return hr; return hr;
} }
#ifdef HAVE_WINRT #ifdef WINRT
STDMETHOD(RuntimeClassInitialize)() { return S_OK; } STDMETHOD(RuntimeClassInitialize)() { return S_OK; }
#else #else
ULONG STDMETHODCALLTYPE AddRef() ULONG STDMETHODCALLTYPE AddRef()
@ -1177,7 +1177,7 @@ public:
m_StartTime(0), m_fGetStartTimeFromSample(false), m_fWaitingForFirstSample(false), m_StartTime(0), m_fGetStartTimeFromSample(false), m_fWaitingForFirstSample(false),
m_state(State_TypeNotSet), m_pParent(nullptr), m_state(State_TypeNotSet), m_pParent(nullptr),
m_imageWidthInPixels(0), m_imageHeightInPixels(0) { m_imageWidthInPixels(0), m_imageHeightInPixels(0) {
#ifdef HAVE_WINRT #ifdef WINRT
m_token.value = 0; m_token.value = 0;
#else #else
m_bConnected = false; m_bConnected = false;
@ -1856,7 +1856,7 @@ public:
return hr; return hr;
} }
private: private:
#ifdef HAVE_WINRT #ifdef WINRT
EventRegistrationToken m_token; EventRegistrationToken m_token;
#else #else
bool m_bConnected; bool m_bConnected;
@ -1864,7 +1864,7 @@ private:
bool m_IsShutdown; // Flag to indicate if Shutdown() method was called. bool m_IsShutdown; // Flag to indicate if Shutdown() method was called.
CRITICAL_SECTION m_critSec; CRITICAL_SECTION m_critSec;
#ifndef HAVE_WINRT #ifndef WINRT
long m_cRef; long m_cRef;
#endif #endif
IMFAttributes* m_pParent; IMFAttributes* m_pParent;
@ -2408,7 +2408,7 @@ protected:
extern const __declspec(selectany) WCHAR RuntimeClass_CV_MediaSink[] = L"cv.MediaSink"; extern const __declspec(selectany) WCHAR RuntimeClass_CV_MediaSink[] = L"cv.MediaSink";
class MediaSink : class MediaSink :
#ifdef HAVE_WINRT #ifdef WINRT
public Microsoft::WRL::RuntimeClass< public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::WinRtClassicComMix >, Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::WinRtClassicComMix >,
Microsoft::WRL::Implements<ABI::Windows::Media::IMediaExtension>, Microsoft::WRL::Implements<ABI::Windows::Media::IMediaExtension>,
@ -2420,7 +2420,7 @@ class MediaSink :
public IMFMediaSink, public IMFClockStateSink, public CBaseAttributes<> public IMFMediaSink, public IMFClockStateSink, public CBaseAttributes<>
#endif #endif
{ {
#ifdef HAVE_WINRT #ifdef WINRT
InspectableClass(RuntimeClass_CV_MediaSink, BaseTrust) InspectableClass(RuntimeClass_CV_MediaSink, BaseTrust)
public: public:
#else #else
@ -2488,7 +2488,7 @@ public:
return S_OK; return S_OK;
} }
} }
#ifdef HAVE_WINRT #ifdef WINRT
STDMETHODIMP SetProperties(ABI::Windows::Foundation::Collections::IPropertySet *pConfiguration) STDMETHODIMP SetProperties(ABI::Windows::Foundation::Collections::IPropertySet *pConfiguration)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
@ -2828,7 +2828,7 @@ public:
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
#ifdef HAVE_WINRT #ifdef WINRT
pStream = Microsoft::WRL::Make<StreamSink>(); pStream = Microsoft::WRL::Make<StreamSink>();
if (pStream == nullptr) { if (pStream == nullptr) {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
@ -2940,7 +2940,7 @@ public:
{ {
hr = m_streams.Remove(pos, nullptr); hr = m_streams.Remove(pos, nullptr);
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(spStream.Get()); spCustomSink = static_cast<StreamSink*>(spStream.Get());
hr = S_OK; hr = S_OK;
#else #else
@ -3164,7 +3164,7 @@ public:
{ {
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr; HRESULT hr;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream); spCustomSink = static_cast<StreamSink*>(pStream);
#else #else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
@ -3187,7 +3187,7 @@ public:
{ {
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr; HRESULT hr;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream); spCustomSink = static_cast<StreamSink*>(pStream);
#else #else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
@ -3207,7 +3207,7 @@ public:
{ {
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr; HRESULT hr;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream); spCustomSink = static_cast<StreamSink*>(pStream);
#else #else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
@ -3317,7 +3317,7 @@ public:
return hr; return hr;
} }
private: private:
#ifndef HAVE_WINRT #ifndef WINRT
long m_cRef; long m_cRef;
#endif #endif
CRITICAL_SECTION m_critSec; CRITICAL_SECTION m_critSec;
@ -3327,6 +3327,6 @@ private:
LONGLONG m_llStartTime; LONGLONG m_llStartTime;
}; };
#ifdef HAVE_WINRT #ifdef WINRT
ActivatableClass(MediaSink); ActivatableClass(MediaSink);
#endif #endif

Loading…
Cancel
Save