summaryrefslogtreecommitdiff
path: root/toxav/toxav.api.h
diff options
context:
space:
mode:
authorxhe <xw897002528@gmail.com>2018-01-14 21:46:06 +0800
committeriphydf <iphydf@users.noreply.github.com>2018-01-25 14:29:01 +0000
commit0becafd272997ab1fcbe93ce3d56b27aae6cd80a (patch)
treee09f947a654b05e173229f6dd9c8be8124464536 /toxav/toxav.api.h
parentcd8080f6d180677d03edff4878305c655c29bd69 (diff)
Split bit_rate_set(), one for audio, one for video.
Fixes #572. As discussed in the issue, there's a risk that toxcore may not hold the maximum bitrates libvpx supports, if toxcore insists on using integer type. I initially proposed to have another flag in set(), so that we can use unsigned type instead. iphydf came up with a better solution, that is splitting the original functions, one for audio, one for video. Now, we could safely replace int32_t with uint32_t. Also: clean video_bit_rate_invalid() Though this is not a part of issue #572, as it's used in the toxav_bit_rate_set(), i cleaned the code. As mannol said, there should be a check. Uint32_t is large enough to hold the maximum bitrates libvpx supports, but user may pass a value larger than uint while smaller than uint32_t. Thanks to the reminding from nurupo, it's no longer a stub function. Bitrate error enums are shared for both audio and video https://github.com/TokTok/c-toxcore/pull/578#issuecomment-360095609, just as iphydf said.
Diffstat (limited to 'toxav/toxav.api.h')
-rw-r--r--toxav/toxav.api.h59
1 files changed, 32 insertions, 27 deletions
diff --git a/toxav/toxav.api.h b/toxav/toxav.api.h
index d6f30c67..511b9e2d 100644
--- a/toxav/toxav.api.h
+++ b/toxav/toxav.api.h
@@ -386,40 +386,45 @@ bool call_control(uint32_t friend_number, CALL_CONTROL control) {
386 ******************************************************************************/ 386 ******************************************************************************/
387 387
388 388
389error for bit_rate_set {
390 /**
391 * Synchronization error occurred.
392 */
393 SYNC,
394 /**
395 * The bit rate passed was not one of the supported values.
396 */
397 INVALID_BIT_RATE,
398 /**
399 * The friend_number passed did not designate a valid friend.
400 */
401 FRIEND_NOT_FOUND,
402 /**
403 * This client is currently not in a call with the friend.
404 */
405 FRIEND_NOT_IN_CALL,
406}
407
389namespace bit_rate { 408namespace bit_rate {
390 /** 409 /**
391 * Set the bit rate to be used in subsequent audio/video frames. 410 * Set the bit rate to be used in subsequent audio frames.
392 * 411 *
393 * @param friend_number The friend number of the friend for which to set the 412 * @param friend_number The friend number of the friend for which to set the
394 * bit rate. 413 * bit rate.
395 * @param audio_bit_rate The new audio bit rate in Kb/sec. Set to 0 to disable 414 * @param audio_bit_rate The new audio bit rate in Kb/sec. Set to 0 to disable.
396 * audio sending. Set to -1 to leave unchanged.
397 * @param video_bit_rate The new video bit rate in Kb/sec. Set to 0 to disable
398 * video sending. Set to -1 to leave unchanged.
399 * 415 *
400 */ 416 */
401 bool set(uint32_t friend_number, int32_t audio_bit_rate, int32_t video_bit_rate) { 417
402 /** 418 bool set_audio(uint32_t friend_number, uint32_t audio_bit_rate) with error for bit_rate_set;
403 * Synchronization error occurred. 419 /**
404 */ 420 * Set the bit rate to be used in subsequent video frames.
405 SYNC, 421 *
406 /** 422 * @param friend_number The friend number of the friend for which to set the
407 * The audio bit rate passed was not one of the supported values. 423 * bit rate.
408 */ 424 * @param video_bit_rate The new video bit rate in Kb/sec. Set to 0 to disable.
409 INVALID_AUDIO_BIT_RATE, 425 *
410 /** 426 */
411 * The video bit rate passed was not one of the supported values. 427 bool set_video(uint32_t friend_number, uint32_t video_bit_rate) with error for bit_rate_set;
412 */
413 INVALID_VIDEO_BIT_RATE,
414 /**
415 * The friend_number passed did not designate a valid friend.
416 */
417 FRIEND_NOT_FOUND,
418 /**
419 * This client is currently not in a call with the friend.
420 */
421 FRIEND_NOT_IN_CALL,
422 }
423 428
424 event status { 429 event status {
425 /** 430 /**