summaryrefslogtreecommitdiff
path: root/toxav/toxav.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.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.h')
-rw-r--r--toxav/toxav.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/toxav/toxav.h b/toxav/toxav.h
index 2e48d599..f8a683a6 100644
--- a/toxav/toxav.h
+++ b/toxav/toxav.h
@@ -494,14 +494,9 @@ typedef enum TOXAV_ERR_BIT_RATE_SET {
494 TOXAV_ERR_BIT_RATE_SET_SYNC, 494 TOXAV_ERR_BIT_RATE_SET_SYNC,
495 495
496 /** 496 /**
497 * The audio bit rate passed was not one of the supported values. 497 * The bit rate passed was not one of the supported values.
498 */ 498 */
499 TOXAV_ERR_BIT_RATE_SET_INVALID_AUDIO_BIT_RATE, 499 TOXAV_ERR_BIT_RATE_SET_INVALID_BIT_RATE,
500
501 /**
502 * The video bit rate passed was not one of the supported values.
503 */
504 TOXAV_ERR_BIT_RATE_SET_INVALID_VIDEO_BIT_RATE,
505 500
506 /** 501 /**
507 * The friend_number passed did not designate a valid friend. 502 * The friend_number passed did not designate a valid friend.
@@ -517,18 +512,26 @@ typedef enum TOXAV_ERR_BIT_RATE_SET {
517 512
518 513
519/** 514/**
520 * Set the bit rate to be used in subsequent audio/video frames. 515 * Set the bit rate to be used in subsequent audio frames.
516 *
517 * @param friend_number The friend number of the friend for which to set the
518 * bit rate.
519 * @param audio_bit_rate The new audio bit rate in Kb/sec. Set to 0 to disable.
520 *
521 */
522bool toxav_bit_rate_set_audio(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate,
523 TOXAV_ERR_BIT_RATE_SET *error);
524
525/**
526 * Set the bit rate to be used in subsequent video frames.
521 * 527 *
522 * @param friend_number The friend number of the friend for which to set the 528 * @param friend_number The friend number of the friend for which to set the
523 * bit rate. 529 * bit rate.
524 * @param audio_bit_rate The new audio bit rate in Kb/sec. Set to 0 to disable 530 * @param video_bit_rate The new video bit rate in Kb/sec. Set to 0 to disable.
525 * audio sending. Set to -1 to leave unchanged.
526 * @param video_bit_rate The new video bit rate in Kb/sec. Set to 0 to disable
527 * video sending. Set to -1 to leave unchanged.
528 * 531 *
529 */ 532 */
530bool toxav_bit_rate_set(ToxAV *av, uint32_t friend_number, int32_t audio_bit_rate, int32_t video_bit_rate, 533bool toxav_bit_rate_set_video(ToxAV *av, uint32_t friend_number, uint32_t video_bit_rate,
531 TOXAV_ERR_BIT_RATE_SET *error); 534 TOXAV_ERR_BIT_RATE_SET *error);
532 535
533/** 536/**
534 * The function type for the bit_rate_status callback. The event is triggered 537 * The function type for the bit_rate_status callback. The event is triggered