mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
shm: Fix compilation of shm on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=689183
This commit is contained in:
parent
13910f5154
commit
1c973536b9
3 changed files with 35 additions and 10 deletions
27
configure.ac
27
configure.ac
|
@ -682,15 +682,24 @@ AG_GST_CHECK_FEATURE(QUICKTIME, [QuickTime wrapper], qtwrapper, [
|
||||||
dnl check for shm_open (for shm plugin)
|
dnl check for shm_open (for shm plugin)
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_SHM, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_SHM, true)
|
||||||
AG_GST_CHECK_FEATURE(SHM, [POSIX shared memory source and sink], shm, [
|
AG_GST_CHECK_FEATURE(SHM, [POSIX shared memory source and sink], shm, [
|
||||||
if test "x$HAVE_SYS_SOCKET_H" = "xyes"; then
|
if test "x$HAVE_SYS_SOCKET_H" = "xyes"; then
|
||||||
AC_CHECK_LIB([rt], [shm_open],
|
case $host in
|
||||||
AC_CHECK_DECL([MSG_NOSIGNAL], HAVE_SHM=yes, HAVE_SHM=no, [
|
*-darwin* | *-macos10*)
|
||||||
#include <sys/socket.h>
|
AM_CONDITIONAL([HAVE_OSX], true)
|
||||||
]),
|
AC_DEFINE(HAVE_OSX,[1],[Apple Mac OS X operating system detected])
|
||||||
HAVE_SHM=no)
|
HAVE_SHM=yes
|
||||||
else
|
;;
|
||||||
HAVE_SHM=no
|
*)
|
||||||
fi
|
AC_CHECK_LIB([rt], [shm_open],
|
||||||
|
AC_CHECK_DECL([MSG_NOSIGNAL], HAVE_SHM=yes, HAVE_SHM=no, [
|
||||||
|
#include <sys/socket.h>
|
||||||
|
]),
|
||||||
|
HAVE_SHM=no)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
HAVE_SHM=no
|
||||||
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl check for Video CD
|
dnl check for Video CD
|
||||||
|
|
|
@ -2,8 +2,14 @@ plugin_LTLIBRARIES = libgstshm.la
|
||||||
|
|
||||||
libgstshm_la_SOURCES = shmpipe.c shmalloc.c gstshm.c gstshmsrc.c gstshmsink.c
|
libgstshm_la_SOURCES = shmpipe.c shmalloc.c gstshm.c gstshmsrc.c gstshmsink.c
|
||||||
libgstshm_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS) -DSHM_PIPE_USE_GLIB
|
libgstshm_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS) -DSHM_PIPE_USE_GLIB
|
||||||
libgstshm_la_LIBADD = -lrt
|
|
||||||
libgstshm_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS)
|
libgstshm_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS)
|
||||||
|
|
||||||
|
if HAVE_OSX
|
||||||
|
libgstshm_la_LIBADD =
|
||||||
|
else
|
||||||
|
libgstshm_la_LIBADD = -lrt
|
||||||
|
endif
|
||||||
|
|
||||||
libgstshm_la_LIBTOOLFLAGS = --tag=disable-static
|
libgstshm_la_LIBTOOLFLAGS = --tag=disable-static
|
||||||
|
|
||||||
noinst_HEADERS = gstshmsrc.h gstshmsink.h shmpipe.h shmalloc.h
|
noinst_HEADERS = gstshmsrc.h gstshmsink.h shmpipe.h shmalloc.h
|
||||||
|
|
|
@ -27,6 +27,12 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_OSX
|
||||||
|
#ifndef MSG_NOSIGNAL
|
||||||
|
#define MSG_NOSIGNAL SO_NOSIGPIPE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "shmpipe.h"
|
#include "shmpipe.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -278,7 +284,11 @@ sp_open_shm (char *path, int id, mode_t perms, size_t size)
|
||||||
if (path)
|
if (path)
|
||||||
flags = O_RDONLY;
|
flags = O_RDONLY;
|
||||||
else
|
else
|
||||||
|
#ifdef HAVE_OSX
|
||||||
|
flags = O_RDWR | O_CREAT | O_EXCL;
|
||||||
|
#else
|
||||||
flags = O_RDWR | O_CREAT | O_TRUNC | O_EXCL;
|
flags = O_RDWR | O_CREAT | O_TRUNC | O_EXCL;
|
||||||
|
#endif
|
||||||
|
|
||||||
area->shm_fd = -1;
|
area->shm_fd = -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue