summaryrefslogtreecommitdiff
path: root/toxav/audio.h
diff options
context:
space:
mode:
authorGregory Mullen (grayhatter) <greg@grayhatter.com>2015-11-07 20:36:57 -0800
committerGregory Mullen (grayhatter) <greg@grayhatter.com>2015-11-07 20:36:57 -0800
commite1ad6cc8f9a5613439937096b55b476f65a00730 (patch)
tree9dcf444c993681cc654f0e2874ab66264ec289c6 /toxav/audio.h
parent3631b460a6b763acda718bb71b7f6a1ee31a3299 (diff)
parent6a494e2cbdd146bb13185d8220061322661a5f5a (diff)
Merge remote-tracking branch 'upstream/master' into rm-files
Diffstat (limited to 'toxav/audio.h')
-rw-r--r--toxav/audio.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/toxav/audio.h b/toxav/audio.h
new file mode 100644
index 00000000..b1db7448
--- /dev/null
+++ b/toxav/audio.h
@@ -0,0 +1,64 @@
1/** audio.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#ifndef AUDIO_H
23#define AUDIO_H
24
25#include <opus.h>
26#include <pthread.h>
27
28#include "toxav.h"
29
30#include "../toxcore/util.h"
31
32struct RTPMessage;
33
34typedef struct ACSession_s {
35 /* encoding */
36 OpusEncoder *encoder;
37 int32_t le_sample_rate; /* Last encoder sample rate */
38 int32_t le_channel_count; /* Last encoder channel count */
39 int32_t le_bit_rate; /* Last encoder bit rate */
40
41 /* decoding */
42 OpusDecoder *decoder;
43 int32_t lp_channel_count; /* Last packet channel count */
44 int32_t lp_sampling_rate; /* Last packet sample rate */
45 int32_t lp_frame_duration; /* Last packet frame duration */
46 int32_t ld_sample_rate; /* Last decoder sample rate */
47 int32_t ld_channel_count; /* Last decoder channel count */
48 uint64_t ldrts; /* Last decoder reconfiguration time stamp */
49 void *j_buf;
50
51 pthread_mutex_t queue_mutex[1];
52
53 ToxAV *av;
54 uint32_t friend_number;
55 PAIR(toxav_audio_receive_frame_cb *, void *) acb; /* Audio frame receive callback */
56} ACSession;
57
58ACSession *ac_new(ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb, void *cb_data);
59void ac_kill(ACSession *ac);
60void ac_iterate(ACSession *ac);
61int ac_queue_message(void *acp, struct RTPMessage *msg);
62int ac_reconfigure_encoder(ACSession *ac, int32_t bit_rate, int32_t sampling_rate, uint8_t channels);
63
64#endif /* AUDIO_H */