Quoting Luca Barbato (2016-03-27 19:13:23)
> From: Josh de Kock <[email protected]>
> 
> Previously, with JACK installed, the configure script would enabled the
> JACK indev; this broke on Mac OS X due to a incomplete pthreads
> implementation. Some simple macros to map libdispatch to pthreads if on
> OS X.
> 
> Signed-off-by: Luca Barbato <[email protected]>
> ---
> 
> That's what I have in mind.
> 
> 
>  Makefile                    |  2 +-
>  compat/dispatch_semaphore.h | 35 +++++++++++++++++++++++++++++++++++
>  configure                   |  7 ++++++-
>  libavdevice/jack.c          |  5 +++++
>  4 files changed, 47 insertions(+), 2 deletions(-)
>  create mode 100644 compat/dispatch_semaphore.h
> 
> diff --git a/Makefile b/Makefile
> index 7b1e550..9ffce89 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -104,7 +104,7 @@ FFLIBS := avutil
> 
>  DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset)
> 
> -SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h
> +SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h 
> compat/dispatch_semaphore.h
> 
>  include $(SRC_PATH)/common.mak
> 
> diff --git a/compat/dispatch_semaphore.h b/compat/dispatch_semaphore.h
> new file mode 100644
> index 0000000..910ecbe
> --- /dev/null
> +++ b/compat/dispatch_semaphore.h
> @@ -0,0 +1,35 @@
> +/*
> + * 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_H
> +#define COMPAT_DISPATCH_SEMAPHORE_H
> +
> +#include <dispatch/dispatch.h>
> +#define sem_t dispatch_semaphore_t
> +#define sem_init(psem, x, val) ({                             \
> +    int ret = !!(*psem = dispatch_semaphore_create(val)) - 1; \
> +    if (ret < 0)                                              \
> +        errno = ENOMEM;                                       \
> +    ret;                                                      \
> +})

Just write a proper function, no need for weird non-standard crap.

I.e.
static av_always_inling int compat_sem_init(...) { ... }

#define sem_init compat_sem_init

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to