/* video_call.c * * * Copyright (C) 2014 Toxic All Rights Reserved. * * This file is part of Toxic. * * Toxic is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Toxic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Toxic. If not, see . * */ #include "toxic.h" #include "windows.h" #include "video_call.h" #include "video_device.h" #include "chat_commands.h" #include "global_commands.h" #include "line_info.h" #include "notify.h" #include #include #include #include #include #include #include #define cbend pthread_exit(NULL) #define MAX_CALLS 10 struct VSettings { VideoError errors; ToxAv *av; ToxAvCSettings cs; Call calls[MAX_CALLS]; } VSettins; ToxAv *init_video(ToxWindow *self, Tox *tox, ToxAv *av) { VSettins.cs = av_DefaultSettings; VSettins.cs.max_video_height = 1024; VSettins.cs.max_video_width = 1024; VSettins.errors = ve_None; VSettins.av = av; memset(VSettins.calls, 0, sizeof(VSettins.calls)); if( !VSettins.av ) { //line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "New toxav instance"); VSettins.av = toxav_new(tox, MAX_CALLS); } if ( !VSettins.av ) { VSettins.errors |= ve_StartingCoreVideo; return NULL; } if ( init_video_devices(VSettins.av) == vde_InternalError ) { line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to init video devices"); //toxav_kill(VSettins.av); return VSettins.av = NULL; } return VSettins.av; } void terminate_video() { int i; for (i = 0; i < MAX_CALLS; ++i) stop_video_transmission(&VSettins.calls[i], i); terminate_video_devices(); } int start_video_transmission(ToxWindow *self, Call *call) { return 0; } int stop_video_transmission(Call *call, int call_index) { return 0; } /* * Commands from chat_commands.h */ void cmd_enablevid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) { line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Video Enabled"); return; } void cmd_disablevid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) { line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Video Disabled"); return; }