1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-14 06:03:03 +01:00

Fixed incorrect video device listing

This commit is contained in:
cnhenry 2015-08-13 20:01:05 -05:00
parent 8a66c3fa4c
commit 96162bf254
3 changed files with 29 additions and 6 deletions

View File

@ -132,6 +132,11 @@ void exit_toxic_success(Tox *m)
#ifdef AUDIO
terminate_audio();
#ifdef VIDEO
terminate_video();
#endif /* VIDEO */
#endif /* AUDIO */
free(DATA_FILE);

View File

@ -81,8 +81,14 @@ ToxAV *init_video(ToxWindow *self, Tox *tox)
void terminate_video()
{
int i;
for (i = 0; i < MAX_CALLS; ++i)
stop_video_transmission(&CallControl.calls[i], i);
for (i = 0; i < MAX_CALLS; ++i) {
Call* this_call = &CallControl.calls[i];
stop_video_transmission(this_call, i);
if( this_call->vout_idx != -1 )
close_video_device(vdt_output, this_call->vout_idx);
}
terminate_video_devices();
}

View File

@ -185,11 +185,17 @@ VideoDeviceError init_video_devices()
char* video_input_name;
/* Query V4L for capture capabilities */
if ( ioctl(fd, VIDIOC_QUERYCAP, &cap) != -1 ) {
//strcpy(video_input_name,cap.card);
video_input_name = cap.card;
if ( -1 != ioctl(fd, VIDIOC_QUERYCAP, &cap) ) {
video_input_name = (char*)malloc(strlen(cap.card) + strlen(device_address) + 4);
strcpy(video_input_name, (char*)cap.card);
strcat(video_input_name, " (");
strcat(video_input_name, (char*)device_address);
strcat(video_input_name, ")");
} else {
video_input_name = device_address;
video_input_name = (char*)malloc(strlen(device_address) + 3);
strcpy(video_input_name, "(");
strcat(video_input_name, device_address);
strcat(video_input_name, ")");
}
video_devices_names[vdt_input][size[vdt_input]] = video_input_name;
@ -226,6 +232,12 @@ VideoDeviceError terminate_video_devices()
video_thread_running = false;
usleep(20000);
int i;
for (i = 0; i < size[vdt_input]; ++i) {
const char* video_input_name = video_devices_names[vdt_input][i];
free(video_input_name);
}
if ( pthread_mutex_destroy(&video_mutex) != 0 )
return (VideoDeviceError) vde_InternalError;