diff options
Diffstat (limited to 'toxav/toxav_old.c')
-rw-r--r-- | toxav/toxav_old.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/toxav/toxav_old.c b/toxav/toxav_old.c new file mode 100644 index 00000000..7d7e5e7b --- /dev/null +++ b/toxav/toxav_old.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* toxav_old.h | ||
2 | * | ||
3 | * Copyright (C) 2013-2015 Tox project All Rights Reserved. | ||
4 | * | ||
5 | * This file is part of Tox. | ||
6 | * | ||
7 | * Tox is free software: you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation, either version 3 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * Tox is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | ||
20 | */ | ||
21 | /** | ||
22 | * This file contains the group chats code for the backwards compatibility. | ||
23 | */ | ||
24 | |||
25 | #include "toxav.h" | ||
26 | #include "group.h" | ||
27 | |||
28 | /* Create a new toxav group. | ||
29 | * | ||
30 | * return group number on success. | ||
31 | * return -1 on failure. | ||
32 | * | ||
33 | * Audio data callback format: | ||
34 | * audio_callback(Tox *tox, int groupnumber, int peernumber, const int16_t *pcm, unsigned int samples, uint8_t channels, unsigned int sample_rate, void *userdata) | ||
35 | * | ||
36 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). | ||
37 | */ | ||
38 | int toxav_add_av_groupchat(struct Tox *tox, void (*audio_callback)(void *, int, int, const int16_t *, unsigned int, | ||
39 | uint8_t, unsigned int, void *), void *userdata) | ||
40 | { | ||
41 | Messenger *m = (Messenger *)tox; | ||
42 | return add_av_groupchat(m->group_chat_object, audio_callback, userdata); | ||
43 | } | ||
44 | |||
45 | /* Join a AV group (you need to have been invited first.) | ||
46 | * | ||
47 | * returns group number on success | ||
48 | * returns -1 on failure. | ||
49 | * | ||
50 | * Audio data callback format (same as the one for toxav_add_av_groupchat()): | ||
51 | * audio_callback(Tox *tox, int groupnumber, int peernumber, const int16_t *pcm, unsigned int samples, uint8_t channels, unsigned int sample_rate, void *userdata) | ||
52 | * | ||
53 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). | ||
54 | */ | ||
55 | int toxav_join_av_groupchat(struct Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length, | ||
56 | void (*audio_callback)(void *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *), | ||
57 | void *userdata) | ||
58 | { | ||
59 | Messenger *m = (Messenger *)tox; | ||
60 | return join_av_groupchat(m->group_chat_object, friendnumber, data, length, audio_callback, userdata); | ||
61 | } | ||
62 | |||
63 | /* Send audio to the group chat. | ||
64 | * | ||
65 | * return 0 on success. | ||
66 | * return -1 on failure. | ||
67 | * | ||
68 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). | ||
69 | * | ||
70 | * Valid number of samples are ((sample rate) * (audio length (Valid ones are: 2.5, 5, 10, 20, 40 or 60 ms)) / 1000) | ||
71 | * Valid number of channels are 1 or 2. | ||
72 | * Valid sample rates are 8000, 12000, 16000, 24000, or 48000. | ||
73 | * | ||
74 | * Recommended values are: samples = 960, channels = 1, sample_rate = 48000 | ||
75 | */ | ||
76 | int toxav_group_send_audio(struct Tox *tox, int groupnumber, const int16_t *pcm, unsigned int samples, uint8_t channels, | ||
77 | unsigned int sample_rate) | ||
78 | { | ||
79 | Messenger *m = (Messenger *)tox; | ||
80 | return group_send_audio(m->group_chat_object, groupnumber, pcm, samples, channels, sample_rate); | ||
81 | } \ No newline at end of file | ||