Merge pull request #1252 from asmorkalov:winrt_api_cert_highgui_fix

This commit is contained in:
Roman Donchenko 2013-08-16 14:05:39 +04:00 committed by OpenCV Buildbot
commit 47b3e7855f
6 changed files with 52 additions and 3 deletions

View File

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

22
3rdparty/libpng/opencv-libpng.path vendored Normal file
View File

@ -0,0 +1,22 @@
diff --git a/3rdparty/libpng/pngpriv.h b/3rdparty/libpng/pngpriv.h
index 07b2b0b..e7824b8 100644
--- a/3rdparty/libpng/pngpriv.h
+++ b/3rdparty/libpng/pngpriv.h
@@ -360,7 +360,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
/* Memory model/platform independent fns */
#ifndef PNG_ABORT
-# ifdef _WINDOWS_
+# if defined(_WINDOWS_) && !defined(HAVE_WINRT)
# define PNG_ABORT() ExitProcess(0)
# else
# 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_memset _fmemset
#else
-# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
+# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen lstrlenA

View File

@ -360,7 +360,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
/* Memory model/platform independent fns */
#ifndef PNG_ABORT
# ifdef _WINDOWS_
# if defined(_WINDOWS_) && !defined(HAVE_WINRT)
# define PNG_ABORT() ExitProcess(0)
# else
# 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_memset _fmemset
#else
# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen lstrlenA

View File

@ -55,6 +55,9 @@
#define CVAUX_STR_EXP(__A) #__A
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
#define CVAUX_STRW_EXP(__A) L#__A
#define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A)
#if CV_VERSION_REVISION
# define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION)
#else

View File

@ -85,6 +85,16 @@ private:
icvInitFFMPEG()
{
#if defined WIN32 || defined _WIN32
# ifdef HAVE_WINRT
const wchar_t* module_name = L"opencv_ffmpeg"
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__)
L"_64"
#endif
L".dll";
icvFFOpenCV = LoadPackagedLibrary( module_name, 0 );
# else
const char* module_name = "opencv_ffmpeg"
CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)
#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__)
@ -93,6 +103,8 @@ private:
".dll";
icvFFOpenCV = LoadLibrary( module_name );
# endif
if( icvFFOpenCV )
{
icvCreateFileCapture_FFMPEG_p =

View File

@ -366,7 +366,15 @@ private:
struct ImplMutex::Impl
{
void init() { InitializeCriticalSection(&cs); refcount = 1; }
void init()
{
#if (_WIN32_WINNT >= 0x0600)
::InitializeCriticalSectionEx(&cs, 1000, 0);
#else
::InitializeCriticalSection(&cs);
#endif
refcount = 1;
}
void destroy() { DeleteCriticalSection(&cs); }
void lock() { EnterCriticalSection(&cs); }