1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-03 12:16:44 +02:00

Merge new AV branch

This commit is contained in:
Jfreegman
2015-10-20 17:57:54 -04:00
29 changed files with 2261 additions and 349 deletions

View File

@ -54,7 +54,7 @@
#include "settings.h"
#include "log.h"
#include "notify.h"
#include "device.h"
#include "audio_device.h"
#include "message_queue.h"
#include "execute.h"
#include "term_mplex.h"
@ -65,7 +65,10 @@
#ifdef AUDIO
#include "audio_call.h"
ToxAv *av;
#ifdef VIDEO
#include "video_call.h"
#endif /* VIDEO */
ToxAV *av;
#endif /* AUDIO */
#ifndef PACKAGE_DATADIR
@ -86,7 +89,7 @@ ToxWindow *prompt = NULL;
struct Winthread Winthread;
struct cqueue_thread cqueue_thread;
struct audio_thread audio_thread;
struct av_thread av_thread;
struct arg_opts arg_opts;
struct user_settings *user_settings = NULL;
@ -149,6 +152,11 @@ void exit_toxic_success(Tox *m)
terminate_notify();
#ifdef AUDIO
#ifdef VIDEO
terminate_video();
#endif /* VIDEO */
terminate_audio();
#endif /* AUDIO */
@ -876,16 +884,16 @@ void *thread_cqueue(void *data)
}
#ifdef AUDIO
void *thread_audio(void *data)
void *thread_av(void *data)
{
ToxAv *av = (ToxAv *) data;
ToxAV *av = (ToxAV *) data;
while (true) {
pthread_mutex_lock(&Winthread.lock);
toxav_do(av);
toxav_iterate(av);
pthread_mutex_unlock(&Winthread.lock);
usleep(toxav_do_interval(av) * 1000);
usleep(toxav_iteration_interval(av) * 1000);
}
}
#endif /* AUDIO */
@ -1256,9 +1264,14 @@ int main(int argc, char **argv)
#ifdef AUDIO
av = init_audio(prompt, m);
#ifdef VIDEO
init_video(prompt, m);
/* audio thread */
if (pthread_create(&audio_thread.tid, NULL, thread_audio, (void *) av) != 0)
#endif /* VIDEO */
/* AV thread */
if (pthread_create(&av_thread.tid, NULL, thread_av, (void *) av) != 0)
exit_toxic_err("failed in main", FATALERR_THREAD_CREATE);
set_primary_device(input, user_settings->audio_in_dev);