videortp.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. int fresh_time;
  31. // if use frame, return TRUE, else 0
  32. int (*on_rx_frame)(video_frame *frame, void *user_data);
  33. void (*on_tx_udp)(const char *buf, int size, void *user_data); // for debug
  34. void (*on_rx_udp)(const char *buf, int size, void *user_data); // for debug
  35. void (*dbg)(void *user_data, const char *fmt, va_list arg);
  36. void (*logevent)(void* user_data, int itype, const char* strmessage);
  37. void *user_data;
  38. }videortp_config_t;
  39. int videortp_create(const videortp_config_t *config, videortp_t **p_rtp);
  40. void videortp_destroy(videortp_t *rtp);
  41. int videortp_start(videortp_t *rtp);
  42. void videortp_stop(videortp_t *rtp);
  43. int videortp_force_key_frame(videortp_t *rtp);
  44. int videortp_send_frame(videortp_t *rtp, const video_frame *frame);
  45. int videortp_send_yuvframe(videortp_t *vrtp, const video_frame *yuvframe);
  46. int videortp_reconfig_local_pt(videortp_t *vrtp, unsigned int local_pt);
  47. #ifdef __cplusplus
  48. }//extern "C" {
  49. #endif
  50. #endif // VIDEORTP_H