1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 01:23:03 +01:00

Fix some new AV api changes

This commit is contained in:
Jfreegman 2015-10-20 17:59:14 -04:00
parent 462cfca175
commit abfdbfe468
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
3 changed files with 35 additions and 37 deletions

View File

@ -85,8 +85,8 @@ void call_cb ( ToxAV *av, uint32_t friend_number, bool audio_ena
void callstate_cb ( ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data ); void callstate_cb ( ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data );
void receive_audio_frame_cb ( ToxAV *av, uint32_t friend_number, int16_t const *pcm, size_t sample_count, void receive_audio_frame_cb ( ToxAV *av, uint32_t friend_number, int16_t const *pcm, size_t sample_count,
uint8_t channels, uint32_t sampling_rate, void *user_data ); uint8_t channels, uint32_t sampling_rate, void *user_data );
void audio_bit_rate_status_cb( ToxAV *av, uint32_t friend_number, void audio_bit_rate_status_cb( ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate,
bool stable, uint32_t bit_rate, void *user_data ); uint32_t video_bit_rate, void *user_data );
void receive_video_frame_cb ( ToxAV *av, uint32_t friend_number, void receive_video_frame_cb ( ToxAV *av, uint32_t friend_number,
uint16_t width, uint16_t height, uint16_t width, uint16_t height,
uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a, uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a,
@ -154,7 +154,7 @@ ToxAV *init_audio(ToxWindow *self, Tox *tox)
toxav_callback_call(CallControl.av, call_cb, &CallControl); toxav_callback_call(CallControl.av, call_cb, &CallControl);
toxav_callback_call_state(CallControl.av, callstate_cb, &CallControl); toxav_callback_call_state(CallControl.av, callstate_cb, &CallControl);
toxav_callback_audio_receive_frame(CallControl.av, receive_audio_frame_cb, &CallControl); toxav_callback_audio_receive_frame(CallControl.av, receive_audio_frame_cb, &CallControl);
toxav_callback_audio_bit_rate_status(CallControl.av, audio_bit_rate_status_cb, &CallControl); toxav_callback_bit_rate_status(CallControl.av, audio_bit_rate_status_cb, &CallControl);
return CallControl.av; return CallControl.av;
} }
@ -334,11 +334,10 @@ void receive_audio_frame_cb(ToxAV *av, uint32_t friend_number,
write_device_callback(friend_number, pcm, frame_size); write_device_callback(friend_number, pcm, frame_size);
} }
void audio_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, void audio_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate,
bool stable, uint32_t bit_rate, void *user_data) uint32_t video_bit_rate, void *user_data)
{ {
if ( stable ) CallControl.audio_bit_rate = audio_bit_rate;
CallControl.audio_bit_rate = bit_rate;
} }

View File

@ -836,7 +836,7 @@ static int group_audio_close_out_device(int groupnum)
// return 0; // return 0;
// } // }
static void groupchat_onWriteDevice(ToxWindow *self, Tox *m, int groupnum, int peernum, const int16_t *pcm, static void groupchat_onWriteDevice(ToxWindow *self, Tox *m, uint32_t groupnum, int peernum, const int16_t *pcm,
unsigned int samples, uint8_t channels, unsigned int sample_rate) unsigned int samples, uint8_t channels, unsigned int sample_rate)
{ {
return; return;

View File

@ -44,8 +44,9 @@ void receive_video_frame_cb( 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,
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,
bool stable, uint32_t bit_rate, void *user_data); void video_bit_rate_status_cb( ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate,
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)
{ {
@ -73,7 +74,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_video_bit_rate_status(CallControl.av, video_bit_rate_status_cb, &CallControl); toxav_callback_bit_rate_status(CallControl.av, video_bit_rate_status_cb, &CallControl);
return CallControl.av; return CallControl.av;
} }
@ -131,7 +132,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_video_bit_rate_set(CallControl.av, self->num, CallControl.video_bit_rate, true, NULL) == false ) { if ( toxav_bit_rate_set(CallControl.av, self->num, -1, 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;
} }
@ -150,7 +151,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_video_bit_rate_set(CallControl.av, friend_number, CallControl.video_bit_rate, true, NULL); toxav_bit_rate_set(CallControl.av, friend_number, -1, 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);
@ -178,13 +179,11 @@ 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, void video_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate,
bool stable, uint32_t bit_rate, void *user_data) uint32_t video_bit_rate, void *user_data)
{ {
if ( stable ) { CallControl.video_bit_rate = video_bit_rate;
CallControl.video_bit_rate = bit_rate; toxav_bit_rate_set(CallControl.av, friend_number, -1, CallControl.video_bit_rate, NULL);
toxav_video_bit_rate_set(CallControl.av, friend_number, CallControl.video_bit_rate, false, NULL);
}
} }
void callback_recv_video_starting(uint32_t friend_number) void callback_recv_video_starting(uint32_t friend_number)