While this patch works, the problem is the configure part needs to #define DOS_INCL. I've added it to the CFLAGS which causes a warning in pthread.c about DOS_INCL being redefined. I could just check for os2.h but don't know if it exists on some versions of Windows. Also seems better to actually check for the function. http://cyberkinetica.homeunix.net/os2tk45/addendum/049_L2_DosQuerySysInfo.html Dave
--- >From a0416f1ed0b428e930ad5c219fd8b1aefbae9a78 Mon Sep 17 00:00:00 2001 From: Dave Yeo <[email protected]> Date: Sat, 24 Dec 2011 20:10:11 -0800 Subject: [PATCH] Detect number of processors on OS/2 --- configure | 4 +++- libavcodec/pthread.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 9b510de..d450fc1 --- a/configure +++ b/configure @@ -1072,6 +1072,7 @@ HAVE_LIST=" dev_video_meteor_ioctl_meteor_h dlfcn_h dlopen + DosQuerySysInfo dos_paths ebp_available ebx_available @@ -2535,7 +2536,7 @@ case $target_os in os/2*) ln_s="cp -f" objformat="aout" - add_cppflags -D_GNU_SOURCE + add_cppflags -D_GNU_SOURCE -DINCL_DOS add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' AVSERVERLDFLAGS="" @@ -2860,6 +2861,7 @@ check_func sched_getaffinity check_func sysctl check_func_headers io.h setmode check_func_headers lzo/lzo1x.h lzo1x_999_compress +check_func_headers os2.h DosQuerySysInfo check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi check_func_headers windows.h GetProcessTimes check_func_headers windows.h GetSystemInfo diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index f842edf..d1fe066 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -36,6 +36,9 @@ #include <sched.h> #elif HAVE_GETSYSTEMINFO #include <windows.h> +#elif HAVE_DOSQUERYSYSINFO +#define INCL_DOS +#include <os2.h> #elif HAVE_SYSCTL #include <sys/types.h> #include <sys/sysctl.h> @@ -165,6 +168,13 @@ static int get_logical_cpus(AVCodecContext *avctx) SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); nb_cpus = sysinfo.dwNumberOfProcessors; +#elif HAVE_DOSQUERYSYSINFO + uint32_t numprocs = 1; + ret = DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, + &numprocs, sizeof(numprocs)); + if (!ret) { + nb_cpus = (int) numprocs; + } #elif HAVE_SYSCTL && defined(HW_NCPU) int mib[2] = { CTL_HW, HW_NCPU }; size_t len = sizeof(nb_cpus); -- 1.7.2.3 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
