diff options
Diffstat (limited to 'toxav')
-rw-r--r-- | toxav/group.c | 26 | ||||
-rw-r--r-- | toxav/group.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/toxav/group.c b/toxav/group.c index 503adc57..e165cb77 100644 --- a/toxav/group.c +++ b/toxav/group.c | |||
@@ -189,14 +189,39 @@ static Group_AV *new_group_av(unsigned int audio_channels, unsigned int audio_sa | |||
189 | 189 | ||
190 | static void group_av_peer_new(void *object, int groupnumber, int friendgroupnumber) | 190 | static void group_av_peer_new(void *object, int groupnumber, int friendgroupnumber) |
191 | { | 191 | { |
192 | Group_Peer_AV *peer_av = calloc(1, sizeof(Group_Peer_AV)); | ||
192 | 193 | ||
194 | if (!peer_av) | ||
195 | return; | ||
193 | 196 | ||
197 | peer_av->buffer = create_queue(3); //TODO Use variable instead. | ||
194 | } | 198 | } |
195 | 199 | ||
196 | static void group_av_peer_delete(void *object, int groupnumber, int friendgroupnumber, void *peer_object) | 200 | static void group_av_peer_delete(void *object, int groupnumber, int friendgroupnumber, void *peer_object) |
197 | { | 201 | { |
202 | Group_Peer_AV *peer_av = peer_object; | ||
203 | |||
204 | if (!peer_av) | ||
205 | return; | ||
206 | |||
207 | if (peer_av->audio_decoder) | ||
208 | opus_decoder_destroy(peer_av->audio_decoder); | ||
209 | |||
210 | terminate_queue(peer_av->buffer); | ||
211 | free(peer_object); | ||
212 | } | ||
213 | |||
214 | static int handle_group_audio_packet(void *object, int groupnumber, int friendgroupnumber, void *peer_object, | ||
215 | const uint8_t *packet, uint16_t length) | ||
216 | { | ||
217 | if (!peer_object || !object) | ||
218 | return -1; | ||
198 | 219 | ||
220 | Group_Peer_AV *peer_av = peer_object; | ||
199 | 221 | ||
222 | //TODO: parse packet into Group_Audio_Packet | ||
223 | //queue(peer_av->buffer, Group_Audio_Packet *pk) | ||
224 | return 0; | ||
200 | } | 225 | } |
201 | 226 | ||
202 | static int groupchat_enable_av(Group_Chats *g_c, int groupnumber) | 227 | static int groupchat_enable_av(Group_Chats *g_c, int groupnumber) |
@@ -214,6 +239,7 @@ static int groupchat_enable_av(Group_Chats *g_c, int groupnumber) | |||
214 | return -1; | 239 | return -1; |
215 | } | 240 | } |
216 | 241 | ||
242 | group_lossy_packet_registerhandler(g_c, GROUP_AUDIO_PACKET_ID, &handle_group_audio_packet); | ||
217 | return 0; | 243 | return 0; |
218 | } | 244 | } |
219 | 245 | ||
diff --git a/toxav/group.h b/toxav/group.h index 19bb0483..1427fe18 100644 --- a/toxav/group.h +++ b/toxav/group.h | |||
@@ -23,6 +23,8 @@ | |||
23 | 23 | ||
24 | #include "../toxcore/group.h" | 24 | #include "../toxcore/group.h" |
25 | 25 | ||
26 | #define GROUP_AUDIO_PACKET_ID 192 | ||
27 | |||
26 | /* Create a new toxav group. | 28 | /* Create a new toxav group. |
27 | * | 29 | * |
28 | * return group number on success. | 30 | * return group number on success. |