videortp.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef VIDEORTP_H
  2. #define VIDEORTP_H
  3. #pragma once
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #include "videoutil.h"
  8. #include "log.h"
  9. typedef struct videortp_t videortp_t;
  10. typedef struct videortp_config_t
  11. {
  12. int dir;// 0:none 1:tx 2:rx 3:both
  13. unsigned int local_pt;
  14. unsigned int remote_pt;
  15. unsigned long local_ip;
  16. unsigned long remote_ip;
  17. int local_rtp_port;
  18. int remote_rtp_port;
  19. int mtu;
  20. int rx_width;
  21. int rx_height;
  22. int tx_width;
  23. int tx_height;
  24. int capture_width;
  25. int capture_height;
  26. int fps_den;
  27. int fps_num;
  28. int bit_rate;
  29. int quant;
  30. // if use frame, return TRUE, else 0
  31. int (*on_rx_frame)(video_frame *frame, void *user_data);
  32. void (*on_tx_udp)(const char *buf, int size, void *user_data); // for debug
  33. void (*on_rx_udp)(const char *buf, int size, void *user_data); // for debug
  34. void (*dbg)(void *user_data, const char *fmt, va_list arg);
  35. void *user_data;
  36. }videortp_config_t;
  37. int videortp_create(const videortp_config_t *config, videortp_t **p_rtp);
  38. void videortp_destroy(videortp_t *rtp);
  39. int videortp_start(videortp_t *rtp);
  40. void videortp_stop(videortp_t *rtp);
  41. int videortp_force_key_frame(videortp_t *rtp);
  42. int videortp_send_frame(videortp_t *rtp, const video_frame *frame);
  43. int videortp_send_yuvframe(videortp_t *vrtp, const video_frame *yuvframe);
  44. int videortp_reconfig_local_pt(videortp_t *vrtp, unsigned int local_pt);
  45. #ifdef __cplusplus
  46. }//extern "C" {
  47. #endif
  48. #endif // VIDEORTP_H