diff options
Diffstat (limited to 'testing/av_test.c')
-rw-r--r-- | testing/av_test.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/testing/av_test.c b/testing/av_test.c index 0e7af66e..de973d91 100644 --- a/testing/av_test.c +++ b/testing/av_test.c | |||
@@ -134,10 +134,15 @@ void t_toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, vo | |||
134 | } | 134 | } |
135 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, | 135 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, |
136 | uint16_t width, uint16_t height, | 136 | uint16_t width, uint16_t height, |
137 | uint8_t const *y, uint8_t const *u, uint8_t const *v, | 137 | uint8_t const *y, uint8_t const *u, uint8_t const *v, uint8_t const *a, |
138 | int32_t ystride, int32_t ustride, int32_t vstride, | 138 | int32_t ystride, int32_t ustride, int32_t vstride, int32_t astride, |
139 | void *user_data) | 139 | void *user_data) |
140 | { | 140 | { |
141 | ystride = abs(ystride); | ||
142 | ustride = abs(ustride); | ||
143 | vstride = abs(vstride); | ||
144 | astride = abs(astride); | ||
145 | |||
141 | uint16_t *img_data = malloc(height * width * 6); | 146 | uint16_t *img_data = malloc(height * width * 6); |
142 | 147 | ||
143 | unsigned long int i, j; | 148 | unsigned long int i, j; |
@@ -278,18 +283,18 @@ void initialize_tox(Tox** bootstrap, ToxAV** AliceAV, CallControl* AliceCC, ToxA | |||
278 | /* Alice */ | 283 | /* Alice */ |
279 | toxav_callback_call(*AliceAV, t_toxav_call_cb, AliceCC); | 284 | toxav_callback_call(*AliceAV, t_toxav_call_cb, AliceCC); |
280 | toxav_callback_call_state(*AliceAV, t_toxav_call_state_cb, AliceCC); | 285 | toxav_callback_call_state(*AliceAV, t_toxav_call_state_cb, AliceCC); |
281 | toxav_callback_receive_video_frame(*AliceAV, t_toxav_receive_video_frame_cb, AliceCC); | 286 | toxav_callback_video_receive_frame(*AliceAV, t_toxav_receive_video_frame_cb, AliceCC); |
282 | toxav_callback_receive_audio_frame(*AliceAV, t_toxav_receive_audio_frame_cb, AliceCC); | 287 | toxav_callback_audio_receive_frame(*AliceAV, t_toxav_receive_audio_frame_cb, AliceCC); |
283 | toxav_callback_audio_bit_rate_status(*AliceAV, t_toxav_audio_bit_rate_status_cb, AliceCC); | ||
284 | toxav_callback_video_bit_rate_status(*AliceAV, t_toxav_video_bit_rate_status_cb, AliceCC); | 288 | toxav_callback_video_bit_rate_status(*AliceAV, t_toxav_video_bit_rate_status_cb, AliceCC); |
289 | toxav_callback_audio_bit_rate_status(*AliceAV, t_toxav_audio_bit_rate_status_cb, AliceCC); | ||
285 | 290 | ||
286 | /* Bob */ | 291 | /* Bob */ |
287 | toxav_callback_call(*BobAV, t_toxav_call_cb, BobCC); | 292 | toxav_callback_call(*BobAV, t_toxav_call_cb, BobCC); |
288 | toxav_callback_call_state(*BobAV, t_toxav_call_state_cb, BobCC); | 293 | toxav_callback_call_state(*BobAV, t_toxav_call_state_cb, BobCC); |
289 | toxav_callback_receive_video_frame(*BobAV, t_toxav_receive_video_frame_cb, BobCC); | 294 | toxav_callback_video_receive_frame(*BobAV, t_toxav_receive_video_frame_cb, BobCC); |
290 | toxav_callback_receive_audio_frame(*BobAV, t_toxav_receive_audio_frame_cb, BobCC); | 295 | toxav_callback_audio_receive_frame(*BobAV, t_toxav_receive_audio_frame_cb, BobCC); |
291 | toxav_callback_audio_bit_rate_status(*BobAV, t_toxav_audio_bit_rate_status_cb, BobCC); | ||
292 | toxav_callback_video_bit_rate_status(*BobAV, t_toxav_video_bit_rate_status_cb, BobCC); | 296 | toxav_callback_video_bit_rate_status(*BobAV, t_toxav_video_bit_rate_status_cb, BobCC); |
297 | toxav_callback_audio_bit_rate_status(*BobAV, t_toxav_audio_bit_rate_status_cb, BobCC); | ||
293 | 298 | ||
294 | 299 | ||
295 | printf("Created 2 instances of ToxAV\n"); | 300 | printf("Created 2 instances of ToxAV\n"); |
@@ -364,7 +369,7 @@ int send_opencv_img(ToxAV* av, uint32_t friend_number, const IplImage* img) | |||
364 | } | 369 | } |
365 | 370 | ||
366 | 371 | ||
367 | int rc = toxav_send_video_frame(av, friend_number, img->width, img->height, planes[0], planes[1], planes[2], NULL); | 372 | int rc = toxav_video_send_frame(av, friend_number, img->width, img->height, planes[0], planes[1], planes[2], NULL, NULL); |
368 | free(planes[0]); | 373 | free(planes[0]); |
369 | free(planes[1]); | 374 | free(planes[1]); |
370 | free(planes[2]); | 375 | free(planes[2]); |
@@ -586,7 +591,7 @@ int main (int argc, char** argv) | |||
586 | err = Pa_StartStream(adout); | 591 | err = Pa_StartStream(adout); |
587 | assert(err == paNoError); | 592 | assert(err == paNoError); |
588 | 593 | ||
589 | toxav_set_audio_bit_rate(AliceAV, 0, 64, false, NULL); | 594 | toxav_audio_bit_rate_set(AliceAV, 0, 64, false, NULL); |
590 | 595 | ||
591 | /* Start write thread */ | 596 | /* Start write thread */ |
592 | pthread_t t; | 597 | pthread_t t; |
@@ -599,7 +604,7 @@ int main (int argc, char** argv) | |||
599 | int64_t count = sf_read_short(af_handle, PCM, frame_size); | 604 | int64_t count = sf_read_short(af_handle, PCM, frame_size); |
600 | if (count > 0) { | 605 | if (count > 0) { |
601 | TOXAV_ERR_SEND_FRAME rc; | 606 | TOXAV_ERR_SEND_FRAME rc; |
602 | if (toxav_send_audio_frame(AliceAV, 0, PCM, count/af_info.channels, af_info.channels, af_info.samplerate, &rc) == false) { | 607 | if (toxav_audio_send_frame(AliceAV, 0, PCM, count/af_info.channels, af_info.channels, af_info.samplerate, &rc) == false) { |
603 | printf("Error sending frame of size %ld: %d\n", count, rc); | 608 | printf("Error sending frame of size %ld: %d\n", count, rc); |
604 | } | 609 | } |
605 | } | 610 | } |
@@ -691,7 +696,7 @@ int main (int argc, char** argv) | |||
691 | exit(1); | 696 | exit(1); |
692 | } | 697 | } |
693 | 698 | ||
694 | toxav_set_video_bit_rate(AliceAV, 0, 5000, false, NULL); | 699 | toxav_video_bit_rate_set(AliceAV, 0, 5000, false, NULL); |
695 | 700 | ||
696 | time_t start_time = time(NULL); | 701 | time_t start_time = time(NULL); |
697 | while(start_time + 90 > time(NULL)) { | 702 | while(start_time + 90 > time(NULL)) { |