Video outputs should not change the vout's render format.
[vlc.git] / extras / contrib / src / Patches / libschroedinger-fix-build-OSX.patch
1 From: David Schleef <ds@ginger.bigkitten.com>
2 Date: Tue, 10 Jun 2008 18:48:06 +0000 (-0700)
3 Subject: [core] Check number of processors correctly on OS/X.  Patch from
4 X-Git-Url: http://diracvideo.org/git?p=schroedinger.git;a=commitdiff_plain;h=7e125aa636e520393ebf8e9315d3956e399f4175
5
6 [core] Check number of processors correctly on OS/X.  Patch from
7 Karl Rasche <karlrasche@gmail.com>
8 ---
9
10 diff --git a/schroedinger/schroasync-pthread.c b/schroedinger/schroasync-pthread.c
11 index 3a975e0..60bf1c1 100644
12 --- a/schroedinger/schroasync-pthread.c
13 +++ b/schroedinger/schroasync-pthread.c
14 @@ -13,6 +13,10 @@
15  #include <sys/time.h>
16  #include <time.h>
17  
18 +#ifdef __APPLE__
19 +#include <sys/sysctl.h>
20 +#endif
21 +
22  enum {
23    STATE_IDLE,
24    STATE_BUSY,
25 @@ -79,14 +83,23 @@ schro_async_new(int n_threads,
26        }
27      }
28      if (n_threads == 0) {
29 -#ifndef _WIN32
30 -      n_threads = sysconf(_SC_NPROCESSORS_CONF);
31 -#else
32 +#ifdef _WIN32
33        const char *s = getenv("NUMBER_OF_PROCESSORS");
34        if (s) {
35          n_threads = atoi(s);
36        }
37 -#endif
38 +#elif defined __APPLE__
39 +      {
40 +        int    mib[]    = {CTL_HW, HW_NCPU};
41 +        size_t dataSize =  sizeof(int);
42 +
43 +        if (sysctl(mib, 2, &n_threads, &dataSize, NULL, 0)) {
44 +          n_threads = 0;
45 +        }
46 +      }
47 +#else
48 +      n_threads = sysconf(_SC_NPROCESSORS_CONF);
49 +#endif        
50      }
51      if (n_threads == 0) {
52        n_threads = 1;