summaryrefslogtreecommitdiff
path: root/toxav/toxav.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-11-10 17:59:14 -0500
committerirungentoo <irungentoo@gmail.com>2014-11-10 17:59:14 -0500
commit94ac52437461b2c97e51800f7371adf12fb7fbf7 (patch)
treeb8582f9ed0706908e31afad0f164364050305cdf /toxav/toxav.c
parent97742ed1e974dbda07f8749f53a63d96b88f345a (diff)
Group audio might work now but I have not tested anything yet.
Diffstat (limited to 'toxav/toxav.c')
-rw-r--r--toxav/toxav.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 8549bc05..76e40e89 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -23,6 +23,8 @@
23#include "config.h" 23#include "config.h"
24#endif /* HAVE_CONFIG_H */ 24#endif /* HAVE_CONFIG_H */
25 25
26#define __TOX_DEFINED__
27typedef struct Messenger Tox;
26 28
27#define _GNU_SOURCE /* implicit declaration warning */ 29#define _GNU_SOURCE /* implicit declaration warning */
28 30
@@ -30,6 +32,7 @@
30#include "codec.h" 32#include "codec.h"
31#include "msi.h" 33#include "msi.h"
32#include "toxav.h" 34#include "toxav.h"
35#include "group.h"
33 36
34#include "../toxcore/logger.h" 37#include "../toxcore/logger.h"
35 38
@@ -1148,3 +1151,42 @@ end:
1148 rtp_free_msg(NULL, _msg); 1151 rtp_free_msg(NULL, _msg);
1149 } 1152 }
1150} 1153}
1154
1155
1156/* Create a new toxav group.
1157 *
1158 * return group number on success.
1159 * return -1 on failure.
1160 */
1161int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(Messenger *, int, int, const int16_t *, unsigned int,
1162 uint8_t, unsigned int, void *), void *userdata)
1163{
1164 Messenger *m = tox;
1165 return add_av_groupchat(m->group_chat_object, audio_callback, userdata);
1166}
1167
1168/* Join a AV group (you need to have been invited first.)
1169 *
1170 * returns group number on success
1171 * returns -1 on failure.
1172 */
1173int toxav_join_av_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length,
1174 void (*audio_callback)(Messenger *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *),
1175 void *userdata)
1176{
1177 Messenger *m = tox;
1178 return join_av_groupchat(m->group_chat_object, friendnumber, data, length, audio_callback, userdata);
1179}
1180
1181/* Send audio to the group chat.
1182 *
1183 * return 0 on success.
1184 * return -1 on failure.
1185 */
1186int toxav_group_send_audio(Tox *tox, int groupnumber, const int16_t *pcm, unsigned int samples, uint8_t channels,
1187 unsigned int sample_rate)
1188{
1189 Messenger *m = tox;
1190 return group_send_audio(m->group_chat_object, groupnumber, pcm, samples, channels, sample_rate);
1191}
1192