1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 20:43:02 +01:00

Update toxav API calls

This commit is contained in:
jfreegman 2018-02-24 15:38:07 -05:00
parent 5cd196a769
commit a290f0f7f8
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 11 additions and 14 deletions

View File

@ -337,11 +337,10 @@ void receive_audio_frame_cb(ToxAV *av, uint32_t friend_number,
write_device_callback(friend_number, pcm, sample_count, channels, sampling_rate); write_device_callback(friend_number, pcm, sample_count, channels, sampling_rate);
} }
void audio_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, void audio_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, void *user_data)
uint32_t video_bit_rate, void *user_data)
{ {
CallControl.audio_bit_rate = audio_bit_rate; CallControl.audio_bit_rate = audio_bit_rate;
toxav_bit_rate_set(av, friend_number, audio_bit_rate, video_bit_rate, user_data); toxav_audio_set_bit_rate(av, friend_number, audio_bit_rate, user_data);
} }
void callback_recv_invite(Tox *m, uint32_t friend_number) void callback_recv_invite(Tox *m, uint32_t friend_number)
@ -854,7 +853,7 @@ void cmd_bitrate(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
const uint32_t bitrate = strtol(argv[1], NULL, 10); const uint32_t bitrate = strtol(argv[1], NULL, 10);
TOXAV_ERR_BIT_RATE_SET error; TOXAV_ERR_BIT_RATE_SET error;
audio_bit_rate_status_cb(CallControl.av, self->num, bitrate, -1, &error); audio_bit_rate_status_cb(CallControl.av, self->num, bitrate, &error);
if (error != TOXAV_ERR_BIT_RATE_SET_OK) { if (error != TOXAV_ERR_BIT_RATE_SET_OK) {
switch (error) { switch (error) {
@ -862,8 +861,8 @@ void cmd_bitrate(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
error_str = "Syncronization error occured"; error_str = "Syncronization error occured";
break; break;
case TOXAV_ERR_BIT_RATE_SET_INVALID_AUDIO_BIT_RATE: case TOXAV_ERR_BIT_RATE_SET_INVALID_BIT_RATE:
error_str = "Invalid audio bit rate value (valid is 6-510)"; error_str = "Invalid AV bit rate value (valid is 6-510)";
break; break;
case TOXAV_ERR_BIT_RATE_SET_FRIEND_NOT_FOUND: case TOXAV_ERR_BIT_RATE_SET_FRIEND_NOT_FOUND:

View File

@ -45,8 +45,7 @@ void receive_video_frame_cb( ToxAV *av, uint32_t friend_number,
int32_t ystride, int32_t ustride, int32_t vstride, int32_t ystride, int32_t ustride, int32_t vstride,
void *user_data ); void *user_data );
void video_bit_rate_status_cb( ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, void video_bit_rate_status_cb( ToxAV *av, uint32_t friend_number, uint32_t video_bit_rate, void *user_data);
uint32_t video_bit_rate, void *user_data);
static void print_err (ToxWindow *self, const char *error_str) static void print_err (ToxWindow *self, const char *error_str)
{ {
@ -74,7 +73,7 @@ ToxAV *init_video(ToxWindow *self, Tox *tox)
} }
toxav_callback_video_receive_frame(CallControl.av, receive_video_frame_cb, &CallControl); toxav_callback_video_receive_frame(CallControl.av, receive_video_frame_cb, &CallControl);
toxav_callback_bit_rate_status(CallControl.av, video_bit_rate_status_cb, &CallControl); toxav_callback_video_bit_rate(CallControl.av, video_bit_rate_status_cb, &CallControl);
return CallControl.av; return CallControl.av;
} }
@ -135,7 +134,7 @@ int start_video_transmission(ToxWindow *self, ToxAV *av, Call *call)
CallControl.video_bit_rate = default_video_bit_rate; CallControl.video_bit_rate = default_video_bit_rate;
if ( toxav_bit_rate_set(CallControl.av, self->num, -1, CallControl.video_bit_rate, NULL) == false ) { if ( toxav_video_set_bit_rate(CallControl.av, self->num, CallControl.video_bit_rate, NULL) == false ) {
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to set video bit rate"); line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to set video bit rate");
return -1; return -1;
} }
@ -156,7 +155,7 @@ int start_video_transmission(ToxWindow *self, ToxAV *av, Call *call)
int stop_video_transmission(Call *call, int friend_number) int stop_video_transmission(Call *call, int friend_number)
{ {
CallControl.video_bit_rate = 0; CallControl.video_bit_rate = 0;
toxav_bit_rate_set(CallControl.av, friend_number, -1, CallControl.video_bit_rate, NULL); toxav_video_set_bit_rate(CallControl.av, friend_number, CallControl.video_bit_rate, NULL);
if ( call->vin_idx != -1 ) { if ( call->vin_idx != -1 ) {
close_video_device(vdt_input, call->vin_idx); close_video_device(vdt_input, call->vin_idx);
@ -185,11 +184,10 @@ void receive_video_frame_cb(ToxAV *av, uint32_t friend_number,
write_video_device_callback(friend_number, width, height, y, u, v, ystride, ustride, vstride, user_data); write_video_device_callback(friend_number, width, height, y, u, v, ystride, ustride, vstride, user_data);
} }
void video_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, void video_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t video_bit_rate, void *user_data)
uint32_t video_bit_rate, void *user_data)
{ {
CallControl.video_bit_rate = video_bit_rate; CallControl.video_bit_rate = video_bit_rate;
toxav_bit_rate_set(CallControl.av, friend_number, -1, CallControl.video_bit_rate, NULL); toxav_video_set_bit_rate(CallControl.av, friend_number, CallControl.video_bit_rate, NULL);
} }
void callback_recv_video_starting(uint32_t friend_number) void callback_recv_video_starting(uint32_t friend_number)