1 /* toxav thread messages (sent from the client thread to the audio or video thread) */
2 #ifndef UTOX_AV_H
3 #define UTOX_AV_H
4 
5 #include <tox/toxav.h> // if it weren't for TOXAV_CALL_CONTROL we could move this to the .c
6 
7 #include <stdint.h>
8 
9 extern bool utox_av_ctrl_init;
10 
11 #define UTOX_MAX_CALLS 16
12 // UTOX_MAX_VIDEO_CALLS is never used. Remove?
13 #define UTOX_MAX_VIDEO_CALLS 32
14 /* utox av thread commands */
15 enum {
16     UTOXAV_KILL,
17 
18     UTOXAV_INCOMING_CALL_PENDING,
19     UTOXAV_INCOMING_CALL_ANSWER,
20     UTOXAV_INCOMING_CALL_REJECT,
21 
22     UTOXAV_OUTGOING_CALL_PENDING,
23     UTOXAV_OUTGOING_CALL_ACCEPTED,
24     UTOXAV_OUTGOING_CALL_REJECTED,
25 
26     UTOXAV_CALL_END,
27 
28     UTOXAV_GROUPCALL_START,
29     UTOXAV_GROUPCALL_END,
30 
31     UTOXAV_START_AUDIO,
32     UTOXAV_STOP_AUDIO,
33 
34     UTOXAV_START_VIDEO,
35     UTOXAV_STOP_VIDEO,
36 
37     UTOXAV_SET_AUDIO_IN,
38     UTOXAV_SET_AUDIO_OUT,
39 
40     UTOXAV_SET_VIDEO_IN,
41     UTOXAV_SET_VIDEO_OUT,
42 
43     UTOXAV_NEW_TOX_INSTANCE,
44 };
45 
46 enum {
47     // kill the video thread
48     UTOXVIDEO_KILL,
49     UTOXVIDEO_NEW_AV_INSTANCE,
50     /*    UTOXVIDEO_RECORD_START,
51     UTOXVIDEO_RECORD_STOP,
52     UTOXVIDEO_SET,
53     UTOXVIDEO_PREVIEW_START,
54     UTOXVIDEO_PREVIEW_STOP,
55 */
56 };
57 
58 typedef struct groupchat GROUPCHAT;
59 
60 /* send a message to the toxav thread
61  */
62 void postmessage_utoxav(uint8_t msg, uint32_t param1, uint32_t param2, void *data);
63 
64 void utox_av_ctrl_thread(void *args);
65 
66 void utox_av_local_disconnect(ToxAV *av, int32_t friend_number);
67 
68 void utox_av_local_call_control(ToxAV *av, uint32_t friend_number, TOXAV_CALL_CONTROL control);
69 
70 void set_av_callbacks(ToxAV *av);
71 
72 void callback_av_group_audio(void *tox, uint32_t groupnumber, uint32_t peernumber, const int16_t *pcm, unsigned int samples,
73                                     uint8_t channels, unsigned int sample_rate, void *userdata);
74 
75 void group_av_peer_add(GROUPCHAT *g, int peernumber);
76 void group_av_peer_remove(GROUPCHAT *g, int peernumber);
77 
78 #endif
79