shithub: openh264

Download patch

ref: 3cdd792aba0ee658ef5c61083a8a55fcb342105e
parent: cc2ffee5d2178e90407a89cfa7dc644cdb35ac27
parent: cd0ee83393798db7d2c26813b13be2a3039ad7c7
author: Ethan Hugg <ethanhugg@gmail.com>
date: Wed Jan 8 03:33:17 EST 2014

Merge pull request #106 from mstorsjo/windows-api-subset

Allow building for the WinRT/Windows Phone API subsets

--- a/codec/console/dec/inc/d3d9_utils.h
+++ b/codec/console/dec/inc/d3d9_utils.h
@@ -47,7 +47,14 @@
 #include "codec_def.h"
 
 #if defined(_MSC_VER) && (_MSC_VER>=1500) // vs2008 and upper
+#ifdef WINAPI_FAMILY
+#include <winapifamily.h>
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 #define ENABLE_DISPLAY_MODULE // enable/disable the render feature
+#endif
+#else /* defined(WINAPI_FAMILY) */
+#define ENABLE_DISPLAY_MODULE // enable/disable the render feature
+#endif
 #endif
 
 #ifdef ENABLE_DISPLAY_MODULE
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -83,6 +83,17 @@
 #include "WelsThreadLib.h"
 #endif//MT_ENABLED
 
+#ifdef WIN32
+#ifdef WINAPI_FAMILY
+#include <winapifamily.h>
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#define HAVE_PROCESS_AFFINITY
+#endif
+#else /* defined(WINAPI_FAMILY) */
+#define HAVE_PROCESS_AFFINITY
+#endif
+#endif /* WIN32 */
+
 #include <iostream>
 using namespace std;
 using namespace WelsSVCEnc;
@@ -1207,9 +1218,9 @@
 
 //  Merge from Heifei's Wonder.  Lock process to a single core
 void LockToSingleCore() {
-#if defined(WIN32) && !defined(WIN64)
+#ifdef HAVE_PROCESS_AFFINITY
   //for 2005 compiler, change "DWORD" to "DWORD_PTR"
-  DWORD ProcessAffMask = 0, SystemAffMask = 0;
+  ULONG_PTR ProcessAffMask = 0, SystemAffMask = 0;
   HANDLE hProcess = GetCurrentProcess();
 
   GetProcessAffinityMask (hProcess, &ProcessAffMask, &SystemAffMask);
--- a/codec/processing/src/common/thread.cpp
+++ b/codec/processing/src/common/thread.cpp
@@ -43,6 +43,12 @@
 
 #if defined(_WIN32)
 
+#ifdef WINAPI_FAMILY
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#define InitializeCriticalSection(x) InitializeCriticalSectionEx(x, 0, 0)
+#endif
+#endif
+
 WELS_THREAD_ERROR_CODE    WelsMutexInit (WELS_MUTEX*    mutex) {
   InitializeCriticalSection (mutex);