mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 20:13:04 +01:00
Fixes to av.mk
This commit is contained in:
parent
e0a35a6569
commit
a33e5f4bec
@ -8,9 +8,9 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Variables for video call support
|
# Variables for video call support
|
||||||
VIDEO_LIBS = libtoxav xlib
|
VIDEO_LIBS = libtoxav Xlib
|
||||||
AUDIO_CFLAGS = -DVIDEO
|
VIDEO_CFLAGS = -DVIDEO
|
||||||
ifneq (, $(findstring video_device.o $(OBJ)))
|
ifneq (, $(findstring video_device.o, $(OBJ)))
|
||||||
VIDEO_OBJ = video_call.o
|
VIDEO_OBJ = video_call.o
|
||||||
else
|
else
|
||||||
VIDEO_OBJ = video_call.o video_device.o
|
VIDEO_OBJ = video_call.o video_device.o
|
||||||
@ -39,4 +39,5 @@ else ifneq ($(MAKECMDGOALS), clean)
|
|||||||
MISSING_VIDEO_LIBS = $(shell for lib in $(VIDEO_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done)
|
MISSING_VIDEO_LIBS = $(shell for lib in $(VIDEO_LIBS) ; do if ! pkg-config --exists $$lib ; then echo $$lib ; fi ; done)
|
||||||
$(warning WARNING -- Toxic will be compiled without video support)
|
$(warning WARNING -- Toxic will be compiled without video support)
|
||||||
$(warning WARNING -- You will need these libraries for video support)
|
$(warning WARNING -- You will need these libraries for video support)
|
||||||
$(warning WARNING -- $(MISSING_VIDEO_LIBS))
|
$(warning WARNING -- $(MISSING_VIDEO_LIBS))
|
||||||
|
endif
|
@ -75,7 +75,7 @@ static ToxAV* av = NULL;
|
|||||||
pthread_mutext_t mutex;
|
pthread_mutext_t mutex;
|
||||||
|
|
||||||
bool thread_running = true,
|
bool thread_running = true,
|
||||||
thread_paused = true; /* Thread control */
|
thread_paused = true; /* Thread control */
|
||||||
|
|
||||||
void* thread_poll(void*);
|
void* thread_poll(void*);
|
||||||
/* Meet devices */
|
/* Meet devices */
|
||||||
@ -84,52 +84,53 @@ VideoDeviceError init_video_devices(ToxAV* av_)
|
|||||||
#else
|
#else
|
||||||
#endif /* VIDEO */
|
#endif /* VIDEO */
|
||||||
{
|
{
|
||||||
size[input] = 0;
|
size[input] = 0;
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
for(int i = 0; <= MAX_DEVICES; ++i) {
|
|
||||||
int v4l_fd;
|
|
||||||
struct v4l2_capability cap;
|
|
||||||
char *dev_name;
|
|
||||||
|
|
||||||
v4l_fd = open(dev_name, O_RDWR | O_NONBLOCK, 0);
|
#ifdef __linux__
|
||||||
if (v4l_fd == -1)
|
for(int i = 0; <= MAX_DEVICES; ++i) {
|
||||||
break;
|
int v4l_fd;
|
||||||
else {
|
struct v4l2_capability cap;
|
||||||
int name_length = sizeof(cap.card);
|
char *dev_name;
|
||||||
device_names[input][i] = video_cap.card;
|
|
||||||
}
|
|
||||||
|
|
||||||
close(v4l_fd);
|
v4l_fd = open(dev_name, O_RDWR | O_NONBLOCK, 0);
|
||||||
size[input] = i;
|
if (v4l_fd == -1)
|
||||||
}
|
break;
|
||||||
#endif /* __linux__ */
|
else {
|
||||||
|
device_names[input][i] = video_cap.card;
|
||||||
|
}
|
||||||
|
|
||||||
size[output] = 0;
|
close(v4l_fd);
|
||||||
|
size[input] = i;
|
||||||
|
}
|
||||||
|
#endif /* __linux__ */
|
||||||
|
/* TODO: Add OSX implementation for listing input video devices */
|
||||||
|
|
||||||
// Start poll thread
|
size[output] = 0;
|
||||||
if (pthread_mutex_init(&mutex, NULL) != 0)
|
/* TODO: List output video devices */
|
||||||
return vde_InternalError;
|
|
||||||
|
|
||||||
pthread_t thread_id;
|
// Start poll thread
|
||||||
if ( pthread_create(&thread_id, NULL, thread_poll, NULL) != 0 || pthread_detatch(thread_id) != 0)
|
if (pthread_mutex_init(&mutex, NULL) != 0)
|
||||||
return vde_InternalError;
|
return vde_InternalError;
|
||||||
|
|
||||||
|
pthread_t thread_id;
|
||||||
|
if ( pthread_create(&thread_id, NULL, thread_poll, NULL) != 0 || pthread_detatch(thread_id) != 0)
|
||||||
|
return vde_InternalError;
|
||||||
|
|
||||||
#ifdef VIDEO
|
#ifdef VIDEO
|
||||||
av = av_;
|
av = av_;
|
||||||
#endif /* VIDEO */
|
#endif /* VIDEO */
|
||||||
|
|
||||||
return (VideoDeviceError) vde_None;
|
return (VideoDeviceError) vde_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoDeviceError terminate_video_devices()
|
VideoDeviceError terminate_video_devices()
|
||||||
{
|
{
|
||||||
/* Cleanup if needed */
|
/* Cleanup if needed */
|
||||||
thread_running = false;
|
thread_running = false;
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
|
|
||||||
if (pthread_mutex_destroy(&mutex) != 0)
|
if (pthread_mutex_destroy(&mutex) != 0)
|
||||||
return (VideoDeviceError) vde_InternalError;
|
return (VideoDeviceError) vde_InternalError;
|
||||||
|
|
||||||
return (VideoDeviceError) vde_None;
|
return (VideoDeviceError) vde_None;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user