Commit f66a3bc5 authored by Ghislain MARY's avatar Ghislain MARY

Correct handling of WINAPI families.

parent 664d60e1
......@@ -31,10 +31,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#else
#ifndef PACKAGE_PLUGINS_DIR
#if (defined(WIN32) || defined(_WIN32_WCE))
#ifdef WINAPI_FAMILY_APP
#define PACKAGE_PLUGINS_DIR "."
#else
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define PACKAGE_PLUGINS_DIR "lib\\mediastreamer\\plugins\\"
#else
#define PACKAGE_PLUGINS_DIR "."
#endif
#else
#define PACKAGE_PLUGINS_DIR "."
......@@ -322,12 +322,12 @@ void ms_set_plugins_dir(const char *path) {
void ms_sleep(int seconds){
#ifdef WIN32
#if WINAPI_FAMILY_APP
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
Sleep(seconds*1000);
#else
HANDLE sleepEvent = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (!sleepEvent) return;
WaitForSingleObjectEx(sleepEvent, seconds * 1000, FALSE);
#else
Sleep(seconds*1000);
#endif
#else
struct timespec ts,rem;
......@@ -343,12 +343,12 @@ void ms_sleep(int seconds){
void ms_usleep(uint64_t usec){
#ifdef WIN32
#if WINAPI_FAMILY_APP
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
Sleep((DWORD)(usec/1000));
#else
HANDLE sleepEvent = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (!sleepEvent) return;
WaitForSingleObjectEx(sleepEvent, usec / 1000, FALSE);
#else
Sleep((DWORD)(usec/1000));
#endif
#else
struct timespec ts,rem;
......
......@@ -301,12 +301,12 @@ static uint64_t get_cur_time_ms(void *unused){
static void sleepMs(int ms){
#ifdef WIN32
#if WINAPI_FAMILY_APP
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
Sleep(ms);
#else
HANDLE sleepEvent = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (!sleepEvent) return;
WaitForSingleObjectEx(sleepEvent, ms, FALSE);
#else
Sleep(ms);
#endif
#else
struct timespec ts;
......@@ -322,7 +322,7 @@ static int set_high_prio(MSTicker *obj){
if (prio>MS_TICKER_PRIO_NORMAL){
#ifdef WIN32
#if !WINAPI_FAMILY_APP
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
MMRESULT mm;
TIMECAPS ptc;
mm=timeGetDevCaps(&ptc,sizeof(ptc));
......@@ -390,7 +390,7 @@ static int set_high_prio(MSTicker *obj){
static void unset_high_prio(int precision){
#ifdef WIN32
#if !WINAPI_FAMILY_APP
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL)){
ms_warning("SetThreadPriority() failed (%d)\n", (int)GetLastError());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment