From ecf1c317b72edbaec3545a7bd05591cf781cf07d Mon Sep 17 00:00:00 2001 From: aSourceFish <33579456+aSourceFish@users.noreply.github.com> Date: Wed, 15 Nov 2017 05:24:19 +0200 Subject: [PATCH 1/5] Make Toxic compile at NetBSD, STAGE 0 --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 9c55ae6..ac88807 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,9 @@ endif ifeq ($(UNAME_S), OpenBSD) -include $(CFG_DIR)/systems/FreeBSD.mk endif +ifeq ($(UNAME_S), NetBSD) + -include $(CFG_DIR)/systems/FreeBSD.mk +endif ifeq ($(UNAME_S), Darwin) -include $(CFG_DIR)/systems/Darwin.mk endif From 1382adb1f63aba5e5ff09031c100b603b374e8b3 Mon Sep 17 00:00:00 2001 From: aSourceFish <33579456+aSourceFish@users.noreply.github.com> Date: Wed, 15 Nov 2017 05:46:47 +0200 Subject: [PATCH 2/5] Make Toxic compile at NetBSD, STAGE 1 --- src/video_device.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/video_device.c b/src/video_device.c index 2cca9f0..d72943a 100644 --- a/src/video_device.c +++ b/src/video_device.c @@ -30,18 +30,18 @@ #include -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__OSX__) +#import "osx_video.h" +#else #include #include #include #include +#if defined(__linux__) #include -#elif defined(__OpenBSD__) -#include -#include +#else #include -#else /* __OSX__ */ -#import "osx_video.h" +#endif #endif #include "line_info.h" @@ -69,7 +69,7 @@ typedef struct VideoDevice { void *cb_data; /* Data to be passed to callback */ int32_t friend_number; /* ToxAV friend number */ -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD int fd; /* File descriptor of video device selected/opened */ struct v4l2_format fmt; struct VideoBuffer *buffers; @@ -136,7 +136,7 @@ static void yuv420tobgr(uint16_t width, uint16_t height, const uint8_t *y, } } -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD static void yuv422to420(uint8_t *plane_y, uint8_t *plane_u, uint8_t *plane_v, uint8_t *input, uint16_t width, uint16_t height) { @@ -185,7 +185,7 @@ VideoDeviceError init_video_devices() { size[vdt_input] = 0; -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD for (; size[vdt_input] <= MAX_DEVICES; ++size[vdt_input]) { int fd; @@ -275,7 +275,7 @@ VideoDeviceError terminate_video_devices() VideoDeviceError register_video_device_callback(int32_t friend_number, uint32_t device_idx, VideoDataHandleCallback callback, void *data) { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD if ( size[vdt_input] <= device_idx || !video_devices_running[vdt_input][device_idx] || !video_devices_running[vdt_input][device_idx]->fd ) @@ -359,7 +359,7 @@ VideoDeviceError open_video_device(VideoDeviceType type, int32_t selection, uint if ( type == vdt_input ) { video_thread_paused = true; -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD /* Open selected device */ char device_address[] = "/dev/videoXX"; snprintf(device_address + 10, sizeof(device_address) - 10, "%i", selection); @@ -670,7 +670,7 @@ void *video_thread_poll (void *arg) // TODO: maybe use thread for every input so uint8_t *u = device->input.planes[1]; uint8_t *v = device->input.planes[2]; -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD struct v4l2_buffer buf; memset(&(buf), 0, sizeof(buf)); @@ -730,14 +730,14 @@ void *video_thread_poll (void *arg) // TODO: maybe use thread for every input so XFlush(device->x_display); free(img_data); -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__linux__) || SYSTEM == BSD if ( -1 == xioctl(device->fd, VIDIOC_QBUF, &buf) ) { unlock; continue; } -#endif /* __linux__ */ +#endif /* __linux__ / BSD */ } @@ -769,7 +769,7 @@ VideoDeviceError close_video_device(VideoDeviceType type, uint32_t device_idx) if ( !device->ref_count ) { if ( type == vdt_input ) { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD enum v4l2_buf_type buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if ( -1 == xioctl(device->fd, VIDIOC_STREAMOFF, &buf_type) ) {} @@ -792,9 +792,9 @@ VideoDeviceError close_video_device(VideoDeviceType type, uint32_t device_idx) XCloseDisplay(device->x_display); pthread_mutex_destroy(device->mutex); -#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(__linux__) || SYSTEM == BSD free(device->buffers); -#endif /* __linux__ */ +#endif /* __linux__ / BSD */ free(device); } else { From ed1e617380fd2b262f86a6d37e61977233d99e60 Mon Sep 17 00:00:00 2001 From: aSourceFish <33579456+aSourceFish@users.noreply.github.com> Date: Wed, 15 Nov 2017 05:50:00 +0200 Subject: [PATCH 3/5] Make Toxic compile at NetBSD, STAGE 2 --- src/misc_tools.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc_tools.c b/src/misc_tools.c index 5751929..b9cddaa 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -26,10 +26,10 @@ #include #include #include -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if SYSTEM == BSD #include #include -#endif +#endif /* BSD! */ #include #include From c4386b195fce5538bce4ecbb8059c0806d23442d Mon Sep 17 00:00:00 2001 From: aSourceFish <33579456+aSourceFish@users.noreply.github.com> Date: Wed, 15 Nov 2017 05:54:46 +0200 Subject: [PATCH 4/5] A bit of standard... --- src/toxic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/toxic.c b/src/toxic.c index 3722fc0..4403e43 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include From b905a1a3c570e3909a7513866d6c6628286ec7c8 Mon Sep 17 00:00:00 2001 From: aSourceFish <33579456+aSourceFish@users.noreply.github.com> Date: Wed, 15 Nov 2017 05:56:13 +0200 Subject: [PATCH 5/5] One more bit of standard... --- src/name_lookup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/name_lookup.c b/src/name_lookup.c index 2b68bb4..77f823d 100644 --- a/src/name_lookup.c +++ b/src/name_lookup.c @@ -21,6 +21,7 @@ */ #include +#include #include #include