Use HW_NCPUONLINE/_SC_NPROCESSORS_ONLN for FFmpeg, VLC, X264. From Brad.
This commit is contained in:
parent
358bfe7e70
commit
b04df75af9
@ -1,9 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.207 2021/02/23 14:30:04 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.208 2021/04/03 11:15:46 sthen Exp $
|
||||
|
||||
COMMENT= audio/video converter and streamer
|
||||
|
||||
V= 4.3.2
|
||||
DISTNAME= ffmpeg-${V}
|
||||
REVISION= 0
|
||||
EPOCH= 1
|
||||
CATEGORIES= graphics multimedia
|
||||
MASTER_SITES= https://ffmpeg.org/releases/
|
||||
|
18
graphics/ffmpeg/patches/patch-libavutil_cpu_c
Normal file
18
graphics/ffmpeg/patches/patch-libavutil_cpu_c
Normal file
@ -0,0 +1,18 @@
|
||||
$OpenBSD: patch-libavutil_cpu_c,v 1.1 2021/04/03 11:15:46 sthen Exp $
|
||||
|
||||
Index: libavutil/cpu.c
|
||||
--- libavutil/cpu.c.orig
|
||||
+++ libavutil/cpu.c
|
||||
@@ -283,6 +283,12 @@ int av_cpu_count(void)
|
||||
DWORD_PTR proc_aff, sys_aff;
|
||||
if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff))
|
||||
nb_cpus = av_popcount64(proc_aff);
|
||||
+#elif HAVE_SYSCTL && defined(HW_NCPUONLINE)
|
||||
+ int mib[2] = { CTL_HW, HW_NCPUONLINE };
|
||||
+ size_t len = sizeof(nb_cpus);
|
||||
+
|
||||
+ if (sysctl(mib, 2, &nb_cpus, &len, NULL, 0) == -1)
|
||||
+ nb_cpus = 0;
|
||||
#elif HAVE_SYSCTL && defined(HW_NCPU)
|
||||
int mib[2] = { CTL_HW, HW_NCPU };
|
||||
size_t len = sizeof(nb_cpus);
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.58 2020/11/05 19:42:29 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.59 2021/04/03 11:15:46 sthen Exp $
|
||||
|
||||
COMMENT= free H.264/MPEG-4 AVC encoder
|
||||
|
||||
@ -6,7 +6,7 @@ DISTNAME= x264-20200705
|
||||
GH_ACCOUNT= mirror
|
||||
GH_PROJECT= x264
|
||||
GH_COMMIT= cde9a93319bea766a92e306d69059c76de970190
|
||||
REVISION= 0
|
||||
REVISION= 1
|
||||
CATEGORIES= multimedia
|
||||
|
||||
SHARED_LIBS= x264 22.0
|
||||
|
31
multimedia/x264/patches/patch-common_cpu_c
Normal file
31
multimedia/x264/patches/patch-common_cpu_c
Normal file
@ -0,0 +1,31 @@
|
||||
$OpenBSD: patch-common_cpu_c,v 1.6 2021/04/03 11:15:46 sthen Exp $
|
||||
|
||||
Index: common/cpu.c
|
||||
--- common/cpu.c.orig
|
||||
+++ common/cpu.c
|
||||
@@ -433,7 +433,7 @@ int x264_cpu_num_processors( void )
|
||||
#elif SYS_WINDOWS
|
||||
return x264_pthread_num_processors_np();
|
||||
|
||||
-#elif SYS_CYGWIN || SYS_SunOS
|
||||
+#elif SYS_CYGWIN || SYS_SunOS || SYS_OPENBSD
|
||||
return sysconf( _SC_NPROCESSORS_ONLN );
|
||||
|
||||
#elif SYS_LINUX
|
||||
@@ -460,15 +460,10 @@ int x264_cpu_num_processors( void )
|
||||
get_system_info( &info );
|
||||
return info.cpu_count;
|
||||
|
||||
-#elif SYS_MACOSX || SYS_FREEBSD || SYS_OPENBSD
|
||||
+#elif SYS_MACOSX || SYS_FREEBSD
|
||||
int ncpu;
|
||||
size_t length = sizeof( ncpu );
|
||||
-#if SYS_OPENBSD
|
||||
- int mib[2] = { CTL_HW, HW_NCPU };
|
||||
- if( sysctl(mib, 2, &ncpu, &length, NULL, 0) )
|
||||
-#else
|
||||
if( sysctlbyname("hw.ncpu", &ncpu, &length, NULL, 0) )
|
||||
-#endif
|
||||
{
|
||||
ncpu = 1;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.247 2021/01/23 09:50:09 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.248 2021/04/03 11:15:46 sthen Exp $
|
||||
|
||||
COMMENT-main= VideoLAN client; multimedia player
|
||||
COMMENT-jack= JACK audio output module for VLC
|
||||
@ -7,6 +7,7 @@ V= 3.0.12
|
||||
DISTNAME= vlc-${V}
|
||||
PKGNAME-main= ${DISTNAME}
|
||||
PKGNAME-jack= vlc-jack-${V}
|
||||
REVISION-main= 0
|
||||
CATEGORIES= x11
|
||||
MASTER_SITES= https://download.videolan.org/pub/videolan/vlc/${V}/
|
||||
EXTRACT_SUFX= .tar.xz
|
||||
|
@ -1,7 +1,8 @@
|
||||
$OpenBSD: patch-src_posix_thread_c,v 1.4 2019/12/01 22:44:13 ajacoutot Exp $
|
||||
$OpenBSD: patch-src_posix_thread_c,v 1.5 2021/04/03 11:15:46 sthen Exp $
|
||||
|
||||
Make use of clock_gettime() on OpenBSD. Until we have per-process
|
||||
timers and can enable _POSIX_TIMERS in unistd.h.
|
||||
- Make use of clock_gettime() on OpenBSD. Until we have per-process
|
||||
timers and can enable _POSIX_TIMERS in unistd.h.
|
||||
- Make use of _SC_NPROCESSORS_ONLN.
|
||||
|
||||
Index: src/posix/thread.c
|
||||
--- src/posix/thread.c.orig
|
||||
@ -24,3 +25,12 @@ Index: src/posix/thread.c
|
||||
struct timespec ts;
|
||||
|
||||
vlc_clock_setup ();
|
||||
@@ -712,6 +712,8 @@ unsigned vlc_GetCPUCount(void)
|
||||
count = sysconf (_SC_NPROCESSORS_ONLN);
|
||||
free (cpulist);
|
||||
return count ? count : 1;
|
||||
+#elif defined(_SC_NPROCESSORS_ONLN)
|
||||
+ return sysconf(_SC_NPROCESSORS_ONLN);
|
||||
#elif defined(_SC_NPROCESSORS_CONF)
|
||||
return sysconf(_SC_NPROCESSORS_CONF);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user