diff options
author | Josh de Kock <josh@itanimul.li> | 2016-03-26 15:27:23 +0000 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2016-03-31 18:03:21 +0200 |
commit | 6bb99757b780144d9fa27cdce09d3621e1a0ed43 (patch) | |
tree | e1302b2d68c6cfe477b9f4a8f44f11a33c1db7fd /compat | |
parent | 5f0226668124aa7ae4db501ba7f4ace4c770f3d1 (diff) | |
download | ffmpeg-streaming-6bb99757b780144d9fa27cdce09d3621e1a0ed43.zip ffmpeg-streaming-6bb99757b780144d9fa27cdce09d3621e1a0ed43.tar.gz |
jack: Support OSX
Previously, with JACK installed, the configure script would enable the
JACK indev; this broke on OS X due to an incomplete pthreads
implementation. Add some simple macros to map libdispatch to pthreads
on OS X.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'compat')
-rw-r--r-- | compat/dispatch_semaphore/semaphore.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/compat/dispatch_semaphore/semaphore.h b/compat/dispatch_semaphore/semaphore.h new file mode 100644 index 0000000..2461daf --- /dev/null +++ b/compat/dispatch_semaphore/semaphore.h @@ -0,0 +1,42 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H +#define COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H + +#include <dispatch/dispatch.h> +#include <errno.h> + +#define sem_t dispatch_semaphore_t +#define sem_post(psem) dispatch_semaphore_signal(*psem) +#define sem_wait(psem) dispatch_semaphore_wait(*psem, DISPATCH_TIME_FOREVER) +#define sem_timedwait(psem, val) dispatch_semaphore_wait(*psem, dispatch_walltime(val, 0)) +#define sem_destroy(psem) dispatch_release(*psem) + +static inline int compat_sem_init(dispatch_semaphore_t *psem, + int unused, int val) +{ + int ret = !!(*psem = dispatch_semaphore_create(val)) - 1; + if (ret < 0) + errno = ENOMEM; + return ret; +} + +#define sem_init compat_sem_init + +#endif /* COMPAT_DISPATCH_SEMAPHORE_SEMAPHORE_H */ |