1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 15:53:26 +01:00

Obtain names of video devices using v4l

This commit is contained in:
cnhenry 2015-07-10 21:55:49 -05:00
parent 9863dfc2ae
commit e0a35a6569

View File

@ -26,6 +26,10 @@
#include "video_call.h" #include "video_call.h"
#endif /* VIDEO */ #endif /* VIDEO */
#ifdef __linux__
#include "linux/videodev2.h"
#endif /* __linux__ */
#include "line_info.h" #include "line_info.h"
#include "settings.h" #include "settings.h"
@ -80,10 +84,27 @@ VideoDeviceError init_video_devices(ToxAV* av_)
#else #else
#endif /* VIDEO */ #endif /* VIDEO */
{ {
const char *stringed_device_list;
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);
if (v4l_fd == -1)
break;
else {
int name_length = sizeof(cap.card);
device_names[input][i] = video_cap.card;
}
close(v4l_fd);
size[input] = i;
}
#endif /* __linux__ */
size[output] = 0; size[output] = 0;
// Start poll thread // Start poll thread