Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-3.0-or-later |
2 | | * Copyright © 2016-2018 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 | | |
38 | | /** @brief Send audio to the conference. |
39 | | * |
40 | | * @retval 0 on success. |
41 | | * @retval -1 on failure. |
42 | | */ |
43 | | int group_send_audio(const Group_Chats *g_c, uint32_t conference_number, const int16_t *pcm, unsigned int samples, uint8_t channels, |
44 | | uint32_t sample_rate); |
45 | | |
46 | | /** @brief Enable A/V in a conference. |
47 | | * |
48 | | * @retval 0 on success. |
49 | | * @retval -1 on failure. |
50 | | */ |
51 | | int groupchat_enable_av(const Logger *log, Tox *tox, Group_Chats *g_c, uint32_t conference_number, |
52 | | audio_data_cb *audio_callback, void *userdata); |
53 | | |
54 | | /** @brief Disable A/V in a conference. |
55 | | * |
56 | | * @retval 0 on success. |
57 | | * @retval -1 on failure. |
58 | | */ |
59 | | int groupchat_disable_av(const Group_Chats *g_c, uint32_t conference_number); |
60 | | |
61 | | /** Return whether A/V is enabled in the conference. */ |
62 | | bool groupchat_av_enabled(const Group_Chats *g_c, uint32_t conference_number); |
63 | | |
64 | | #endif /* C_TOXCORE_TOXAV_GROUPAV_H */ |