diff options
Diffstat (limited to 'toxav/audio.h')
-rw-r--r-- | toxav/audio.h | 64 |
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 | |||
32 | struct RTPMessage; | ||
33 | |||
34 | typedef 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 | |||
58 | ACSession *ac_new(ToxAV *av, uint32_t friend_number, toxav_audio_receive_frame_cb *cb, void *cb_data); | ||
59 | void ac_kill(ACSession *ac); | ||
60 | void ac_iterate(ACSession *ac); | ||
61 | int ac_queue_message(void *acp, struct RTPMessage *msg); | ||
62 | int ac_reconfigure_encoder(ACSession *ac, int32_t bit_rate, int32_t sampling_rate, uint8_t channels); | ||
63 | |||
64 | #endif /* AUDIO_H */ | ||