Merge branch 'new_api' of github.com:mannol/toxcore into new_api

This commit is contained in:
mannol 2015-03-25 23:31:04 +01:00
commit 9bd20e8741
3 changed files with 24 additions and 24 deletions

View File

@ -191,8 +191,8 @@ void iterate(Tox* Bsn, ToxAV* AliceAV, ToxAV* BobAV)
tox_do(toxav_get_tox(AliceAV)); tox_do(toxav_get_tox(AliceAV));
tox_do(toxav_get_tox(BobAV)); tox_do(toxav_get_tox(BobAV));
toxav_iteration(AliceAV); toxav_iterate(AliceAV);
toxav_iteration(BobAV); toxav_iterate(BobAV);
int mina = MIN(tox_do_interval(toxav_get_tox(AliceAV)), toxav_iteration_interval(AliceAV)); int mina = MIN(tox_do_interval(toxav_get_tox(AliceAV)), toxav_iteration_interval(AliceAV));
int minb = MIN(tox_do_interval(toxav_get_tox(BobAV)), toxav_iteration_interval(BobAV)); int minb = MIN(tox_do_interval(toxav_get_tox(BobAV)), toxav_iteration_interval(BobAV));
@ -829,4 +829,4 @@ AGAIN:
alcCloseDevice(out_device); alcCloseDevice(out_device);
alcCaptureCloseDevice(in_device); alcCaptureCloseDevice(in_device);
return 0; return 0;
} }

View File

