Re: [FFmpeg-devel] [PATCH] Fixed issue #43 JACK indev support on OSX

2016-02-20 Thread Michael Niedermayer
On Fri, Feb 19, 2016 at 08:27:50PM +, Josh de Kock wrote:
> ---
>  configure  | 13 ++---
>  libavdevice/jack.c | 10 ++
>  2 files changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 287896f..78f9618 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
> @@ -2757,7 +2759,7 @@ 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"
>  lavfi_indev_deps="avfilter"
>  libcdio_indev_deps="libcdio"
>  libdc1394_indev_deps="libdc1394"
> @@ -5266,6 +5268,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)"
> @@ -5330,6 +5333,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
> @@ -5702,8 +5706,11 @@ 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 &&
> -check_func jack_port_get_latency_range -ljack
> +enabled jack_indev &&
> + check_lib2 jack/jack.h jack_client_open -ljack &&
> + check_func jack_port_get_latency_range -ljack &&
> + enabled_any sem_timedwait dispatch_dispatch_h ||
> + disable jack_indev

iiuc jack_port_get_latency_range is not required its just used if
available. If so jack shouldnt be disabled if its not available

also with
jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
i think no explicit disable is needed


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Fixed issue #43 JACK indev support on OSX

2016-02-19 Thread Josh de Kock
---
 configure  | 13 ++---
 libavdevice/jack.c | 10 ++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 287896f..78f9618 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
@@ -2757,7 +2759,7 @@ 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"
 lavfi_indev_deps="avfilter"
 libcdio_indev_deps="libcdio"
 libdc1394_indev_deps="libdc1394"
@@ -5266,6 +5268,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)"
@@ -5330,6 +5333,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
@@ -5702,8 +5706,11 @@ 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 &&
-check_func jack_port_get_latency_range -ljack
+enabled jack_indev &&
+ check_lib2 jack/jack.h jack_client_open -ljack &&
+ check_func jack_port_get_latency_range -ljack &&
+ enabled_any sem_timedwait dispatch_dispatch_h ||
+ disable jack_indev
 
 enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
 
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index 9ecbf9e..5455484 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 
+#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
  */
-- 
2.5.4 (Apple Git-61)

> this breaks build when libjack is not available
>
> for example on mingw64
> without explicitly enabling jack it fails with:
> ERROR: input device jack could not be enabled
For some reason I assumed that the JACK indev had to be manually enabled, and 
therefore if it would be an error if it's dependencies. However, looking at the 
other indevs, I found that none of them threw errors, making it likely that all 
the indevs were on by default, and turned off when they weren't available 
(which would make sense).

I've removed the die statement which, hopefully, will fix all remaining issues. 

Thanks for your patience,
Josh
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Fixed issue #43 JACK indev support on OSX

2016-02-19 Thread Michael Niedermayer
On Fri, Feb 19, 2016 at 05:28:52PM +, Josh de Kock wrote:
> ---
>  configure  | 12 +---
>  libavdevice/jack.c | 10 ++
>  2 files changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 287896f..887384c 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
> @@ -2757,7 +2759,7 @@ 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"
>  lavfi_indev_deps="avfilter"
>  libcdio_indev_deps="libcdio"
>  libdc1394_indev_deps="libdc1394"
> @@ -5266,6 +5268,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)"
> @@ -5330,6 +5333,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

