summaryrefslogtreecommitdiff
path: root/toxav/toxav.api.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-12 22:01:42 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-14 21:59:27 +0000
commit475f01bc1aaffc2a6b0a04909dc1b81d38573d04 (patch)
treef40ba06680f04233920db7d3b2a2daa80c50e414 /toxav/toxav.api.h
parentfc34fee59abbd79bd530b57fcbc030bde45df00a (diff)
Fix style in toxav.c.
* Use Camel_Snake_Case for type names. * Use at least 4 characters for constant names. I.e. `END` is a type name, but `RETURN` is a constant name. This is because `DHT` is a type name (yay consistency). * Using `min_*` functions instead of MIN, we can avoid a cast. * Use `for`-loops for for-each-frame semantics instead of `while`. * Don't use assignments as expressions. * `++i` instead of `i++`. * Function pointers are dereferenced automatically, so no need to manually do so. * Avoid void pointers that lie about not being spaghetti code. Toxcore and toxav are both spaghetti and shouldn't pretend anything else. * Don't use empty statements (e.g. no `;;` anywhere in the code).
Diffstat (limited to 'toxav/toxav.api.h')
-rw-r--r--toxav/toxav.api.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/toxav/toxav.api.h b/toxav/toxav.api.h
index 9e6cea68..29a61f16 100644
--- a/toxav/toxav.api.h
+++ b/toxav/toxav.api.h
@@ -605,6 +605,10 @@ namespace video {
605%{ 605%{
606/** 606/**
607 * NOTE Compatibility with old toxav group calls. TODO(iphydf): remove 607 * NOTE Compatibility with old toxav group calls. TODO(iphydf): remove
608 *
609 * TODO(iphydf): Use proper new API guidelines for these. E.g. don't use inline
610 * function types, don't have per-callback userdata, especially don't have one
611 * userdata per group.
608 */ 612 */
609/* Create a new toxav group. 613/* Create a new toxav group.
610 * 614 *
@@ -616,8 +620,9 @@ namespace video {
616 * 620 *
617 * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). 621 * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)).
618 */ 622 */
619int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, 623int toxav_add_av_groupchat(Tox *tox,
620 uint32_t, void *), void *userdata); 624 void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *),
625 void *userdata);
621 626
622/* Join a AV group (you need to have been invited first.) 627/* Join a AV group (you need to have been invited first.)
623 * 628 *
@@ -630,7 +635,8 @@ int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(void *, uint32_t, ui
630 * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). 635 * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)).
631 */ 636 */
632int toxav_join_av_groupchat(Tox *tox, uint32_t friendnumber, const uint8_t *data, uint16_t length, 637int toxav_join_av_groupchat(Tox *tox, uint32_t friendnumber, const uint8_t *data, uint16_t length,
633 void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *), void *userdata); 638 void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *),
639 void *userdata);
634 640
635/* Send audio to the group chat. 641/* Send audio to the group chat.
636 * 642 *
@@ -651,5 +657,16 @@ int toxav_group_send_audio(Tox *tox, uint32_t groupnumber, const int16_t *pcm, u
651#ifdef __cplusplus 657#ifdef __cplusplus
652} 658}
653#endif 659#endif
660
661typedef void toxav_group_audio_cb(Tox *tox, uint32_t groupnumber, uint32_t peernumber, const int16_t *pcm, uint32_t samples, uint8_t channels, uint32_t sample_rate, void *user_data);
662
663typedef TOXAV_ERR_CALL Toxav_Err_Call;
664typedef TOXAV_ERR_NEW Toxav_Err_New;
665typedef TOXAV_ERR_ANSWER Toxav_Err_Answer;
666typedef TOXAV_ERR_CALL_CONTROL Toxav_Err_Call_Control;
667typedef TOXAV_ERR_BIT_RATE_SET Toxav_Err_Bit_Rate_Set;
668typedef TOXAV_ERR_SEND_FRAME Toxav_Err_Send_Frame;
669typedef TOXAV_CALL_CONTROL Toxav_Call_Control;
670
654#endif /* TOXAV_H */ 671#endif /* TOXAV_H */
655%} 672%}