Coverage Report

Created: 2025-10-08 19:34

/work/toxav/groupav.h
Line
Count
Source
1
/* SPDX-License-Identifier: GPL-3.0-or-later
2
 * Copyright © 2016-2025 The TokTok team.
3
 * Copyright © 2014 Tox project.
4
 */
5
#ifndef C_TOXCORE_TOXAV_GROUPAV_H
6
#define C_TOXCORE_TOXAV_GROUPAV_H
7
8
// Audio encoding/decoding
9
#include <opus.h>
10
11
#include "../toxcore/group.h"
12
#include "../toxcore/tox.h"
13
14
871
#define GROUP_AUDIO_PACKET_ID 192
15
16
// TODO(iphydf): Use this better typed one instead of the void-pointer one below.
17
// typedef void audio_data_cb(Tox *tox, uint32_t conference_number, uint32_t peernumber, const int16_t *pcm,
18
//                            uint32_t samples, uint8_t channels, uint32_t sample_rate, void *userdata);
19
typedef void audio_data_cb(void *tox, uint32_t conference_number, uint32_t peernumber, const int16_t *pcm,
20
                           uint32_t samples, uint8_t channels, uint32_t sample_rate, void *userdata);
21
22
/** @brief Create and connect to a new toxav group.
23
 *
24
 * @return conference number on success.
25
 * @retval -1 on failure.
26
 */
27
int add_av_groupchat(const Logger *log, Tox *tox, Group_Chats *g_c, audio_data_cb *audio_callback, void *userdata);
28
29
/** @brief Join a AV group (you need to have been invited first).
30
 *
31
 * @return conference number on success
32
 * @retval -1 on failure.
33
 */
34
int join_av_groupchat(const Logger *log, Tox *tox, Group_Chats *g_c, uint32_t peer_number, const uint8_t *data,
35
                      uint16_t length, audio_data_cb *audio_callback, void *userdata);
36
37
/** @brief Send audio to the conference.
38
 *
39
 * @retval 0 on success.
40
 * @retval -1 on failure.
41
 */
42
int group_send_audio(const Group_Chats *g_c, uint32_t conference_number, const int16_t *pcm, unsigned int samples, uint8_t channels,
43
                     uint32_t sample_rate);
44
45
/** @brief Enable A/V in a conference.
46
 *
47
 * @retval 0 on success.
48
 * @retval -1 on failure.
49
 */
50
int groupchat_enable_av(const Logger *log, Tox *tox, Group_Chats *g_c, uint32_t conference_number,
51
                        audio_data_cb *audio_callback, void *userdata);
52
53
/** @brief Disable A/V in a conference.
54
 *
55
 * @retval 0 on success.
56
 * @retval -1 on failure.
57
 */
58
int groupchat_disable_av(const Group_Chats *g_c, uint32_t conference_number);
59
60
/** Return whether A/V is enabled in the conference. */
61
bool groupchat_av_enabled(const Group_Chats *g_c, uint32_t conference_number);
62
63
#endif /* C_TOXCORE_TOXAV_GROUPAV_H */