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

Changed to toggle video command rather than two separate commands

This commit is contained in:
cnhenry 2015-08-12 08:24:43 -05:00
parent 2cdcbc07a7
commit 8a66c3fa4c
5 changed files with 23 additions and 50 deletions

View File

@ -45,7 +45,6 @@ void cmd_sense(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE
#ifdef VIDEO #ifdef VIDEO
void cmd_video(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_video(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_end_video(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
void cmd_ccur_video_device(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]); void cmd_ccur_video_device(WINDOW *, ToxWindow *, Tox *, int argc, char (*argv)[MAX_STR_SIZE]);
#endif /* VIDEO */ #endif /* VIDEO */

View File

@ -84,7 +84,6 @@ static struct cmd_func chat_commands[] = {
#endif /* AUDIO */ #endif /* AUDIO */
#ifdef VIDEO #ifdef VIDEO
{ "/video", cmd_video }, { "/video", cmd_video },
{ "/endvideo", cmd_end_video },
#endif /* VIDEO */ #endif /* VIDEO */
{ NULL, NULL }, { NULL, NULL },
}; };

View File

@ -216,8 +216,7 @@ static void help_draw_chat(ToxWindow *self)
wattron(win, A_BOLD); wattron(win, A_BOLD);
wprintw(win, "\n Video:\n"); wprintw(win, "\n Video:\n");
wattroff(win, A_BOLD); wattroff(win, A_BOLD);
wprintw(win, " /video : Send video capture\n"); wprintw(win, " /video : Toggle video call\n");
wprintw(win, " /endvideo : End video capture\n");
#endif /* VIDEO */ #endif /* VIDEO */
help_draw_bottom_menu(win); help_draw_bottom_menu(win);
@ -300,7 +299,7 @@ void help_onKey(ToxWindow *self, wint_t key)
case 'c': case 'c':
#ifdef VIDEO #ifdef VIDEO
help_init_window(self, 23, 80); help_init_window(self, 22, 80);
#elif AUDIO #elif AUDIO
help_init_window(self, 19, 80); help_init_window(self, 19, 80);
#else #else

View File

@ -257,6 +257,7 @@ void cmd_video(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
goto on_error; goto on_error;
} }
if ( this_call->vin_idx == -1 ) {
if ( !self->stb->connection ) { if ( !self->stb->connection ) {
error_str = "Friend is offline."; error_str = "Friend is offline.";
goto on_error; goto on_error;
@ -267,39 +268,10 @@ void cmd_video(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
goto on_error; goto on_error;
} }
if ( this_call->vin_idx != -1 ) {
error_str = "Video is already sending in this call.";
goto on_error;
}
callback_video_starting(self->num); callback_video_starting(self->num);
} else {
return;
on_error:
print_err (self, error_str);
}
void cmd_end_video(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
const char *error_str;
Call* this_call = &CallControl.calls[self->num];
if ( argc != 0 ) {
error_str = "Unknown arguments.";
goto on_error;
}
if ( !CallControl.av ) {
error_str = "ToxAV not supported!";
goto on_error;
}
if ( this_call->vin_idx == -1 ) {
error_str = "Video is not running in this call.";
goto on_error;
}
callback_video_end(self->num); callback_video_end(self->num);
}
return; return;
on_error: on_error:

View File

@ -186,6 +186,7 @@ VideoDeviceError init_video_devices()
/* Query V4L for capture capabilities */ /* Query V4L for capture capabilities */
if ( ioctl(fd, VIDIOC_QUERYCAP, &cap) != -1 ) { if ( ioctl(fd, VIDIOC_QUERYCAP, &cap) != -1 ) {
//strcpy(video_input_name,cap.card);
video_input_name = cap.card; video_input_name = cap.card;
} else { } else {
video_input_name = device_address; video_input_name = device_address;
@ -195,11 +196,13 @@ VideoDeviceError init_video_devices()
close(fd); close(fd);
} }
} }
#endif /* __linux__ */ #else /* __OSX__ */
/* TODO: Add OSX implementation for listing input video devices */ /* TODO: Add OSX implementation for listing input video devices */
#endif
size[vdt_output] = 1; size[vdt_output] = 1;
char* video_output_name = "Video Receiver"; char* video_output_name = "Toxic Video Receiver";
video_devices_names[vdt_output][0] = video_output_name; video_devices_names[vdt_output][0] = video_output_name;
// Start poll thread // Start poll thread
@ -598,6 +601,7 @@ void* video_thread_poll (void* arg) // TODO: maybe use thread for every input so
u = device->input.planes[1]; u = device->input.planes[1];
v = device->input.planes[2]; v = device->input.planes[2];
#else /* __OSX__*/ #else /* __OSX__*/
#endif #endif
/* Convert frame image data to YUV420 for ToxAV */ /* Convert frame image data to YUV420 for ToxAV */