You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.9KB

  1. #ifndef _aio_rtmp_client_h_
  2. #define _aio_rtmp_client_h_
  3. #include "aio-socket.h"
  4. #include <stdint.h>
  5. #include <stddef.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. typedef struct aio_rtmp_client_t aio_rtmp_client_t;
  10. struct aio_rtmp_client_handler_t
  11. {
  12. /// aio_rtmp_client_t object destroy
  13. /// @param[in] param aio_rtmp_client_create param
  14. void (*ondestroy)(void* param);
  15. /// aio transport recv/send error
  16. void (*onerror)(void* param, int code);
  17. // play only
  18. int (*onaudio)(void* param, const void* audio, size_t bytes, uint32_t timestamp);
  19. int (*onvideo)(void* param, const void* video, size_t bytes, uint32_t timestamp);
  20. int (*onscript)(void* param, const void* script, size_t bytes, uint32_t timestamp);
  21. // publish only
  22. void (*onready)(void* param);
  23. void (*onsend)(void* param, size_t bytes);
  24. };
  25. aio_rtmp_client_t* aio_rtmp_client_create(aio_socket_t aio, const char* app, const char* stream, const char* tcurl, struct aio_rtmp_client_handler_t* handler, void* param);
  26. void aio_rtmp_client_destroy(aio_rtmp_client_t* client);
  27. /// @param[in] client see @rtmp_client_start
  28. /// @param[in] publish 0-Publish(push stream to server), 1-LIVE/VOD(pull from server), 2-LIVE only, 3-VOD only
  29. /// @return 0-ok, other-error
  30. int aio_rtmp_client_start(aio_rtmp_client_t* client, int publish);
  31. int aio_rtmp_client_stop(aio_rtmp_client_t* client);
  32. int aio_rtmp_client_pause(aio_rtmp_client_t* rtmp, int pause); // VOD only
  33. int aio_rtmp_client_seek(aio_rtmp_client_t* rtmp, double timestamp); // VOD only
  34. int aio_rtmp_client_send_audio(aio_rtmp_client_t* client, const void* flv, size_t bytes, uint32_t timestamp);
  35. int aio_rtmp_client_send_video(aio_rtmp_client_t* client, const void* flv, size_t bytes, uint32_t timestamp);
  36. int aio_rtmp_client_send_script(aio_rtmp_client_t* client, const void* flv, size_t bytes, uint32_t timestamp);
  37. size_t aio_rtmp_client_get_unsend(aio_rtmp_client_t* client);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* !_aio_rtmp_client_h_ */