summaryrefslogtreecommitdiff
path: root/toxav/toxav.h
diff options
context:
space:
mode:
authorderive <nobody@nowhere>2016-03-09 15:52:31 +1300
committerderive <nobody@nowhere>2016-03-09 15:52:31 +1300
commit13fc00cc1b0680c2fba5f1c3f69d9d599f7d0611 (patch)
treec8865bf597a65c4a75aa886ba87b27fde3053cb0 /toxav/toxav.h
parent285dabdbc1d2b13dcf4fb608b860f59ebc45b482 (diff)
Added astyled toxav.h to match toxav.in.h
Diffstat (limited to 'toxav/toxav.h')
-rw-r--r--toxav/toxav.h131
1 files changed, 113 insertions, 18 deletions
diff --git a/toxav/toxav.h b/toxav/toxav.h
index 08a6d265..947d3c2c 100644
--- a/toxav/toxav.h
+++ b/toxav/toxav.h
@@ -96,6 +96,9 @@ typedef struct ToxAV ToxAV;
96 * :: API version 96 * :: API version
97 * 97 *
98 ******************************************************************************/ 98 ******************************************************************************/
99
100
101
99/** 102/**
100 * The major version number. Incremented when the API or ABI changes in an 103 * The major version number. Incremented when the API or ABI changes in an
101 * incompatible way. 104 * incompatible way.
@@ -168,26 +171,35 @@ bool toxav_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch)
168 * :: Creation and destruction 171 * :: Creation and destruction
169 * 172 *
170 ******************************************************************************/ 173 ******************************************************************************/
174
175
176
171typedef enum TOXAV_ERR_NEW { 177typedef enum TOXAV_ERR_NEW {
178
172 /** 179 /**
173 * The function returned successfully. 180 * The function returned successfully.
174 */ 181 */
175 TOXAV_ERR_NEW_OK, 182 TOXAV_ERR_NEW_OK,
183
176 /** 184 /**
177 * One of the arguments to the function was NULL when it was not expected. 185 * One of the arguments to the function was NULL when it was not expected.
178 */ 186 */
179 TOXAV_ERR_NEW_NULL, 187 TOXAV_ERR_NEW_NULL,
188
180 /** 189 /**
181 * Memory allocation failure while trying to allocate structures required for 190 * Memory allocation failure while trying to allocate structures required for
182 * the A/V session. 191 * the A/V session.
183 */ 192 */
184 TOXAV_ERR_NEW_MALLOC, 193 TOXAV_ERR_NEW_MALLOC,
194
185 /** 195 /**
186 * Attempted to create a second session for the same Tox instance. 196 * Attempted to create a second session for the same Tox instance.
187 */ 197 */
188 TOXAV_ERR_NEW_MULTIPLE, 198 TOXAV_ERR_NEW_MULTIPLE,
199
189} TOXAV_ERR_NEW; 200} TOXAV_ERR_NEW;
190 201
202
191/** 203/**
192 * Start new A/V session. There can only be only one session per Tox instance. 204 * Start new A/V session. There can only be only one session per Tox instance.
193 */ 205 */
@@ -213,6 +225,9 @@ Tox *toxav_get_tox(const ToxAV *toxAV);
213 * :: A/V event loop 225 * :: A/V event loop
214 * 226 *
215 ******************************************************************************/ 227 ******************************************************************************/
228
229
230
216/** 231/**
217 * Returns the interval in milliseconds when the next toxav_iterate call should 232 * Returns the interval in milliseconds when the next toxav_iterate call should
218 * be. If no call is active at the moment, this function returns 200. 233 * be. If no call is active at the moment, this function returns 200.
@@ -232,39 +247,51 @@ void toxav_iterate(ToxAV *toxAV);
232 * :: Call setup 247 * :: Call setup
233 * 248 *
234 ******************************************************************************/ 249 ******************************************************************************/
250
251
252
235typedef enum TOXAV_ERR_CALL { 253typedef enum TOXAV_ERR_CALL {
254
236 /** 255 /**
237 * The function returned successfully. 256 * The function returned successfully.
238 */ 257 */
239 TOXAV_ERR_CALL_OK, 258 TOXAV_ERR_CALL_OK,
259
240 /** 260 /**
241 * A resource allocation error occurred while trying to create the structures 261 * A resource allocation error occurred while trying to create the structures
242 * required for the call. 262 * required for the call.
243 */ 263 */
244 TOXAV_ERR_CALL_MALLOC, 264 TOXAV_ERR_CALL_MALLOC,
265
245 /** 266 /**
246 * Synchronization error occurred. 267 * Synchronization error occurred.
247 */ 268 */
248 TOXAV_ERR_CALL_SYNC, 269 TOXAV_ERR_CALL_SYNC,
270
249 /** 271 /**
250 * The friend number did not designate a valid friend. 272 * The friend number did not designate a valid friend.
251 */ 273 */
252 TOXAV_ERR_CALL_FRIEND_NOT_FOUND, 274 TOXAV_ERR_CALL_FRIEND_NOT_FOUND,
275
253 /** 276 /**
254 * The friend was valid, but not currently connected. 277 * The friend was valid, but not currently connected.
255 */ 278 */
256 TOXAV_ERR_CALL_FRIEND_NOT_CONNECTED, 279 TOXAV_ERR_CALL_FRIEND_NOT_CONNECTED,
280
257 /** 281 /**
258 * Attempted to call a friend while already in an audio or video call with 282 * Attempted to call a friend while already in an audio or video call with
259 * them. 283 * them.
260 */ 284 */
261 TOXAV_ERR_CALL_FRIEND_ALREADY_IN_CALL, 285 TOXAV_ERR_CALL_FRIEND_ALREADY_IN_CALL,
286
262 /** 287 /**
263 * Audio or video bit rate is invalid. 288 * Audio or video bit rate is invalid.
264 */ 289 */
265 TOXAV_ERR_CALL_INVALID_BIT_RATE, 290 TOXAV_ERR_CALL_INVALID_BIT_RATE,
291
266} TOXAV_ERR_CALL; 292} TOXAV_ERR_CALL;
267 293
294
268/** 295/**
269 * Call a friend. This will start ringing the friend. 296 * Call a friend. This will start ringing the friend.
270 * 297 *
@@ -279,8 +306,8 @@ typedef enum TOXAV_ERR_CALL {
279 * @param video_bit_rate Video bit rate in Kb/sec. Set this to 0 to disable 306 * @param video_bit_rate Video bit rate in Kb/sec. Set this to 0 to disable
280 * video sending. 307 * video sending.
281 */ 308 */
282bool toxav_call(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, 309bool toxav_call(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate,
283 uint32_t video_bit_rate, TOXAV_ERR_CALL *error); 310 TOXAV_ERR_CALL *error);
284 311
285/** 312/**
286 * The function type for the call callback. 313 * The function type for the call callback.
@@ -289,8 +316,9 @@ bool toxav_call(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate,
289 * @param audio_enabled True if friend is sending audio. 316 * @param audio_enabled True if friend is sending audio.
290 * @param video_enabled True if friend is sending video. 317 * @param video_enabled True if friend is sending video.
291 */ 318 */
292typedef void toxav_call_cb(ToxAV *toxAV, uint32_t friend_number, bool audio_enabled, 319typedef void toxav_call_cb(ToxAV *toxAV, uint32_t friend_number, bool audio_enabled, bool video_enabled,
293 bool video_enabled, void *user_data); 320 void *user_data);
321
294 322
295/** 323/**
296 * Set the callback for the `call` event. Pass NULL to unset. 324 * Set the callback for the `call` event. Pass NULL to unset.
@@ -299,35 +327,43 @@ typedef void toxav_call_cb(ToxAV *toxAV, uint32_t friend_number, bool audio_enab
299void toxav_callback_call(ToxAV *toxAV, toxav_call_cb *callback, void *user_data); 327void toxav_callback_call(ToxAV *toxAV, toxav_call_cb *callback, void *user_data);
300 328
301typedef enum TOXAV_ERR_ANSWER { 329typedef enum TOXAV_ERR_ANSWER {
330
302 /** 331 /**
303 * The function returned successfully. 332 * The function returned successfully.
304 */ 333 */
305 TOXAV_ERR_ANSWER_OK, 334 TOXAV_ERR_ANSWER_OK,
335
306 /** 336 /**
307 * Synchronization error occurred. 337 * Synchronization error occurred.
308 */ 338 */
309 TOXAV_ERR_ANSWER_SYNC, 339 TOXAV_ERR_ANSWER_SYNC,
340
310 /** 341 /**
311 * Failed to initialize codecs for call session. Note that codec initiation 342 * Failed to initialize codecs for call session. Note that codec initiation
312 * will fail if there is no receive callback registered for either audio or 343 * will fail if there is no receive callback registered for either audio or
313 * video. 344 * video.
314 */ 345 */
315 TOXAV_ERR_ANSWER_CODEC_INITIALIZATION, 346 TOXAV_ERR_ANSWER_CODEC_INITIALIZATION,
347
316 /** 348 /**
317 * The friend number did not designate a valid friend. 349 * The friend number did not designate a valid friend.
318 */ 350 */
319 TOXAV_ERR_ANSWER_FRIEND_NOT_FOUND, 351 TOXAV_ERR_ANSWER_FRIEND_NOT_FOUND,
352
320 /** 353 /**
321 * The friend was valid, but they are not currently trying to initiate a call. 354 * The friend was valid, but they are not currently trying to initiate a call.
322 * This is also returned if this client is already in a call with the friend. 355 * This is also returned if this client is already in a call with the friend.
323 */ 356 */
324 TOXAV_ERR_ANSWER_FRIEND_NOT_CALLING, 357 TOXAV_ERR_ANSWER_FRIEND_NOT_CALLING,
358
325 /** 359 /**
326 * Audio or video bit rate is invalid. 360 * Audio or video bit rate is invalid.
327 */ 361 */
328 TOXAV_ERR_ANSWER_INVALID_BIT_RATE, 362 TOXAV_ERR_ANSWER_INVALID_BIT_RATE,
363
329} TOXAV_ERR_ANSWER; 364} TOXAV_ERR_ANSWER;
330 365
366
331/** 367/**
332 * Accept an incoming call. 368 * Accept an incoming call.
333 * 369 *
@@ -350,7 +386,11 @@ bool toxav_answer(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate,
350 * :: Call state graph 386 * :: Call state graph
351 * 387 *
352 ******************************************************************************/ 388 ******************************************************************************/
389
390
391
353enum TOXAV_FRIEND_CALL_STATE { 392enum TOXAV_FRIEND_CALL_STATE {
393
354 /** 394 /**
355 * Set by the AV core if an error occurred on the remote end or if friend 395 * Set by the AV core if an error occurred on the remote end or if friend
356 * timed out. This is the final state after which no more state 396 * timed out. This is the final state after which no more state
@@ -358,30 +398,37 @@ enum TOXAV_FRIEND_CALL_STATE {
358 * in combination with other call states. 398 * in combination with other call states.
359 */ 399 */
360 TOXAV_FRIEND_CALL_STATE_ERROR = 1, 400 TOXAV_FRIEND_CALL_STATE_ERROR = 1,
401
361 /** 402 /**
362 * The call has finished. This is the final state after which no more state 403 * The call has finished. This is the final state after which no more state
363 * transitions can occur for the call. This call state will never be 404 * transitions can occur for the call. This call state will never be
364 * triggered in combination with other call states. 405 * triggered in combination with other call states.
365 */ 406 */
366 TOXAV_FRIEND_CALL_STATE_FINISHED = 2, 407 TOXAV_FRIEND_CALL_STATE_FINISHED = 2,
408
367 /** 409 /**
368 * The flag that marks that friend is sending audio. 410 * The flag that marks that friend is sending audio.
369 */ 411 */
370 TOXAV_FRIEND_CALL_STATE_SENDING_A = 4, 412 TOXAV_FRIEND_CALL_STATE_SENDING_A = 4,
413
371 /** 414 /**
372 * The flag that marks that friend is sending video. 415 * The flag that marks that friend is sending video.
373 */ 416 */
374 TOXAV_FRIEND_CALL_STATE_SENDING_V = 8, 417 TOXAV_FRIEND_CALL_STATE_SENDING_V = 8,
418
375 /** 419 /**
376 * The flag that marks that friend is receiving audio. 420 * The flag that marks that friend is receiving audio.
377 */ 421 */
378 TOXAV_FRIEND_CALL_STATE_ACCEPTING_A = 16, 422 TOXAV_FRIEND_CALL_STATE_ACCEPTING_A = 16,
423
379 /** 424 /**
380 * The flag that marks that friend is receiving video. 425 * The flag that marks that friend is receiving video.
381 */ 426 */
382 TOXAV_FRIEND_CALL_STATE_ACCEPTING_V = 32, 427 TOXAV_FRIEND_CALL_STATE_ACCEPTING_V = 32,
428
383}; 429};
384 430
431
385/** 432/**
386 * The function type for the call_state callback. 433 * The function type for the call_state callback.
387 * 434 *
@@ -393,79 +440,100 @@ enum TOXAV_FRIEND_CALL_STATE {
393 */ 440 */
394typedef void toxav_call_state_cb(ToxAV *toxAV, uint32_t friend_number, uint32_t state, void *user_data); 441typedef void toxav_call_state_cb(ToxAV *toxAV, uint32_t friend_number, uint32_t state, void *user_data);
395 442
443
396/** 444/**
397 * Set the callback for the `call_state` event. Pass NULL to unset. 445 * Set the callback for the `call_state` event. Pass NULL to unset.
398 * 446 *
399 */ 447 */
400void toxav_callback_call_state(ToxAV *toxAV, toxav_call_state_cb *callback, void *user_data); 448void toxav_callback_call_state(ToxAV *toxAV, toxav_call_state_cb *callback, void *user_data);
401 449
450
402/******************************************************************************* 451/*******************************************************************************
403 * 452 *
404 * :: Call control 453 * :: Call control
405 * 454 *
406 ******************************************************************************/ 455 ******************************************************************************/
456
457
458
407typedef enum TOXAV_CALL_CONTROL { 459typedef enum TOXAV_CALL_CONTROL {
460
408 /** 461 /**
409 * Resume a previously paused call. Only valid if the pause was caused by this 462 * Resume a previously paused call. Only valid if the pause was caused by this
410 * client, if not, this control is ignored. Not valid before the call is accepted. 463 * client, if not, this control is ignored. Not valid before the call is accepted.
411 */ 464 */
412 TOXAV_CALL_CONTROL_RESUME, 465 TOXAV_CALL_CONTROL_RESUME,
466
413 /** 467 /**
414 * Put a call on hold. Not valid before the call is accepted. 468 * Put a call on hold. Not valid before the call is accepted.
415 */ 469 */
416 TOXAV_CALL_CONTROL_PAUSE, 470 TOXAV_CALL_CONTROL_PAUSE,
471
417 /** 472 /**
418 * Reject a call if it was not answered, yet. Cancel a call after it was 473 * Reject a call if it was not answered, yet. Cancel a call after it was
419 * answered. 474 * answered.
420 */ 475 */
421 TOXAV_CALL_CONTROL_CANCEL, 476 TOXAV_CALL_CONTROL_CANCEL,
477
422 /** 478 /**
423 * Request that the friend stops sending audio. Regardless of the friend's 479 * Request that the friend stops sending audio. Regardless of the friend's
424 * compliance, this will cause the audio_receive_frame event to stop being 480 * compliance, this will cause the audio_receive_frame event to stop being
425 * triggered on receiving an audio frame from the friend. 481 * triggered on receiving an audio frame from the friend.
426 */ 482 */
427 TOXAV_CALL_CONTROL_MUTE_AUDIO, 483 TOXAV_CALL_CONTROL_MUTE_AUDIO,
484
428 /** 485 /**
429 * Calling this control will notify client to start sending audio again. 486 * Calling this control will notify client to start sending audio again.
430 */ 487 */
431 TOXAV_CALL_CONTROL_UNMUTE_AUDIO, 488 TOXAV_CALL_CONTROL_UNMUTE_AUDIO,
489
432 /** 490 /**
433 * Request that the friend stops sending video. Regardless of the friend's 491 * Request that the friend stops sending video. Regardless of the friend's
434 * compliance, this will cause the video_receive_frame event to stop being 492 * compliance, this will cause the video_receive_frame event to stop being
435 * triggered on receiving a video frame from the friend. 493 * triggered on receiving a video frame from the friend.
436 */ 494 */
437 TOXAV_CALL_CONTROL_HIDE_VIDEO, 495 TOXAV_CALL_CONTROL_HIDE_VIDEO,
496
438 /** 497 /**
439 * Calling this control will notify client to start sending video again. 498 * Calling this control will notify client to start sending video again.
440 */ 499 */
441 TOXAV_CALL_CONTROL_SHOW_VIDEO, 500 TOXAV_CALL_CONTROL_SHOW_VIDEO,
501
442} TOXAV_CALL_CONTROL; 502} TOXAV_CALL_CONTROL;
443 503
504
444typedef enum TOXAV_ERR_CALL_CONTROL { 505typedef enum TOXAV_ERR_CALL_CONTROL {
506
445 /** 507 /**
446 * The function returned successfully. 508 * The function returned successfully.
447 */ 509 */
448 TOXAV_ERR_CALL_CONTROL_OK, 510 TOXAV_ERR_CALL_CONTROL_OK,
511
449 /** 512 /**
450 * Synchronization error occurred. 513 * Synchronization error occurred.
451 */ 514 */
452 TOXAV_ERR_CALL_CONTROL_SYNC, 515 TOXAV_ERR_CALL_CONTROL_SYNC,
516
453 /** 517 /**
454 * The friend_number passed did not designate a valid friend. 518 * The friend_number passed did not designate a valid friend.
455 */ 519 */
456 TOXAV_ERR_CALL_CONTROL_FRIEND_NOT_FOUND, 520 TOXAV_ERR_CALL_CONTROL_FRIEND_NOT_FOUND,
521
457 /** 522 /**
458 * This client is currently not in a call with the friend. Before the call is 523 * This client is currently not in a call with the friend. Before the call is
459 * answered, only CANCEL is a valid control. 524 * answered, only CANCEL is a valid control.
460 */ 525 */
461 TOXAV_ERR_CALL_CONTROL_FRIEND_NOT_IN_CALL, 526 TOXAV_ERR_CALL_CONTROL_FRIEND_NOT_IN_CALL,
527
462 /** 528 /**
463 * Happens if user tried to pause an already paused call or if trying to 529 * Happens if user tried to pause an already paused call or if trying to
464 * resume a call that is not paused. 530 * resume a call that is not paused.
465 */ 531 */
466 TOXAV_ERR_CALL_CONTROL_INVALID_TRANSITION, 532 TOXAV_ERR_CALL_CONTROL_INVALID_TRANSITION,
533
467} TOXAV_ERR_CALL_CONTROL; 534} TOXAV_ERR_CALL_CONTROL;
468 535
536
469/** 537/**
470 * Sends a call control command to a friend. 538 * Sends a call control command to a friend.
471 * 539 *
@@ -484,33 +552,44 @@ bool toxav_call_control(ToxAV *toxAV, uint32_t friend_number, TOXAV_CALL_CONTROL
484 * :: Controlling bit rates 552 * :: Controlling bit rates
485 * 553 *
486 ******************************************************************************/ 554 ******************************************************************************/
555
556
557
487typedef enum TOXAV_ERR_BIT_RATE_SET { 558typedef enum TOXAV_ERR_BIT_RATE_SET {
559
488 /** 560 /**
489 * The function returned successfully. 561 * The function returned successfully.
490 */ 562 */
491 TOXAV_ERR_BIT_RATE_SET_OK, 563 TOXAV_ERR_BIT_RATE_SET_OK,
564
492 /** 565 /**
493 * Synchronization error occurred. 566 * Synchronization error occurred.
494 */ 567 */
495 TOXAV_ERR_BIT_RATE_SET_SYNC, 568 TOXAV_ERR_BIT_RATE_SET_SYNC,
569
496 /** 570 /**
497 * The audio bit rate passed was not one of the supported values. 571 * The audio bit rate passed was not one of the supported values.
498 */ 572 */
499 TOXAV_ERR_BIT_RATE_SET_INVALID_AUDIO_BIT_RATE, 573 TOXAV_ERR_BIT_RATE_SET_INVALID_AUDIO_BIT_RATE,
574
500 /** 575 /**
501 * The video bit rate passed was not one of the supported values. 576 * The video bit rate passed was not one of the supported values.
502 */ 577 */
503 TOXAV_ERR_BIT_RATE_SET_INVALID_VIDEO_BIT_RATE, 578 TOXAV_ERR_BIT_RATE_SET_INVALID_VIDEO_BIT_RATE,
579
504 /** 580 /**
505 * The friend_number passed did not designate a valid friend. 581 * The friend_number passed did not designate a valid friend.
506 */ 582 */
507 TOXAV_ERR_BIT_RATE_SET_FRIEND_NOT_FOUND, 583 TOXAV_ERR_BIT_RATE_SET_FRIEND_NOT_FOUND,
584
508 /** 585 /**
509 * This client is currently not in a call with the friend. 586 * This client is currently not in a call with the friend.
510 */ 587 */
511 TOXAV_ERR_BIT_RATE_SET_FRIEND_NOT_IN_CALL, 588 TOXAV_ERR_BIT_RATE_SET_FRIEND_NOT_IN_CALL,
589
512} TOXAV_ERR_BIT_RATE_SET; 590} TOXAV_ERR_BIT_RATE_SET;
513 591
592
514/** 593/**
515 * Set the bit rate to be used in subsequent audio/video frames. 594 * Set the bit rate to be used in subsequent audio/video frames.
516 * 595 *
@@ -522,8 +601,8 @@ typedef enum TOXAV_ERR_BIT_RATE_SET {
522 * video sending. Set to -1 to leave unchanged. 601 * video sending. Set to -1 to leave unchanged.
523 * 602 *
524 */ 603 */
525bool toxav_bit_rate_set(ToxAV *toxAV, uint32_t friend_number, int32_t audio_bit_rate, 604bool toxav_bit_rate_set(ToxAV *toxAV, uint32_t friend_number, int32_t audio_bit_rate, int32_t video_bit_rate,
526 int32_t video_bit_rate, TOXAV_ERR_BIT_RATE_SET *error); 605 TOXAV_ERR_BIT_RATE_SET *error);
527 606
528/** 607/**
529 * The function type for the bit_rate_status callback. The event is triggered 608 * The function type for the bit_rate_status callback. The event is triggered
@@ -538,6 +617,7 @@ bool toxav_bit_rate_set(ToxAV *toxAV, uint32_t friend_number, int32_t audio_bit_
538typedef void toxav_bit_rate_status_cb(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, 617typedef void toxav_bit_rate_status_cb(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate,
539 uint32_t video_bit_rate, void *user_data); 618 uint32_t video_bit_rate, void *user_data);
540 619
620
541/** 621/**
542 * Set the callback for the `bit_rate_status` event. Pass NULL to unset. 622 * Set the callback for the `bit_rate_status` event. Pass NULL to unset.
543 * 623 *
@@ -550,44 +630,57 @@ void toxav_callback_bit_rate_status(ToxAV *toxAV, toxav_bit_rate_status_cb *call
550 * :: A/V sending 630 * :: A/V sending
551 * 631 *
552 ******************************************************************************/ 632 ******************************************************************************/
633
634
635
553typedef enum TOXAV_ERR_SEND_FRAME { 636typedef enum TOXAV_ERR_SEND_FRAME {
637
554 /** 638 /**
555 * The function returned successfully. 639 * The function returned successfully.
556 */ 640 */
557 TOXAV_ERR_SEND_FRAME_OK, 641 TOXAV_ERR_SEND_FRAME_OK,
642
558 /** 643 /**
559 * In case of video, one of Y, U, or V was NULL. In case of audio, the samples 644 * In case of video, one of Y, U, or V was NULL. In case of audio, the samples
560 * data pointer was NULL. 645 * data pointer was NULL.
561 */ 646 */
562 TOXAV_ERR_SEND_FRAME_NULL, 647 TOXAV_ERR_SEND_FRAME_NULL,
648
563 /** 649 /**
564 * The friend_number passed did not designate a valid friend. 650 * The friend_number passed did not designate a valid friend.
565 */ 651 */
566 TOXAV_ERR_SEND_FRAME_FRIEND_NOT_FOUND, 652 TOXAV_ERR_SEND_FRAME_FRIEND_NOT_FOUND,
653
567 /** 654 /**
568 * This client is currently not in a call with the friend. 655 * This client is currently not in a call with the friend.
569 */ 656 */
570 TOXAV_ERR_SEND_FRAME_FRIEND_NOT_IN_CALL, 657 TOXAV_ERR_SEND_FRAME_FRIEND_NOT_IN_CALL,
658
571 /** 659 /**
572 * Synchronization error occurred. 660 * Synchronization error occurred.
573 */ 661 */
574 TOXAV_ERR_SEND_FRAME_SYNC, 662 TOXAV_ERR_SEND_FRAME_SYNC,
663
575 /** 664 /**
576 * One of the frame parameters was invalid. E.g. the resolution may be too 665 * One of the frame parameters was invalid. E.g. the resolution may be too
577 * small or too large, or the audio sampling rate may be unsupported. 666 * small or too large, or the audio sampling rate may be unsupported.
578 */ 667 */
579 TOXAV_ERR_SEND_FRAME_INVALID, 668 TOXAV_ERR_SEND_FRAME_INVALID,
669
580 /** 670 /**
581 * Either friend turned off audio or video receiving or we turned off sending 671 * Either friend turned off audio or video receiving or we turned off sending
582 * for the said payload. 672 * for the said payload.
583 */ 673 */
584 TOXAV_ERR_SEND_FRAME_PAYLOAD_TYPE_DISABLED, 674 TOXAV_ERR_SEND_FRAME_PAYLOAD_TYPE_DISABLED,
675
585 /** 676 /**
586 * Failed to push frame through rtp interface. 677 * Failed to push frame through rtp interface.
587 */ 678 */
588 TOXAV_ERR_SEND_FRAME_RTP_FAILED, 679 TOXAV_ERR_SEND_FRAME_RTP_FAILED,
680
589} TOXAV_ERR_SEND_FRAME; 681} TOXAV_ERR_SEND_FRAME;
590 682
683
591/** 684/**
592 * Send an audio frame to a friend. 685 * Send an audio frame to a friend.
593 * 686 *
@@ -608,9 +701,8 @@ typedef enum TOXAV_ERR_SEND_FRAME {
608 * @param sampling_rate Audio sampling rate used in this frame. Valid sampling 701 * @param sampling_rate Audio sampling rate used in this frame. Valid sampling
609 * rates are 8000, 12000, 16000, 24000, or 48000. 702 * rates are 8000, 12000, 16000, 24000, or 48000.
610 */ 703 */
611bool toxav_audio_send_frame(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, 704bool toxav_audio_send_frame(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, size_t sample_count,
612 size_t sample_count, uint8_t channels, uint32_t sampling_rate, 705 uint8_t channels, uint32_t sampling_rate, TOXAV_ERR_SEND_FRAME *error);
613 TOXAV_ERR_SEND_FRAME *error);
614 706
615/** 707/**
616 * Send a video frame to a friend. 708 * Send a video frame to a friend.
@@ -627,9 +719,8 @@ bool toxav_audio_send_frame(ToxAV *toxAV, uint32_t friend_number, const int16_t
627 * @param u U (Chroma) plane data. 719 * @param u U (Chroma) plane data.
628 * @param v V (Chroma) plane data. 720 * @param v V (Chroma) plane data.
629 */ 721 */
630bool toxav_video_send_frame(ToxAV *toxAV, uint32_t friend_number, uint16_t width, 722bool toxav_video_send_frame(ToxAV *toxAV, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t *y,
631 uint16_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, 723 const uint8_t *u, const uint8_t *v, TOXAV_ERR_SEND_FRAME *error);
632 TOXAV_ERR_SEND_FRAME *error);
633 724
634 725
635/******************************************************************************* 726/*******************************************************************************
@@ -637,6 +728,9 @@ bool toxav_video_send_frame(ToxAV *toxAV, uint32_t friend_number, uint16_t width
637 * :: A/V receiving 728 * :: A/V receiving
638 * 729 *
639 ******************************************************************************/ 730 ******************************************************************************/
731
732
733
640/** 734/**
641 * The function type for the audio_receive_frame callback. The callback can be 735 * The function type for the audio_receive_frame callback. The callback can be
642 * called multiple times per single iteration depending on the amount of queued 736 * called multiple times per single iteration depending on the amount of queued
@@ -649,9 +743,9 @@ bool toxav_video_send_frame(ToxAV *toxAV, uint32_t friend_number, uint16_t width
649 * @param sampling_rate Sampling rate used in this frame. 743 * @param sampling_rate Sampling rate used in this frame.
650 * 744 *
651 */ 745 */
652typedef void toxav_audio_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, 746typedef void toxav_audio_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, size_t sample_count,
653 size_t sample_count, uint8_t channels, uint32_t sampling_rate, 747 uint8_t channels, uint32_t sampling_rate, void *user_data);
654 void *user_data); 748
655 749
656/** 750/**
657 * Set the callback for the `audio_receive_frame` event. Pass NULL to unset. 751 * Set the callback for the `audio_receive_frame` event. Pass NULL to unset.
@@ -680,9 +774,10 @@ void toxav_callback_audio_receive_frame(ToxAV *toxAV, toxav_audio_receive_frame_
680 * image is bottom-up hence why you MUST abs() it when 774 * image is bottom-up hence why you MUST abs() it when
681 * calculating plane buffer size. 775 * calculating plane buffer size.
682 */ 776 */
683typedef void toxav_video_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, uint16_t width, 777typedef void toxav_video_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, uint16_t width, uint16_t height,
684 uint16_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, 778 const uint8_t *y, const uint8_t *u, const uint8_t *v, int32_t ystride, int32_t ustride, int32_t vstride,
685 int32_t ystride, int32_t ustride, int32_t vstride, void *user_data); 779 void *user_data);
780
686 781
687/** 782/**
688 * Set the callback for the `video_receive_frame` event. Pass NULL to unset. 783 * Set the callback for the `video_receive_frame` event. Pass NULL to unset.