diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/av_test.c | 29 | ||||
-rw-r--r-- | testing/irc_syncbot.c | 20 |
2 files changed, 30 insertions, 19 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)) { |
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c index b879e4eb..2d326c4b 100644 --- a/testing/irc_syncbot.c +++ b/testing/irc_syncbot.c | |||
@@ -163,9 +163,15 @@ void send_irc_group(Tox *tox, uint8_t *msg, uint16_t len) | |||
163 | uint8_t req[len]; | 163 | uint8_t req[len]; |
164 | unsigned int i; | 164 | unsigned int i; |
165 | 165 | ||
166 | unsigned int spaces = 0; | ||
167 | |||
166 | for (i = 0; i < (len - 1); ++i) { | 168 | for (i = 0; i < (len - 1); ++i) { |
167 | if (msg[i + 1] == ':') { | 169 | if (msg[i + 1] == ' ') { |
168 | break; | 170 | ++spaces; |
171 | } else { | ||
172 | if (spaces >= 3 && msg[i + 1] == ':') { | ||
173 | break; | ||
174 | } | ||
169 | } | 175 | } |
170 | 176 | ||
171 | req[i] = msg[i + 1]; | 177 | req[i] = msg[i + 1]; |
@@ -227,11 +233,6 @@ Tox *init_tox(int argc, char *argv[]) | |||
227 | tox_callback_group_message(tox, ©_groupmessage, 0); | 233 | tox_callback_group_message(tox, ©_groupmessage, 0); |
228 | tox_callback_group_action(tox, ©_groupmessage, 0); | 234 | tox_callback_group_action(tox, ©_groupmessage, 0); |
229 | 235 | ||
230 | uint16_t port = atoi(argv[argvoffset + 2]); | ||
231 | unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); | ||
232 | tox_bootstrap(tox, argv[argvoffset + 1], port, binary_string, 0); | ||
233 | free(binary_string); | ||
234 | |||
235 | char temp_id[128]; | 236 | char temp_id[128]; |
236 | printf("\nEnter the address of irc_syncbots master (38 bytes HEX format):\n"); | 237 | printf("\nEnter the address of irc_syncbots master (38 bytes HEX format):\n"); |
237 | 238 | ||
@@ -239,6 +240,11 @@ Tox *init_tox(int argc, char *argv[]) | |||
239 | exit (1); | 240 | exit (1); |
240 | } | 241 | } |
241 | 242 | ||
243 | uint16_t port = atoi(argv[argvoffset + 2]); | ||
244 | unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); | ||
245 | tox_bootstrap(tox, argv[argvoffset + 1], port, binary_string, 0); | ||
246 | free(binary_string); | ||
247 | |||
242 | uint8_t *bin_id = hex_string_to_bin(temp_id); | 248 | uint8_t *bin_id = hex_string_to_bin(temp_id); |
243 | uint32_t num = tox_friend_add(tox, bin_id, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo") - 1, 0); | 249 | uint32_t num = tox_friend_add(tox, bin_id, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo") - 1, 0); |
244 | free(bin_id); | 250 | free(bin_id); |