diff options
author | marcus <marcus@FreeBSD.org> | 2004-07-06 08:07:32 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2004-07-06 08:07:32 +0800 |
commit | f71b4a0a0041326564e79d8761577ce0bf778d4f (patch) | |
tree | f391d9790f0e139779c9ffd943a8b2c7b024d502 /multimedia | |
parent | d4e0eedca9a0c5fecdeb014fd404677b586627d8 (diff) | |
download | freebsd-ports-graphics-f71b4a0a0041326564e79d8761577ce0bf778d4f.tar.gz freebsd-ports-graphics-f71b4a0a0041326564e79d8761577ce0bf778d4f.tar.zst freebsd-ports-graphics-f71b4a0a0041326564e79d8761577ce0bf778d4f.zip |
Use some sysctl magic to get hw.ncpu on systems that don't support the
_SC_NPROCESSORS_ONLN sysconf macro.
Reported by: Randy Pratt <rpratt1950@earthlink.net>
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/gstreamer-plugins/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc | 26 | ||||
-rw-r--r-- | multimedia/gstreamer-plugins80/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc | 26 |
2 files changed, 52 insertions, 0 deletions
diff --git a/multimedia/gstreamer-plugins/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc b/multimedia/gstreamer-plugins/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc new file mode 100644 index 00000000000..aabbc2971c4 --- /dev/null +++ b/multimedia/gstreamer-plugins/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc @@ -0,0 +1,26 @@ +--- ext/mpeg2enc/gstmpeg2encoptions.cc.orig Mon Jul 5 19:54:18 2004 ++++ ext/mpeg2enc/gstmpeg2encoptions.cc Mon Jul 5 20:05:37 2004 +@@ -267,11 +267,23 @@ + * Class init stuff. + */ + ++#if !defined(_SC_NPROCESSORS_ONLN) && defined(__FreeBSD__) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif ++ + GstMpeg2EncOptions::GstMpeg2EncOptions (): + MPEG2EncOptions () + { + /* autodetect number of CPUs */ ++#if !defined(_SC_NPROCESSORS_ONLN) && defined(__FreeBSD__) ++ /* We need to use a sysctl to get the number of CPUs. */ ++ size_t len = sizeof (num_cpus); ++ ++ sysctlbyname ("hw.ncpu", &num_cpus, &len, NULL, 0); ++#else + num_cpus = sysconf (_SC_NPROCESSORS_ONLN); ++#endif + if (num_cpus < 0) + num_cpus = 1; + if (num_cpus > 32) diff --git a/multimedia/gstreamer-plugins80/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc b/multimedia/gstreamer-plugins80/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc new file mode 100644 index 00000000000..aabbc2971c4 --- /dev/null +++ b/multimedia/gstreamer-plugins80/files/patch-ext_mpeg2enc_gstmpeg2encoptions.cc @@ -0,0 +1,26 @@ +--- ext/mpeg2enc/gstmpeg2encoptions.cc.orig Mon Jul 5 19:54:18 2004 ++++ ext/mpeg2enc/gstmpeg2encoptions.cc Mon Jul 5 20:05:37 2004 +@@ -267,11 +267,23 @@ + * Class init stuff. + */ + ++#if !defined(_SC_NPROCESSORS_ONLN) && defined(__FreeBSD__) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#endif ++ + GstMpeg2EncOptions::GstMpeg2EncOptions (): + MPEG2EncOptions () + { + /* autodetect number of CPUs */ ++#if !defined(_SC_NPROCESSORS_ONLN) && defined(__FreeBSD__) ++ /* We need to use a sysctl to get the number of CPUs. */ ++ size_t len = sizeof (num_cpus); ++ ++ sysctlbyname ("hw.ncpu", &num_cpus, &len, NULL, 0); ++#else + num_cpus = sysconf (_SC_NPROCESSORS_ONLN); ++#endif + if (num_cpus < 0) + num_cpus = 1; + if (num_cpus > 32) |