Skip to content

Commit

Permalink
updated vapi and toxavtest
Browse files Browse the repository at this point in the history
  • Loading branch information
naxuroqa committed Jun 13, 2014
1 parent a8fafb3 commit 8cd7e04
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 34 deletions.
24 changes: 12 additions & 12 deletions src/testing/ToxAVTest.vala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class VideoSample : Window {
tox = new Tox.Tox(0);
tox.callback_friend_request(on_friend_request);
ToxAV.CodecSettings settings = ToxAV.DefaultCodecSettings;
tox_av = new ToxAV.ToxAV(tox, settings);
tox_av = new ToxAV.ToxAV(tox, 1);

ToxAV.register_callstate_callback(on_toxav_invite , ToxAV.CallbackID.INVITE);
ToxAV.register_callstate_callback(on_toxav_start , ToxAV.CallbackID.START);
Expand Down Expand Up @@ -170,37 +170,37 @@ public class VideoSample : Window {
}
}

private void on_toxav_invite() {
private void on_toxav_invite(int32 call_index) {
print("[LOG] on_toxav_invite\n");
}
private void on_toxav_start() {
private void on_toxav_start(int32 call_index) {
print("[LOG] on_toxav_start\n");
}
private void on_toxav_cancel() {
private void on_toxav_cancel(int32 call_index) {
print("[LOG] on_toxav_cancel\n");
}
private void on_toxav_reject() {
private void on_toxav_reject(int32 call_index) {
print("[LOG] on_toxav_reject\n");
}
private void on_toxav_end() {
private void on_toxav_end(int32 call_index) {
print("[LOG] on_toxav_end\n");
}
private void on_toxav_ringing() {
private void on_toxav_ringing(int32 call_index) {
print("[LOG] on_toxav_ringing\n");
}
private void on_toxav_starting() {
private void on_toxav_starting(int32 call_index) {
print("[LOG] on_toxav_starting\n");
}
private void on_toxav_ending() {
private void on_toxav_ending(int32 call_index) {
print("[LOG] on_toxav_ending\n");
}
private void on_toxav_error() {
private void on_toxav_error(int32 call_index) {
print("[LOG] on_toxav_error\n");
}
private void on_toxav_request_timeout() {
private void on_toxav_request_timeout(int32 call_index) {
print("[LOG] on_toxav_request_timeout\n");
}
private void on_toxav_peer_timeout() {
private void on_toxav_peer_timeout(int32 call_index) {
print("[LOG] on_toxav_peer_timeout\n");
}

Expand Down
91 changes: 69 additions & 22 deletions src/vapi/tox-1.0.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,9 @@ namespace ToxAV {
[CCode (cname = "ErrorTerminatingAudioRtp")]
TERMINATING_AUDIO_RTP,
[CCode (cname = "ErrorTerminatingVideoRtp")]
TERMINATING_VIDEO_RTP
TERMINATING_VIDEO_RTP,
[CCode (cname = "ErrorPacketTooLarge")]
PACKET_TOO_LARGE
}

/**
Expand All @@ -807,8 +809,6 @@ namespace ToxAV {
[Flags]
[CCode (cname = "ToxAvCapabilities", cprefix = "", has_type_id = false)]
public enum Capabilities {
[CCode (cname = "None")]
NONE,
[CCode (cname = "AudioEnconding")]
AUDIO_ENCODING,
[CCode (cname = "AudioDecoding")]
Expand Down Expand Up @@ -848,7 +848,7 @@ namespace ToxAV {
*/
//typedef void ( *ToxAVCallback ) ( void *arg );
[CCode (cname = "ToxAVCallback", has_type_id = false)]
public delegate void CallstateCallback ();
public delegate void CallstateCallback(int32 call_index);
//FIXME
[CCode (cname = "toxav_register_callstate_callback", has_type_id = false)]
public static void register_callstate_callback ([CCode( delegate_target_pos = 3 )] CallstateCallback callback, CallbackID id);
Expand All @@ -869,7 +869,7 @@ namespace ToxAV {
* @retval NULL On error.
*/
[CCode (cname = "toxav_new")]
public ToxAV(Tox.Tox messenger, CodecSettings codec_settings);
public ToxAV(Tox.Tox messenger, int32 max_calls);

/* #### only here for completeness #### */
///**
Expand All @@ -891,7 +891,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error call(int user, CallType call_type, int ringing_seconds);
public AV_Error call(ref int32 call_index, int user, CallType call_type, int ringing_seconds);

/**
* @brief Hangup active call.
Expand All @@ -901,7 +901,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error hangup();
public AV_Error hangup(int32 call_index);

/**
* @brief Answer incomming call.
Expand All @@ -912,7 +912,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error answer(CallType call_type );
public AV_Error answer(int32 call_index, CallType call_type );

/**
* @brief Reject incomming call.
Expand All @@ -923,7 +923,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error reject(string reason);
public AV_Error reject(int32 call_index, string reason);

/**
* @brief Cancel outgoing request.
Expand All @@ -935,7 +935,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error cancel(int peer_id, string reason);
public AV_Error cancel(int32 call_index, int peer_id, string reason);

/**
* @brief Terminate transmission. Note that transmission will be terminated without informing remote peer.
Expand All @@ -945,7 +945,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error stop_call();
public AV_Error stop_call(int32 call_index);

/**
* @brief Must be call before any RTP transmission occurs.
Expand All @@ -956,7 +956,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error prepare_transmission(int support_video);
public AV_Error prepare_transmission(int32 call_index, CodecSettings codec_settings, int support_video);

/**
* @brief Call this at the end of the transmission.
Expand All @@ -966,7 +966,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error kill_transmission();
public AV_Error kill_transmission(int32 call_index);

/**
* @brief Receive decoded video packet.
Expand All @@ -977,7 +977,7 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On Error.
*/
public AV_Error recv_video ( out Vpx.Image output);
public AV_Error recv_video (int32 call_index, ref Vpx.Image output);

/**
* @brief Receive decoded audio frame.
Expand All @@ -990,21 +990,21 @@ namespace ToxAV {
* @retval >=0 Size of received packet.
* @retval ToxAvError On error.
*/
public AV_Error recv_audio( int frame_size, [CCode(array_length=false)] int16[] dest );
public AV_Error recv_audio(int32 call_index, int frame_size, [CCode(array_length=false)] int16[] dest );

/**
* @brief Encode and send video packet.
* @brief Send video packet.
*
* @param av Handler.
* @param input The packet.
* @return int
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error send_video ( Vpx.Image input);
public AV_Error send_video (int32 call_index, uint8[] frame);

/**
* @brief Encode and send audio frame.
* @brief Send audio frame.
*
* @param av Handler.
* @param frame The frame.
Expand All @@ -1013,7 +1013,34 @@ namespace ToxAV {
* @retval 0 Success.
* @retval ToxAvError On error.
*/
public AV_Error send_audio ( [CCode(array_length_type="int")] int16[] frame);
public AV_Error send_audio (int32 call_index, uint8[] frame);

/**
* @brief Encode video frame
*
* @param av Handler
* @param dest Where to
* @param dest_max Max size
* @param input What to encode
* @return int
* @retval ToxAvError On error.
* @retval >0 On success
*/
public AV_Error prepare_video_frame(int32 call_index, uint8[] dest, Vpx.Image input);

/**
* @brief Encode audio frame
*
* @param av Handler
* @param dest dest
* @param dest_max Max dest size
* @param frame The frame
* @param frame_size The frame size
* @return int
* @retval ToxAvError On error.
* @retval >0 On success
*/
public AV_Error prepare_audio_frame(int32 call_index, uint8[] dest, int16[] frame);

/**
* @brief Get peer transmission type. It can either be audio or video.
Expand All @@ -1024,7 +1051,7 @@ namespace ToxAV {
* @retval ToxAvCallType On success.
* @retval ToxAvError On error.
*/
public AV_Error get_peer_transmission_type ( int peer );
public AV_Error get_peer_transmission_type (int32 call_index, int peer);

/**
* @brief Get id of peer participating in conversation
Expand All @@ -1034,7 +1061,7 @@ namespace ToxAV {
* @return int
* @retval ToxAvError No peer id
*/
public AV_Error get_peer_id ( int peer );
public AV_Error get_peer_id ( int32 call_index, int peer );

/**
* @brief Is certain capability supported
Expand All @@ -1044,7 +1071,27 @@ namespace ToxAV {
* @retval 1 Yes.
* @retval 0 No.
*/
public int capability_supported ( Capabilities capability );
public int capability_supported ( int32 call_index, Capabilities capability );

/**
* @brief Set queue limit
*
* @param av Handler
* @param call_index index
* @param limit the limit
* @return void
*/
public int set_audio_queue_limit ( int32 call_index, uint64 limit );

/**
* @brief Set queue limit
*
* @param av Handler
* @param call_index index
* @param limit the limit
* @return void
*/
public int set_video_queue_limit ( int32 call_index, uint64 limit );

/**
* @brief Get messenger handle
Expand Down

0 comments on commit 8cd7e04

Please sign in to comment.