1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-05 13:06:44 +02:00

Implement groupAV

This commit is contained in:
zugz
2020-05-07 00:00:00 +00:00
committed by zugz (tox)
parent daf794c4a2
commit ddcf224db2
15 changed files with 794 additions and 120 deletions

View File

@ -27,17 +27,36 @@
#include "windows.h"
#define SIDEBAR_WIDTH 16
#define SDBAR_OFST 2 /* Offset for the peer number box at the top of the statusbar */
#define MAX_CONFERENCE_NUM (MAX_WINDOWS_NUM - 2)
#define MAX_CONFERENCE_NUM MAX_WINDOWS_NUM - 2
#define CONFERENCE_EVENT_WAIT 3
typedef struct ConferencePeer {
bool active;
uint8_t pubkey[TOX_PUBLIC_KEY_SIZE];
uint32_t peernumber;
char name[TOX_MAX_NAME_LENGTH];
size_t name_length;
uint32_t peernumber;
bool sending_audio;
uint32_t audio_out_idx;
time_t last_audio_time;
} ConferencePeer;
typedef struct AudioInputCallbackData {
Tox *tox;
uint32_t conferencenum;
} AudioInputCallbackData;
#define PUBKEY_STRING_SIZE (2 * TOX_PUBLIC_KEY_SIZE + 1)
typedef struct NameListEntry {
char name[TOX_MAX_NAME_LENGTH];
char pubkey_str[PUBKEY_STRING_SIZE];
uint32_t peernum;
} NameListEntry;
typedef struct {
int chatwin;
bool active;
@ -48,8 +67,13 @@ typedef struct {
ConferencePeer *peer_list;
uint32_t max_idx;
char **name_list;
NameListEntry *name_list;
uint32_t num_peers;
bool audio_enabled;
time_t last_sent_audio;
uint32_t audio_in_idx;
AudioInputCallbackData audio_input_callback_data;
} ConferenceChat;
/* Frees all Toxic associated data structures for a conference (does not call tox_conference_delete() ) */
@ -60,4 +84,23 @@ int init_conference_win(Tox *m, uint32_t conferencenum, uint8_t type, const char
/* destroys and re-creates conference window with or without the peerlist */
void redraw_conference_win(ToxWindow *self);
/* Puts `(NameListEntry *)`s in `entries` for each matched peer, up to a maximum
* of `maxpeers`.
* Maches each peer whose name or pubkey begins with `prefix`.
* If `prefix` is exactly the pubkey of a peer, matches only that peer.
* return number of entries placed in `entries`.
*/
uint32_t get_name_list_entries_by_prefix(uint32_t conferencenum, const char *prefix, NameListEntry **entries,
uint32_t maxpeers);
bool init_conference_audio_input(Tox *tox, uint32_t conferencenum);
bool enable_conference_audio(Tox *tox, uint32_t conferencenum);
bool disable_conference_audio(Tox *tox, uint32_t conferencenum);
void audio_conference_callback(void *tox, uint32_t conferencenum, uint32_t peernumber,
const int16_t *pcm, unsigned int samples, uint8_t channels, uint32_t
sample_rate, void *userdata);
bool conference_mute_self(uint32_t conferencenum);
bool conference_mute_peer(const Tox *m, uint32_t conferencenum, uint32_t peernum);
#endif /* CONFERENCE_H */