aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh de Kock <josh@itanimul.li>2016-02-21 22:42:32 +0000
committerMichael Niedermayer <michael@niedermayer.cc>2016-02-22 00:46:49 +0100
commit67f8a0be54554715a93a4e288da3247c9a5d4e1c (patch)
tree0ae4328a5607c99697dfed9a5538aac3280384af
parentcf85a20d920fb3c43f81c4b49f0bc6723ab811d9 (diff)
downloadffmpeg-67f8a0be54554715a93a4e288da3247c9a5d4e1c.tar.gz
configure&avdevice/jack: Fixed issue #43 JACK indev support on OSX
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rwxr-xr-xconfigure9
-rw-r--r--libavdevice/jack.c10
2 files changed, 17 insertions, 2 deletions
diff --git a/configure b/configure
index a78e228e23..6b3ee5fd86 100755
--- a/configure
+++ b/configure
@@ -1732,6 +1732,7 @@ BUILTIN_LIST="
mm_empty
rdtsc
sarestart
+ sem_timedwait
sync_val_compare_and_swap
"
HAVE_LIST_CMDLINE="
@@ -1753,6 +1754,7 @@ HEADERS_LIST="
asm_types_h
cdio_paranoia_h
cdio_paranoia_paranoia_h
+ dispatch_dispatch_h
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
dev_ic_bt8xx_h
@@ -2758,7 +2760,8 @@ gdigrab_indev_deps="CreateDIBSection"
gdigrab_indev_extralibs="-lgdi32"
gdigrab_indev_select="bmp_decoder"
iec61883_indev_deps="libiec61883"
-jack_indev_deps="jack_jack_h sem_timedwait"
+jack_indev_deps="jack_jack_h"
+jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
lavfi_indev_deps="avfilter"
libcdio_indev_deps="libcdio"
libdc1394_indev_deps="libdc1394"
@@ -5267,6 +5270,7 @@ check_builtin atomic_compare_exchange "" "int *ptr, *oldval; int newval; __atomi
check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
check_builtin MemoryBarrier windows.h "MemoryBarrier()"
check_builtin sarestart signal.h "SA_RESTART"
+check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" -lpthread
check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, tm)"
check_builtin localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
@@ -5331,6 +5335,7 @@ check_func_headers glob.h glob
enabled xlib &&
check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
+check_header dispatch/dispatch.h
check_header direct.h
check_header dirent.h
check_header dlfcn.h
@@ -5703,7 +5708,7 @@ check_header soundcard.h
enabled_any alsa_indev alsa_outdev &&
check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
-enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
+enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
check_func jack_port_get_latency_range -ljack
enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index 9ecbf9e32c..545548423d 100644
--- a/libavdevice/jack.c
+++ b/libavdevice/jack.c
@@ -35,6 +35,16 @@
#include "timefilter.h"
#include "avdevice.h"
+#if HAVE_DISPATCH_DISPATCH_H
+#include <dispatch/dispatch.h>
+#define sem_t dispatch_semaphore_t
+#define sem_init(psem,x,val) *psem = dispatch_semaphore_create(val)
+#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)
+#endif
+
/**
* Size of the internal FIFO buffers as a number of audio packets
*/