mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 21:03:02 +01:00
Changed to toggle video command rather than two separate commands
This commit is contained in:
parent
2cdcbc07a7
commit
8a66c3fa4c
@ -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 */
|
||||||
|
|
||||||
|
@ -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 },
|
||||||
};
|
};
|
||||||
|
@ -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
|
||||||
|
@ -138,7 +138,7 @@ int start_video_transmission(ToxWindow *self, ToxAV *av, Call *call)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( register_video_device_callback(self->num, call->vin_idx, read_video_device_callback, &self->num) != vde_None)
|
if ( register_video_device_callback(self->num, call->vin_idx, read_video_device_callback, &self->num) != vde_None )
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to register input video handler!");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to register input video handler!");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -257,49 +257,21 @@ void cmd_video(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
|
|||||||
goto on_error;
|
goto on_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !self->stb->connection ) {
|
|
||||||
error_str = "Friend is offline.";
|
|
||||||
goto on_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !self->is_call ) {
|
|
||||||
error_str = "Not in call!";
|
|
||||||
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);
|
|
||||||
|
|
||||||
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 ) {
|
if ( this_call->vin_idx == -1 ) {
|
||||||
error_str = "Video is not running in this call.";
|
if ( !self->stb->connection ) {
|
||||||
goto on_error;
|
error_str = "Friend is offline.";
|
||||||
}
|
goto on_error;
|
||||||
|
}
|
||||||
|
|
||||||
callback_video_end(self->num);
|
if ( !self->is_call ) {
|
||||||
|
error_str = "Not in call!";
|
||||||
|
goto on_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback_video_starting(self->num);
|
||||||
|
} else {
|
||||||
|
callback_video_end(self->num);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
on_error:
|
on_error:
|
||||||
|
@ -171,7 +171,7 @@ VideoDeviceError init_video_devices()
|
|||||||
{
|
{
|
||||||
size[vdt_input] = 0;
|
size[vdt_input] = 0;
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
for (; size[vdt_input] <= MAX_DEVICES; ++size[vdt_input]) {
|
for (; size[vdt_input] <= MAX_DEVICES; ++size[vdt_input]) {
|
||||||
int fd;
|
int fd;
|
||||||
char device_address[] = "/dev/videoXX";
|
char device_address[] = "/dev/videoXX";
|
||||||
@ -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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user