@ -78,8 +78,8 @@ struct toxAV {
PAIR(toxav_call_state_cb *, void *) scb; /* Call state callback */ PAIR(toxav_call_state_cb *, void *) scb; /* Call state callback */
PAIR(toxav_receive_audio_frame_cb *, void *) acb; /* Audio frame receive callback */ PAIR(toxav_receive_audio_frame_cb *, void *) acb; /* Audio frame receive callback */
PAIR(toxav_receive_video_frame_cb *, void *) vcb; /* Video frame receive callback */ PAIR(toxav_receive_video_frame_cb *, void *) vcb; /* Video frame receive callback */
PAIR(toxav_request_video_frame_cb *, void *) rvcb; /* Request video callback */ PAIR(toxav_video_frame_request_cb *, void *) rvcb; /* Video request callback */
PAIR(toxav_request_audio_frame_cb *, void *) racb; /* Request video callback */ PAIR(toxav_audio_frame_request_cb *, void *) racb; /* Audio request callback */
/** Decode time measures */ /** Decode time measures */
int32_t dmssc; /** Measure count */ int32_t dmssc; /** Measure count */
@ -202,7 +202,7 @@ uint32_t toxav_iteration_interval(const ToxAV* av)
return av->calls ? av->interval : 200; return av->calls ? av->interval : 200;
} }
void toxav_iteration(ToxAV* av) void toxav_iterate(ToxAV* av)
{ {
if (av->calls == NULL) if (av->calls == NULL)
return; return;
@ -487,7 +487,7 @@ bool toxav_set_video_bit_rate(ToxAV* av, uint32_t friend_number, uint32_t video_
/* TODO */ /* TODO */
} }
void toxav_callback_request_video_frame(ToxAV* av, toxav_request_video_frame_cb* function, void* user_data) void toxav_callback_video_frame_request(ToxAV* av, toxav_video_frame_request_cb* function, void* user_data)
{ {
pthread_mutex_lock(av->mutex); pthread_mutex_lock(av->mutex);
av->rvcb.first = function; av->rvcb.first = function;
@ -601,7 +601,7 @@ END:
return rc == TOXAV_ERR_SEND_FRAME_OK; return rc == TOXAV_ERR_SEND_FRAME_OK;
} }
void toxav_callback_request_audio_frame(ToxAV* av, toxav_request_audio_frame_cb* function, void* user_data) void toxav_callback_audio_frame_request(ToxAV* av, toxav_audio_frame_request_cb* function, void* user_data)
{ {
pthread_mutex_lock(av->mutex); pthread_mutex_lock(av->mutex);
av->racb.first = function; av->racb.first = function;
@ -1078,4 +1078,4 @@ CLEAR:
av->calls_head = av->calls_tail = 0; av->calls_head = av->calls_tail = 0;
free(av->calls); free(av->calls);
av->calls = NULL; av->calls = NULL;
} }

View File

@ -82,8 +82,8 @@ Tox *toxav_get_tox(ToxAV *av);
* *
******************************************************************************/ ******************************************************************************/
/** /**
* Returns the interval in milliseconds when the next toxav_iteration should be * Returns the interval in milliseconds when the next toxav_iterate call should
* called. If no call is active at the moment, this function returns 200. * be. If no call is active at the moment, this function returns 200.
*/ */
uint32_t toxav_iteration_interval(ToxAV const *av); uint32_t toxav_iteration_interval(ToxAV const *av);
/** /**
@ -91,7 +91,7 @@ uint32_t toxav_iteration_interval(ToxAV const *av);
* toxav_iteration_interval() milliseconds. It is best called in the same loop * toxav_iteration_interval() milliseconds. It is best called in the same loop
* as tox_iteration. * as tox_iteration.
*/ */
void toxav_iteration(ToxAV *av); void toxav_iterate(ToxAV *av);
/******************************************************************************* /*******************************************************************************
* *
* :: Call setup * :: Call setup
@ -372,7 +372,7 @@ typedef enum TOXAV_ERR_SEND_FRAME {
*/ */
TOXAV_ERR_SEND_FRAME_FRIEND_NOT_IN_CALL, TOXAV_ERR_SEND_FRAME_FRIEND_NOT_IN_CALL,
/** /**
* No video frame had been requested through the `request_video_frame` event, * No video frame had been requested through the `video_frame_request` event,
* but the client tried to send one, anyway. * but the client tried to send one, anyway.
*/ */
TOXAV_ERR_SEND_FRAME_NOT_REQUESTED, TOXAV_ERR_SEND_FRAME_NOT_REQUESTED,
@ -387,20 +387,20 @@ typedef enum TOXAV_ERR_SEND_FRAME {
TOXAV_ERR_SEND_FRAME_RTP_FAILED TOXAV_ERR_SEND_FRAME_RTP_FAILED
} TOXAV_ERR_SEND_FRAME; } TOXAV_ERR_SEND_FRAME;
/** /**
* The function type for the `request_video_frame` callback. * The function type for the `video_frame_request` callback.
* *
* @param friend_number The friend number of the friend for which the next video * @param friend_number The friend number of the friend for which the next video
* frame should be sent. * frame should be sent.
*/ */
typedef void toxav_request_video_frame_cb(ToxAV *av, uint32_t friend_number, void *user_data); typedef void toxav_video_frame_request_cb(ToxAV *av, uint32_t friend_number, void *user_data);
/** /**
* Set the callback for the `request_video_frame` event. Pass NULL to unset. * Set the callback for the `video_frame_request` event. Pass NULL to unset.
*/ */
void toxav_callback_request_video_frame(ToxAV *av, toxav_request_video_frame_cb *function, void *user_data); void toxav_callback_video_frame_request(ToxAV *av, toxav_video_frame_request_cb *function, void *user_data);
/** /**
* Send a video frame to a friend. * Send a video frame to a friend.
* *
* This is called in response to receiving the `request_video_frame` event. * This is called in response to receiving the `video_frame_request` event.
* *
* Y - plane should be of size: height * width * Y - plane should be of size: height * width
* U - plane should be of size: (height/2) * (width/2) * U - plane should be of size: (height/2) * (width/2)
@ -419,20 +419,20 @@ bool toxav_send_video_frame(ToxAV *av, uint32_t friend_number,
uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *y, uint8_t const *u, uint8_t const *v,
TOXAV_ERR_SEND_FRAME *error); TOXAV_ERR_SEND_FRAME *error);
/** /**
* The function type for the `request_audio_frame` callback. * The function type for the `audio_frame_request` callback.
* *
* @param friend_number The friend number of the friend for which the next audio * @param friend_number The friend number of the friend for which the next audio
* frame should be sent. * frame should be sent.
*/ */
typedef void toxav_request_audio_frame_cb(ToxAV *av, uint32_t friend_number, void *user_data); typedef void toxav_audio_frame_request_cb(ToxAV *av, uint32_t friend_number, void *user_data);
/** /**
* Set the callback for the `request_audio_frame` event. Pass NULL to unset. * Set the callback for the `audio_frame_request` event. Pass NULL to unset.
*/ */
void toxav_callback_request_audio_frame(ToxAV *av, toxav_request_audio_frame_cb *function, void *user_data); void toxav_callback_audio_frame_request(ToxAV *av, toxav_audio_frame_request_cb *function, void *user_data);
/** /**
* Send an audio frame to a friend. * Send an audio frame to a friend.
* *
* This is called in response to receiving the `request_audio_frame` event. * This is called in response to receiving the `audio_frame_request` event.
* *
* The expected format of the PCM data is: [s1c1][s1c2][...][s2c1][s2c2][...]... * The expected format of the PCM data is: [s1c1][s1c2][...][s2c1][s2c2][...]...
* Meaning: sample 1 for channel 1, sample 1 for channel 2, ... * Meaning: sample 1 for channel 1, sample 1 for channel 2, ...
@ -510,4 +510,4 @@ typedef void toxav_receive_audio_frame_cb(ToxAV *av, uint32_t friend_number,
*/ */
void toxav_callback_receive_audio_frame(ToxAV *av, toxav_receive_audio_frame_cb *function, void *user_data); void toxav_callback_receive_audio_frame(ToxAV *av, toxav_receive_audio_frame_cb *function, void *user_data);
#endif /* TOXAV_H */ #endif /* TOXAV_H */