Updated to match current toxav.h

This commit is contained in:
nobody 2016-03-09 01:22:15 +13:00 committed by irungentoo
parent 496af600ca
commit a4630e91ee

View File

@ -43,7 +43,7 @@ extern "C" {
* *
* As in Core API, events are handled by callbacks. One callback can be * As in Core API, events are handled by callbacks. One callback can be
* registered per event. All events have a callback function type named * registered per event. All events have a callback function type named
* `toxav_{event}_cb` and a function to register it named `tox_callback_{event}`. * `toxav_{event}_cb` and a function to register it named `toxav_callback_{event}`.
* Passing a NULL callback will result in no callback being registered for that * Passing a NULL callback will result in no callback being registered for that
* event. Only one callback per event can be registered, so if a client needs * event. Only one callback per event can be registered, so if a client needs
* multiple event listeners, it needs to implement the dispatch functionality * multiple event listeners, it needs to implement the dispatch functionality
@ -63,7 +63,7 @@ extern "C" {
* sleeping for ${toxAV.iteration_interval} * milliseconds on each iteration. * sleeping for ${toxAV.iteration_interval} * milliseconds on each iteration.
* *
* An important thing to note is that events are triggered from both tox and * An important thing to note is that events are triggered from both tox and
* toxav thread (see above). audio and video receive frame events are triggered * toxav thread (see above). Audio and video receive frame events are triggered
* from toxav thread while all the other events are triggered from tox thread. * from toxav thread while all the other events are triggered from tox thread.
* *
* Tox thread has priority with mutex mechanisms. Any api function can * Tox thread has priority with mutex mechanisms. Any api function can
@ -433,9 +433,10 @@ bool call_control (uint32_t friend_number, CALL_CONTROL control) {
******************************************************************************/ ******************************************************************************/
namespace bit_rate { namespace bit_rate {
/** /**
* Set the audio bit rate to be used in subsequent audio/video frames. * Set the bit rate to be used in subsequent audio/video frames.
* *
* @param friend_number The friend number. * @param friend_number The friend number of the friend for which to set the
* bit rate.
* @param audio_bit_rate The new audio bit rate in Kb/sec. Set to 0 to disable * @param audio_bit_rate The new audio bit rate in Kb/sec. Set to 0 to disable
* audio sending. Set to -1 to leave unchanged. * audio sending. Set to -1 to leave unchanged.
* @param video_bit_rate The new video bit rate in Kb/sec. Set to 0 to disable * @param video_bit_rate The new video bit rate in Kb/sec. Set to 0 to disable
@ -448,9 +449,13 @@ namespace bit_rate {
*/ */
SYNC, SYNC,
/** /**
* The bit rate passed was not one of the supported values. * The audio bit rate passed was not one of the supported values.
*/ */
INVALID, INVALID_AUDIO_BIT_RATE,
/**
* The video bit rate passed was not one of the supported values.
*/
INVALID_VIDEO_BIT_RATE,
/** /**
* The friend_number passed did not designate a valid friend. * The friend_number passed did not designate a valid friend.
*/ */
@ -466,7 +471,8 @@ namespace bit_rate {
* when the network becomes too saturated for current bit rates at which * when the network becomes too saturated for current bit rates at which
* point core suggests new bit rates. * point core suggests new bit rates.
* *
* @param friend_number The friend number. * @param friend_number The friend number of the friend for which to set the
* bit rate.
* @param audio_bit_rate Suggested maximum audio bit rate in Kb/sec. * @param audio_bit_rate Suggested maximum audio bit rate in Kb/sec.
* @param video_bit_rate Suggested maximum video bit rate in Kb/sec. * @param video_bit_rate Suggested maximum video bit rate in Kb/sec.
*/ */
@ -607,7 +613,53 @@ namespace video {
} }
} }
%{ %{
/**
* NOTE Compatibility with old toxav group calls TODO remove
*/
/* Create a new toxav group.
*
* return group number on success.
* return -1 on failure.
*
* Audio data callback format:
* audio_callback(Tox *tox, int groupnumber, int peernumber, const int16_t *pcm, unsigned int samples, uint8_t channels, unsigned int sample_rate, void *userdata)
*
* Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)).
*/
int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(void *, int, int, const int16_t *, unsigned int, uint8_t,
unsigned int, void *), void *userdata);
/* Join a AV group (you need to have been invited first.)
*
* returns group number on success
* returns -1 on failure.
*
* Audio data callback format (same as the one for toxav_add_av_groupchat()):
* audio_callback(Tox *tox, int groupnumber, int peernumber, const int16_t *pcm, unsigned int samples, uint8_t channels, unsigned int sample_rate, void *userdata)
*
* Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)).
*/
int toxav_join_av_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length,
void (*audio_callback)(void *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *), void *userdata);
/* Send audio to the group chat.
*
* return 0 on success.
* return -1 on failure.
*
* Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)).
*
* Valid number of samples are ((sample rate) * (audio length (Valid ones are: 2.5, 5, 10, 20, 40 or 60 ms)) / 1000)
* Valid number of channels are 1 or 2.
* Valid sample rates are 8000, 12000, 16000, 24000, or 48000.
*
* Recommended values are: samples = 960, channels = 1, sample_rate = 48000
*/
int toxav_group_send_audio(Tox *tox, int groupnumber, const int16_t *pcm, unsigned int samples, uint8_t channels,
unsigned int sample_rate);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif