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

Allow building for the WinRT/Windows Phone API subsets
This commit is contained in:
Ethan Hugg 2014-01-08 08:33:17 -08:00
commit 3cdd792aba
3 changed files with 26 additions and 2 deletions

View File

@ -47,8 +47,15 @@
#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
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -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 @@ INSIDE_MEM_FREE: {
// 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);

View File

@ -43,6 +43,12 @@ WELSVP_NAMESPACE_BEGIN
#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);