mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 03:03:02 +01:00
Merge branch 'aSourceFish-master'
This commit is contained in:
commit
93175314b5
3
Makefile
3
Makefile
@ -30,6 +30,9 @@ endif
|
|||||||
ifeq ($(UNAME_S), OpenBSD)
|
ifeq ($(UNAME_S), OpenBSD)
|
||||||
-include $(CFG_DIR)/systems/FreeBSD.mk
|
-include $(CFG_DIR)/systems/FreeBSD.mk
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(UNAME_S), NetBSD)
|
||||||
|
-include $(CFG_DIR)/systems/FreeBSD.mk
|
||||||
|
endif
|
||||||
ifeq ($(UNAME_S), Darwin)
|
ifeq ($(UNAME_S), Darwin)
|
||||||
-include $(CFG_DIR)/systems/Darwin.mk
|
-include $(CFG_DIR)/systems/Darwin.mk
|
||||||
endif
|
endif
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if SYSTEM == BSD
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif /* BSD! */
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -30,18 +30,18 @@
|
|||||||
|
|
||||||
#include <vpx/vpx_image.h>
|
#include <vpx/vpx_image.h>
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__)
|
#if defined(__OSX__)
|
||||||
|
#import "osx_video.h"
|
||||||
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#if defined(__linux__)
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
#elif defined(__OpenBSD__)
|
#else
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/videoio.h>
|
#include <sys/videoio.h>
|
||||||
#else /* __OSX__ */
|
#endif
|
||||||
#import "osx_video.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "line_info.h"
|
#include "line_info.h"
|
||||||
@ -69,7 +69,7 @@ typedef struct VideoDevice {
|
|||||||
void *cb_data; /* Data to be passed to callback */
|
void *cb_data; /* Data to be passed to callback */
|
||||||
int32_t friend_number; /* ToxAV friend number */
|
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 */
|
int fd; /* File descriptor of video device selected/opened */
|
||||||
struct v4l2_format fmt;
|
struct v4l2_format fmt;
|
||||||
struct VideoBuffer *buffers;
|
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,
|
static void yuv422to420(uint8_t *plane_y, uint8_t *plane_u, uint8_t *plane_v,
|
||||||
uint8_t *input, uint16_t width, uint16_t height)
|
uint8_t *input, uint16_t width, uint16_t height)
|
||||||
{
|
{
|
||||||
@ -185,7 +185,7 @@ VideoDeviceError init_video_devices()
|
|||||||
{
|
{
|
||||||
size[vdt_input] = 0;
|
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]) {
|
for (; size[vdt_input] <= MAX_DEVICES; ++size[vdt_input]) {
|
||||||
int fd;
|
int fd;
|
||||||
@ -275,7 +275,7 @@ VideoDeviceError terminate_video_devices()
|
|||||||
VideoDeviceError register_video_device_callback(int32_t friend_number, uint32_t device_idx,
|
VideoDeviceError register_video_device_callback(int32_t friend_number, uint32_t device_idx,
|
||||||
VideoDataHandleCallback callback, void *data)
|
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]
|
if ( size[vdt_input] <= device_idx || !video_devices_running[vdt_input][device_idx]
|
||||||
|| !video_devices_running[vdt_input][device_idx]->fd )
|
|| !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 ) {
|
if ( type == vdt_input ) {
|
||||||
video_thread_paused = true;
|
video_thread_paused = true;
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(__linux__) || SYSTEM == BSD
|
||||||
/* Open selected device */
|
/* Open selected device */
|
||||||
char device_address[] = "/dev/videoXX";
|
char device_address[] = "/dev/videoXX";
|
||||||
snprintf(device_address + 10, sizeof(device_address) - 10, "%i", selection);
|
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 *u = device->input.planes[1];
|
||||||
uint8_t *v = device->input.planes[2];
|
uint8_t *v = device->input.planes[2];
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(__linux__) || SYSTEM == BSD
|
||||||
struct v4l2_buffer buf;
|
struct v4l2_buffer buf;
|
||||||
memset(&(buf), 0, sizeof(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);
|
XFlush(device->x_display);
|
||||||
free(img_data);
|
free(img_data);
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__)
|
#if defined(__linux__) || SYSTEM == BSD
|
||||||
|
|
||||||
if ( -1 == xioctl(device->fd, VIDIOC_QBUF, &buf) ) {
|
if ( -1 == xioctl(device->fd, VIDIOC_QBUF, &buf) ) {
|
||||||
unlock;
|
unlock;
|
||||||
continue;
|
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 ( !device->ref_count ) {
|
||||||
|
|
||||||
if ( type == vdt_input ) {
|
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;
|
enum v4l2_buf_type buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
|
|
||||||
if ( -1 == xioctl(device->fd, VIDIOC_STREAMOFF, &buf_type) ) {}
|
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);
|
XCloseDisplay(device->x_display);
|
||||||
pthread_mutex_destroy(device->mutex);
|
pthread_mutex_destroy(device->mutex);
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
#if defined(__linux__) || SYSTEM == BSD
|
||||||
free(device->buffers);
|
free(device->buffers);
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ / BSD */
|
||||||
|
|
||||||
free(device);
|
free(device);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user