> @@ -5702,8 +5706,10 @@ 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 &&
> -check_func jack_port_get_latency_range -ljack
> +enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
> + check_func jack_port_get_latency_range -ljack &&
> + enabled_any sem_timedwait dispatch_dispatch_h ||
> + { disable jack_indev && die "ERROR: input device jack could not be 
> enabled"; }

this breaks build when libjack is not available

for example on mingw64
without explicitly enabling jack it fails with:
ERROR: input device jack could not be enabled

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-u...@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill hundred thousands of
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Fixed issue #43 JACK indev support on OSX

2016-02-19 Thread Josh de Kock
---
 configure  | 12 +---
 libavdevice/jack.c | 10 ++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 287896f..887384c 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
@@ -2757,7 +2759,7 @@ 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"
 lavfi_indev_deps="avfilter"
 libcdio_indev_deps="libcdio"
 libdc1394_indev_deps="libdc1394"
@@ -5266,6 +5268,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)"
@@ -5330,6 +5333,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
@@ -5702,8 +5706,10 @@ 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 &&
-check_func jack_port_get_latency_range -ljack
+enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
+ check_func jack_port_get_latency_range -ljack &&
+ enabled_any sem_timedwait dispatch_dispatch_h ||
+ { disable jack_indev && die "ERROR: input device jack could not be 
enabled"; }
 
 enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
 
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index 9ecbf9e..5455484 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 
+#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
  */
-- 
2.5.4 (Apple Git-61)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Fixed issue #43 JACK indev support on OSX

2016-02-19 Thread Michael Niedermayer
On Thu, Feb 18, 2016 at 11:58:25PM +, Josh de Kock wrote:
> ---
>  configure  | 14 +++---
>  libavdevice/jack.c | 12 
>  2 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 287896f..f2f7c3d 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="
> @@ -1758,6 +1759,7 @@ HEADERS_LIST="
>  dev_ic_bt8xx_h
>  dev_video_bktr_ioctl_bt848_h
>  dev_video_meteor_ioctl_meteor_h
> +dispatch_dispatch_h
>  direct_h
>  dirent_h
>  dlfcn_h
> @@ -2757,7 +2759,7 @@ 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"
>  lavfi_indev_deps="avfilter"
>  libcdio_indev_deps="libcdio"
>  libdc1394_indev_deps="libdc1394"
> @@ -5303,6 +5305,7 @@ check_func  mprotect
>  check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep 
> -lrt && add_extralibs -lrt && LIBRT="-lrt"; }
>  check_func  sched_getaffinity
>  check_func  setrlimit
> +check_func  sem_timedwait
>  check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
>  check_func  strerror_r
>  check_func  sysconf
> @@ -5330,6 +5333,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
> @@ -5702,8 +5706,12 @@ 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 &&
> -check_func jack_port_get_latency_range -ljack
> +if enabled jack_indev; then
> +{ check_lib2 jack/jack.h jack_client_open -ljack &&
> +  check_func jack_port_get_latency_range -ljack &&
> +  enabled_any sem_timedwait dispatch_dispatch_h; } || 
> +disable jack_indev
> +fi

this causes jack to be disabled on ubuntu LTS 12.04

grep -i jack config.h
#define HAVE_JACK_PORT_GET_LATENCY_RANGE 1
#define CONFIG_JACK_INDEV 0

previously:
grep -i jack config.h
#define HAVE_JACK_PORT_GET_LATENCY_RANGE 1
#define CONFIG_JACK_INDEV 1


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

For every action, there is an equal and opposite reaction. -- Newton
For every man jailed for a minor crime, theres one person more that
will hate the government, some of them will become terrorists.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Fixed issue #43 JACK indev support on OSX

2016-02-18 Thread Josh de Kock
---
 configure  | 14 +++---
 libavdevice/jack.c | 12 
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 287896f..f2f7c3d 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="
@@ -1758,6 +1759,7 @@ HEADERS_LIST="
 dev_ic_bt8xx_h
 dev_video_bktr_ioctl_bt848_h
 dev_video_meteor_ioctl_meteor_h
+dispatch_dispatch_h
 direct_h
 dirent_h
 dlfcn_h
@@ -2757,7 +2759,7 @@ 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"
 lavfi_indev_deps="avfilter"
 libcdio_indev_deps="libcdio"
 libdc1394_indev_deps="libdc1394"
@@ -5303,6 +5305,7 @@ check_func  mprotect
 check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep 
-lrt && add_extralibs -lrt && LIBRT="-lrt"; }
 check_func  sched_getaffinity
 check_func  setrlimit
+check_func  sem_timedwait
 check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
 check_func  strerror_r
 check_func  sysconf
@@ -5330,6 +5333,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
@@ -5702,8 +5706,12 @@ 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 &&
-check_func jack_port_get_latency_range -ljack
+if enabled jack_indev; then
+{ check_lib2 jack/jack.h jack_client_open -ljack &&
+  check_func jack_port_get_latency_range -ljack &&
+  enabled_any sem_timedwait dispatch_dispatch_h; } || 
+disable jack_indev
+fi
 
 enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
 
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index 9ecbf9e..b5b8666 100644
--- a/libavdevice/jack.c
+++ b/libavdevice/jack.c
@@ -35,6 +35,18 @@
 #include "timefilter.h"
 #include "avdevice.h"
 
+#if HAVE_DISPATCH_DISPATCH_H
+
+#include 
+#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 /* HAVE_DISPATCH_DISPATCH_H */
+
 /**
  * Size of the internal FIFO buffers as a number of audio packets
  */
-- 
2.5.4 (Apple Git-61)

Finally took the time to take a look at this one, works on my machine (OSX 
10.11.3) with the latest ffmpeg from git; would appreciate maybe someone else 
to test it, see if it works on other people's machines as well, I don't see why 
it shouldn't but just to be sure :)

Josh
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel