diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-08-12 22:01:42 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-08-14 21:59:27 +0000 |
commit | 475f01bc1aaffc2a6b0a04909dc1b81d38573d04 (patch) | |
tree | f40ba06680f04233920db7d3b2a2daa80c50e414 /toxav/toxav.h | |
parent | fc34fee59abbd79bd530b57fcbc030bde45df00a (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.h')
-rw-r--r-- | toxav/toxav.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/toxav/toxav.h b/toxav/toxav.h index 911d6b49..5b25fdeb 100644 --- a/toxav/toxav.h +++ b/toxav/toxav.h | |||
@@ -733,6 +733,10 @@ void toxav_callback_video_receive_frame(ToxAV *av, toxav_video_receive_frame_cb | |||
733 | 733 | ||
734 | /** | 734 | /** |
735 | * NOTE Compatibility with old toxav group calls. TODO(iphydf): remove | 735 | * NOTE Compatibility with old toxav group calls. TODO(iphydf): remove |
736 | * | ||
737 | * TODO(iphydf): Use proper new API guidelines for these. E.g. don't use inline | ||
738 | * function types, don't have per-callback userdata, especially don't have one | ||
739 | * userdata per group. | ||
736 | */ | 740 | */ |
737 | /* Create a new toxav group. | 741 | /* Create a new toxav group. |
738 | * | 742 | * |
@@ -744,9 +748,9 @@ void toxav_callback_video_receive_frame(ToxAV *av, toxav_video_receive_frame_cb | |||
744 | * | 748 | * |
745 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). | 749 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). |
746 | */ | 750 | */ |
747 | int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, | 751 | int toxav_add_av_groupchat(Tox *tox, |
748 | uint8_t, | 752 | void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *), |
749 | uint32_t, void *), void *userdata); | 753 | void *userdata); |
750 | 754 | ||
751 | /* Join a AV group (you need to have been invited first.) | 755 | /* Join a AV group (you need to have been invited first.) |
752 | * | 756 | * |
@@ -781,4 +785,16 @@ int toxav_group_send_audio(Tox *tox, uint32_t groupnumber, const int16_t *pcm, u | |||
781 | #ifdef __cplusplus | 785 | #ifdef __cplusplus |
782 | } | 786 | } |
783 | #endif | 787 | #endif |
788 | |||
789 | typedef void toxav_group_audio_cb(Tox *tox, uint32_t groupnumber, uint32_t peernumber, const int16_t *pcm, | ||
790 | uint32_t samples, uint8_t channels, uint32_t sample_rate, void *user_data); | ||
791 | |||
792 | typedef TOXAV_ERR_CALL Toxav_Err_Call; | ||
793 | typedef TOXAV_ERR_NEW Toxav_Err_New; | ||
794 | typedef TOXAV_ERR_ANSWER Toxav_Err_Answer; | ||
795 | typedef TOXAV_ERR_CALL_CONTROL Toxav_Err_Call_Control; | ||
796 | typedef TOXAV_ERR_BIT_RATE_SET Toxav_Err_Bit_Rate_Set; | ||
797 | typedef TOXAV_ERR_SEND_FRAME Toxav_Err_Send_Frame; | ||
798 | typedef TOXAV_CALL_CONTROL Toxav_Call_Control; | ||
799 | |||
784 | #endif /* TOXAV_H */ | 800 | #endif /* TOXAV_H */ |