summaryrefslogtreecommitdiff
path: root/toxav/toxav.h
diff options
context:
space:
mode:
authorxhe <xw897002528@gmail.com>2018-01-28 19:14:04 +0800
committeriphydf <iphydf@users.noreply.github.com>2018-01-28 13:21:57 +0000
commit651ef3adb6299e66745cc1d1b57feb29fd17090a (patch)
treec211507a788558db661859a0cc9fdbc81c4c656a /toxav/toxav.h
parentb9350bc459fee755c2e3bd566173860115bef640 (diff)
Make audio/video bit rates "properties"
follow TokTok#731. This commit completely removed all things in namespace bit_rate, and deprecated functions are to be added back in another commit. set_xxx() is treadted as a property of namespace audio&video, same as bit_rate change event. toxav_basic_test is fixed, either.
Diffstat (limited to 'toxav/toxav.h')
-rw-r--r--toxav/toxav.h100
1 files changed, 58 insertions, 42 deletions
diff --git a/toxav/toxav.h b/toxav/toxav.h
index f8a683a6..1f2d6860 100644
--- a/toxav/toxav.h
+++ b/toxav/toxav.h
@@ -511,48 +511,6 @@ typedef enum TOXAV_ERR_BIT_RATE_SET {
511} TOXAV_ERR_BIT_RATE_SET; 511} TOXAV_ERR_BIT_RATE_SET;
512 512
513 513
514/**
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.
527 *
528 * @param friend_number The friend number of the friend for which to set the
529 * bit rate.
530 * @param video_bit_rate The new video bit rate in Kb/sec. Set to 0 to disable.
531 *
532 */
533bool toxav_bit_rate_set_video(ToxAV *av, uint32_t friend_number, uint32_t video_bit_rate,
534 TOXAV_ERR_BIT_RATE_SET *error);
535
536/**
537 * The function type for the bit_rate_status callback. The event is triggered
538 * when the network becomes too saturated for current bit rates at which
539 * point core suggests new bit rates.
540 *
541 * @param friend_number The friend number of the friend for which to set the
542 * bit rate.
543 * @param audio_bit_rate Suggested maximum audio bit rate in Kb/sec.
544 * @param video_bit_rate Suggested maximum video bit rate in Kb/sec.
545 */
546typedef void toxav_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate,
547 uint32_t video_bit_rate, void *user_data);
548
549
550/**
551 * Set the callback for the `bit_rate_status` event. Pass NULL to unset.
552 *
553 */
554void toxav_callback_bit_rate_status(ToxAV *av, toxav_bit_rate_status_cb *callback, void *user_data);
555
556 514
557/******************************************************************************* 515/*******************************************************************************
558 * 516 *
@@ -634,6 +592,35 @@ bool toxav_audio_send_frame(ToxAV *av, uint32_t friend_number, const int16_t *pc
634 uint8_t channels, uint32_t sampling_rate, TOXAV_ERR_SEND_FRAME *error); 592 uint8_t channels, uint32_t sampling_rate, TOXAV_ERR_SEND_FRAME *error);
635 593
636/** 594/**
595 * Set the bit rate to be used in subsequent video frames.
596 *
597 * @param friend_number The friend number of the friend for which to set the
598 * bit rate.
599 * @param bit_rate The new audio bit rate in Kb/sec. Set to 0 to disable.
600 *
601 * @return true on success.
602 */
603bool toxav_audio_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t bit_rate, TOXAV_ERR_BIT_RATE_SET *error);
604
605/**
606 * The function type for the audio_bit_rate callback. The event is triggered
607 * when the network becomes too saturated for current bit rates at which
608 * point core suggests new bit rates.
609 *
610 * @param friend_number The friend number of the friend for which to set the
611 * bit rate.
612 * @param audio_bit_rate Suggested maximum audio bit rate in Kb/sec.
613 */
614typedef void toxav_audio_bit_rate_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, void *user_data);
615
616
617/**
618 * Set the callback for the `audio_bit_rate` event. Pass NULL to unset.
619 *
620 */
621void toxav_callback_audio_bit_rate(ToxAV *av, toxav_audio_bit_rate_cb *callback, void *user_data);
622
623/**
637 * Send a video frame to a friend. 624 * Send a video frame to a friend.
638 * 625 *
639 * Y - plane should be of size: height * width 626 * Y - plane should be of size: height * width
@@ -651,6 +638,35 @@ bool toxav_audio_send_frame(ToxAV *av, uint32_t friend_number, const int16_t *pc
651bool toxav_video_send_frame(ToxAV *av, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t *y, 638bool toxav_video_send_frame(ToxAV *av, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t *y,
652 const uint8_t *u, const uint8_t *v, TOXAV_ERR_SEND_FRAME *error); 639 const uint8_t *u, const uint8_t *v, TOXAV_ERR_SEND_FRAME *error);
653 640
641/**
642 * Set the bit rate to be used in subsequent video frames.
643 *
644 * @param friend_number The friend number of the friend for which to set the
645 * bit rate.
646 * @param bit_rate The new video bit rate in Kb/sec. Set to 0 to disable.
647 *
648 * @return true on success.
649 */
650bool toxav_video_set_bit_rate(ToxAV *av, uint32_t friend_number, uint32_t bit_rate, TOXAV_ERR_BIT_RATE_SET *error);
651
652/**
653 * The function type for the video_bit_rate callback. The event is triggered
654 * when the network becomes too saturated for current bit rates at which
655 * point core suggests new bit rates.
656 *
657 * @param friend_number The friend number of the friend for which to set the
658 * bit rate.
659 * @param video_bit_rate Suggested maximum video bit rate in Kb/sec.
660 */
661typedef void toxav_video_bit_rate_cb(ToxAV *av, uint32_t friend_number, uint32_t video_bit_rate, void *user_data);
662
663
664/**
665 * Set the callback for the `video_bit_rate` event. Pass NULL to unset.
666 *
667 */
668void toxav_callback_video_bit_rate(ToxAV *av, toxav_video_bit_rate_cb *callback, void *user_data);
669
654 670
655/******************************************************************************* 671/*******************************************************************************
656 * 672 *