diff options
Diffstat (limited to 'toxav/toxav.c')
-rwxr-xr-x | toxav/toxav.c | 67 |
1 files changed, 6 insertions, 61 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c index 698fac3b..3cae8dc4 100755 --- a/toxav/toxav.c +++ b/toxav/toxav.c | |||
@@ -67,7 +67,6 @@ typedef struct _ToxAv { | |||
67 | struct jitter_buffer *j_buf; | 67 | struct jitter_buffer *j_buf; |
68 | CodecState *cs; | 68 | CodecState *cs; |
69 | 69 | ||
70 | void *agent_handler; | ||
71 | } ToxAv; | 70 | } ToxAv; |
72 | 71 | ||
73 | /** | 72 | /** |
@@ -81,7 +80,7 @@ typedef struct _ToxAv { | |||
81 | * @return ToxAv* | 80 | * @return ToxAv* |
82 | * @retval NULL On error. | 81 | * @retval NULL On error. |
83 | */ | 82 | */ |
84 | ToxAv *toxav_new( Tox *messenger, void *userdata, uint16_t video_width, uint16_t video_height) | 83 | ToxAv *toxav_new( Tox* messenger, uint16_t video_width, uint16_t video_height) |
85 | { | 84 | { |
86 | ToxAv *av = calloc ( sizeof(ToxAv), 1); | 85 | ToxAv *av = calloc ( sizeof(ToxAv), 1); |
87 | 86 | ||
@@ -101,8 +100,6 @@ ToxAv *toxav_new( Tox *messenger, void *userdata, uint16_t video_width, uint16_t | |||
101 | av->cs = codec_init_session(AUDIO_BITRATE, AUDIO_FRAME_DURATION, AUDIO_SAMPLE_RATE, AUDIO_CHANNELS, video_width, | 100 | av->cs = codec_init_session(AUDIO_BITRATE, AUDIO_FRAME_DURATION, AUDIO_SAMPLE_RATE, AUDIO_CHANNELS, video_width, |
102 | video_height, VIDEO_BITRATE); | 101 | video_height, VIDEO_BITRATE); |
103 | 102 | ||
104 | av->agent_handler = userdata; | ||
105 | |||
106 | return av; | 103 | return av; |
107 | } | 104 | } |
108 | 105 | ||
@@ -136,9 +133,9 @@ void toxav_kill ( ToxAv *av ) | |||
136 | * @param id One of the ToxAvCallbackID values | 133 | * @param id One of the ToxAvCallbackID values |
137 | * @return void | 134 | * @return void |
138 | */ | 135 | */ |
139 | void toxav_register_callstate_callback ( ToxAVCallback callback, ToxAvCallbackID id ) | 136 | void toxav_register_callstate_callback ( ToxAVCallback callback, ToxAvCallbackID id, void* userdata ) |
140 | { | 137 | { |
141 | msi_register_callback((MSICallback)callback, (MSICallbackID) id); | 138 | msi_register_callback((MSICallback)callback, (MSICallbackID) id, userdata); |
142 | } | 139 | } |
143 | 140 | ||
144 | /** | 141 | /** |
@@ -569,68 +566,16 @@ int toxav_get_peer_id ( ToxAv* av, int peer ) | |||
569 | } | 566 | } |
570 | 567 | ||
571 | /** | 568 | /** |
572 | * @brief Get reference to an object that is handling av session. | 569 | * @brief Is certain capability supported |
573 | * | ||
574 | * @param av Handler. | ||
575 | * @return void* | ||
576 | */ | ||
577 | void *toxav_get_agent_handler ( ToxAv *av ) | ||
578 | { | ||
579 | return av->agent_handler; | ||
580 | } | ||
581 | |||
582 | /** | ||
583 | * @brief Is video encoding supported | ||
584 | * | ||
585 | * @param av Handler | ||
586 | * @return int | ||
587 | * @retval 1 Yes. | ||
588 | * @retval 0 No. | ||
589 | */ | ||
590 | inline__ int toxav_video_encoding ( ToxAv* av ) | ||
591 | { | ||
592 | return av->cs->supported_actions & v_encoding; | ||
593 | } | ||
594 | |||
595 | |||
596 | /** | ||
597 | * @brief Is video decoding supported | ||
598 | * | ||
599 | * @param av Handler | ||
600 | * @return int | ||
601 | * @retval 1 Yes. | ||
602 | * @retval 0 No. | ||
603 | */ | ||
604 | inline__ int toxav_video_decoding ( ToxAv* av ) | ||
605 | { | ||
606 | return av->cs->supported_actions & v_decoding; | ||
607 | } | ||
608 | |||
609 | /** | ||
610 | * @brief Is audio encoding supported | ||
611 | * | ||
612 | * @param av Handler | ||
613 | * @return int | ||
614 | * @retval 1 Yes. | ||
615 | * @retval 0 No. | ||
616 | */ | ||
617 | inline__ int toxav_audio_encoding ( ToxAv* av ) | ||
618 | { | ||
619 | return av->cs->supported_actions & a_encoding; | ||
620 | } | ||
621 | |||
622 | |||
623 | /** | ||
624 | * @brief Is audio decoding supported | ||
625 | * | 570 | * |
626 | * @param av Handler | 571 | * @param av Handler |
627 | * @return int | 572 | * @return int |
628 | * @retval 1 Yes. | 573 | * @retval 1 Yes. |
629 | * @retval 0 No. | 574 | * @retval 0 No. |
630 | */ | 575 | */ |
631 | inline__ int toxav_audio_decoding ( ToxAv* av ) | 576 | inline__ int toxav_capability_supported ( ToxAv* av, ToxAvCapabilities capability ) |
632 | { | 577 | { |
633 | return av->cs->supported_actions & a_decoding; | 578 | return av->cs->capabilities & (Capabilities) capability; |
634 | } | 579 | } |
635 | 580 | ||
636 | /** | 581 | /** |