$ git clone http://tcclient.ion.nu/tc_client.git
commit 886cbf493ad7438880b64e68ca7c1b2aa07d537d
Author: Alicia <...>
Date: Sat Oct 22 20:21:37 2016 +0200
Added some compatibility code for OSX.
diff --git a/ChangeLog b/ChangeLog
index 80826a1..f5f29c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
0.41:
+Added some compatibility code for OSX.
tc_client-gtk: bugfix: don't rely on stack allocated variables for GUI callbacks.
tc_client-gtk: install the camera placeholder animation for the 'install' target.
tc_client-gtk: mark outgoing video keyframes as keyframes.
diff --git a/Makefile b/Makefile
index 845c056..3faa68a 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ else
endif
OBJ=client.o amfparser.o rtmp.o numlist.o amfwriter.o idlist.o colors.o endian.o media.o utilities/compat.o
IRCHACK_OBJ=utilities/irchack/irchack.o utilities/compat.o
-MODBOT_OBJ=utilities/modbot/modbot.o utilities/list.o utilities/modbot/queue.o
+MODBOT_OBJ=utilities/modbot/modbot.o utilities/list.o utilities/modbot/queue.o utilities/compat.o
CAMVIEWER_OBJ=utilities/camviewer/camviewer.o utilities/compat.o utilities/compat_av.o libcamera.a
CURSEDCHAT_OBJ=utilities/cursedchat/cursedchat.o utilities/cursedchat/buffer.o utilities/compat.o utilities/list.o
TC_CLIENT_GTK_OBJ=utilities/gtk/camviewer.o utilities/gtk/userlist.o utilities/gtk/media.o utilities/gtk/compat.o utilities/gtk/config.o utilities/gtk/gui.o utilities/stringutils.o utilities/gtk/logging.o utilities/gtk/postproc.o utilities/compat.o utilities/compat_av.o utilities/gtk/inputhistory.o libcamera.a
diff --git a/configure b/configure
index 3300265..63f8c89 100755
--- a/configure
+++ b/configure
@@ -224,10 +224,37 @@ if "$notfound"; then
echo no
fi
-if testbuild 'readline' 'rl_initialize();return 0;' 'stdio.h readline/readline.h' '-lreadline'; then
+if testbuild 'readline' 'rl_initialize();rl_forward(1,27);return 0;' 'stdio.h readline/readline.h' '-lreadline'; then
echo "READLINE_LIBS=-lreadline" >> config.mk
fi
+if ! testbuild 'prctl' 'prctl(PR_SET_PDEATHSIG, SIGHUP);return 0;' 'sys/prctl.h signal.h'; then
+ echo '#define NO_PRCTL 1' >> config.h
+fi
+
+printf 'Checking if we have a working poll()... '
+echo '#include <poll.h>' > polltest.c
+echo '#include <sys/socket.h>' >> polltest.c
+echo '#include <netinet/in.h>' >> polltest.c
+echo 'int main(){' >> polltest.c
+echo 'int s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);' >> polltest.c
+echo 'struct pollfd pfd[]={{.fd=0, .events=POLLIN, .revents=0}, {.fd=s, .events=POLLIN, .revents=0}};' >> polltest.c
+echo 'int x=poll(pfd, 2, 100);' >> polltest.c
+echo 'return x>-1 && (pfd[0].revents==POLLNVAL || pfd[1].revents==POLLNVAL);' >> polltest.c
+echo '}' >> polltest.c
+"$CC" polltest.c -o polltest > /dev/null 2> /dev/null
+if ./polltest 2> /dev/null; then
+ echo yes
+else
+ echo no
+ if testpkgconfig glib-2.0 GLIB; then
+ echo '#define POLL_BROKEN_OR_MISSING 1' >> config.h
+ echo 'LIBS+=$(GLIB_LIBS)' >> config.mk
+ echo 'CFLAGS+=$(GLIB_CFLAGS)' >> config.mk
+ fi
+fi
+rm -f polltest.c polltest
+
testpkgconfig libv4l2 LIBV4L2
testpkgconfig x11 LIBX11
testpkgconfig libpulse-simple PULSE
diff --git a/utilities/camviewer/camviewer.c b/utilities/camviewer/camviewer.c
index 1026ed8..578316a 100644
--- a/utilities/camviewer/camviewer.c
+++ b/utilities/camviewer/camviewer.c
@@ -21,8 +21,6 @@
#ifdef _WIN32
#include <wtypes.h>
#include <winbase.h>
-#else
- #include <sys/prctl.h>
#endif
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
@@ -37,6 +35,9 @@
#endif
#include "../compat.h"
#include "../compat_av.h"
+#ifndef NO_PRCTL
+ #include <sys/prctl.h>
+#endif
#if GTK_MAJOR_VERSION==2
#define GTK_ORIENTATION_HORIZONTAL 0
diff --git a/utilities/compat.h b/utilities/compat.h
index 0b6c66b..9246447 100644
--- a/utilities/compat.h
+++ b/utilities/compat.h
@@ -26,8 +26,16 @@
#ifdef NO_STRNDUP
extern char* strndup(const char* in, unsigned int length);
#endif
+#ifdef POLL_BROKEN_OR_MISSING
+ #include <glib.h>
+ #define poll g_poll
+ #define pollfd _GPollFD
+ #define POLLIN G_IO_IN
+#endif
+#ifdef NO_PRCTL
+ #define prctl(x,y)
+#endif
#ifdef _WIN32
- #define prctl(...)
#define wait(x)
#define mkdir(x,y) mkdir(x)
#endif
diff --git a/utilities/gtk/camviewer.c b/utilities/gtk/camviewer.c
index 5ea990a..d2775af 100644
--- a/utilities/gtk/camviewer.c
+++ b/utilities/gtk/camviewer.c
@@ -23,7 +23,6 @@
#include <wtypes.h>
#include <winbase.h>
#else
- #include <sys/prctl.h>
#include <sys/wait.h>
#endif
#include <ctype.h>
@@ -46,6 +45,11 @@
#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include "../compat.h"
+#include "../compat_av.h"
+#ifndef NO_PRCTL
+ #include <sys/prctl.h>
+#endif
#include "../libcamera/camera.h"
#include "userlist.h"
#include "media.h"
@@ -54,8 +58,6 @@
#include "gui.h"
#include "logging.h"
#include "../stringutils.h"
-#include "../compat.h"
-#include "../compat_av.h"
#include "inputhistory.h"
#include "main.h"
diff --git a/utilities/gtk/gencamplaceholder.sh b/utilities/gtk/gencamplaceholder.sh
index 487dd61..2e5c92b 100755
--- a/utilities/gtk/gencamplaceholder.sh
+++ b/utilities/gtk/gencamplaceholder.sh
@@ -7,6 +7,15 @@ spinnerpos='+281+341
+348+369
+337+341
+309+330'
+seq()
+{ # Some platforms lack the seq utility
+ i="$1"
+ end="$2"
+ while [ "$i" -le "$end" ]; do
+ echo "$i"
+ i="`expr "$i" + 1`"
+ done
+}
{
for frame in `seq 1 16`; do
echo '( ( utilities/gtk/camplaceholder.xcf -layers Merge )'
diff --git a/utilities/libcamera/camera_img.c b/utilities/libcamera/camera_img.c
index 646bcd1..aba4958 100644
--- a/utilities/libcamera/camera_img.c
+++ b/utilities/libcamera/camera_img.c
@@ -1,6 +1,6 @@
/*
libcamera, a camera access abstraction library
- Copyright (C) 2015 alicia@ion.nu
+ Copyright (C) 2015-2016 alicia@ion.nu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -19,13 +19,13 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "camera.h"
-typedef struct CAM_t
+struct CAM_t
{
unsigned int type;
GdkPixbufAnimation* anim;
GdkPixbuf* staticimg;
GdkPixbufAnimationIter* iter;
-} CAM;
+};
const char*(*cam_img_filepicker)(void)=0;