endpoint.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #ifndef ENDPOINT_H
  2. #define ENDPOINT_H
  3. #pragma once
  4. #include "EventCode.h"
  5. #include "mod_counterconnector/CallType.h"
  6. #ifdef _WIN32
  7. #include <process.h>
  8. #include <objbase.h>
  9. #else
  10. #include "video_render.h"
  11. #endif
  12. #ifndef RVC_MAX_IP_LEN
  13. #define RVC_MAX_IP_LEN 128
  14. #endif
  15. enum e_call_state
  16. {
  17. INIT,
  18. CALLING,
  19. PROCEEDING,
  20. COMPLETING,
  21. READY,
  22. TERMINATING,
  23. TERMINATED,
  24. };
  25. typedef struct endpoint_audiodsp_config_s
  26. {
  27. bool audio_pickup_in_agc;
  28. bool audio_pickup_out_agc;
  29. bool audio_handfree_in_agc;
  30. bool audio_handfree_out_agc;
  31. bool audio_pickup_in_ns;
  32. bool audio_pickup_out_ns;
  33. bool audio_handfree_in_ns;
  34. bool audio_handfree_out_ns;
  35. bool audio_pickup_aec;
  36. bool audio_handfree_aec;
  37. }endpoint_audiodsp_config_t;
  38. typedef struct endpoint_conf_t {
  39. char audio_handfree_in_dev[MAX_PATH];
  40. char audio_handfree_out_dev[MAX_PATH];
  41. char audio_pickup_in_dev[MAX_PATH];
  42. char audio_pickup_out_dev[MAX_PATH];
  43. endpoint_audiodsp_config_t audio_dsp;
  44. #if defined(RVC_OS_WIN)
  45. int irendertype;
  46. int istoptype;
  47. int icaptype;
  48. #endif //RVC_OS_WIN
  49. int mtu;
  50. int quant;
  51. int media_start_port;
  52. int media_stop_port;
  53. char uri[256];
  54. int camera_count;
  55. int screen_count;
  56. volatile int *ref_active_camera;
  57. volatile int *ref_camera_switch;
  58. volatile int *ref_window_state;
  59. volatile int *ref_camera_state;
  60. volatile int *ref_active_img;
  61. volatile int *ref_Up_Fps;
  62. volatile int *ref_Is_ActiveInspect;
  63. volatile int *ref_Is_showPersonArea;
  64. volatile int *ref_Is_showRecordArea;
  65. }endpoint_conf_t;
  66. typedef struct endpoint_call_param_s {
  67. unsigned long local_ip;
  68. int local_port;
  69. unsigned long remote_ip;
  70. int remote_port;
  71. int remote_width;
  72. int remote_height;
  73. }endpoint_call_param_t;
  74. typedef struct endpoint_call_callback_t {
  75. void (*on_call_state)(int state, const char *state_desc, const char *phase, void *user_data);
  76. void *user_data;
  77. }endpoint_call_callback_t;
  78. typedef struct endpoint_function_callback_t {
  79. int (*on_function)(char* poutput, size_t ulen, const char *pinput, void *user_data);
  80. void *user_data;
  81. }endpoint_function_callback_s;
  82. typedef struct endpoint_call_t endpoint_call_t;
  83. typedef struct endpoint_t endpoint_t;
  84. typedef struct video_session_callback_s{
  85. void (*on_video_box_move)(int imessagetype, int ivideotype, int ileft, int ibottom, void *user_data);
  86. void *user_data;
  87. }video_session_callback_t;
  88. typedef struct endpoint_call_params_s{
  89. const char *to_uri;
  90. const char *from_uri;
  91. const char *call_id;
  92. const char *local_ip;
  93. const char *mapped_ip;
  94. int ilocal_audio_port;
  95. int imapped_audio_port;
  96. int ilocal_video_port;
  97. int imapped_video_port;
  98. DeviceTypeEnum nDeviceType;
  99. CallingTypeEnum nCallType;
  100. }endpoint_call_params_t;
  101. int endpoint_init_lib();
  102. void endpoint_deinit_lib();
  103. class CEntityBase;
  104. endpoint_t *endpoint_create(CEntityBase *pEntity, const endpoint_conf_t *conf,int nDev);
  105. void endpoint_destroy(endpoint_t *ep);
  106. int endpoint_invoke(endpoint_t *ep, int (*func)(void*), void *user_data, int *result);
  107. void endpoint_change_audio_dev(endpoint_t *ep, int dev_type);
  108. #if defined(RVC_OS_WIN)
  109. endpoint_call_t* endpoint_call_create(endpoint_t* ep, const endpoint_call_params_t* pcallparam, const endpoint_call_callback_t* cb, endpoint_function_callback_s* func_cb);
  110. #else
  111. endpoint_call_t* endpoint_call_create(endpoint_t* ep, const endpoint_call_params_t* pcallparam, const endpoint_call_callback_t* cb);
  112. #endif //RVC_OS_WIN
  113. int new_media_port(endpoint_t *ep);
  114. void endpoint_call_destroy(endpoint_call_t *call);
  115. int endpoint_call_start(endpoint_call_t *call);
  116. int endpoint_call_hangup(endpoint_call_t *call);
  117. #if defined(RVC_OS_WIN)
  118. /*
  119. add by chenlp 20190826 新增int local_move和int remote_move参数,分别用于设置本地和远端视频窗口是否支持移动
  120. */
  121. int endpoint_call_start_video(endpoint_call_t* call, unsigned long remote_ip, int remote_video_rtp,
  122. unsigned long local_ip, int local_video_rtp,
  123. int remote_width, int remote_height,
  124. int local_view_x, int local_view_y, int local_view_cx, int local_view_cy,
  125. int remote_view_x, int remote_view_y, int remote_view_cx, int remote_view_cy,
  126. int local_move, int remote_move, video_session_callback_t* cb);
  127. int endpoint_call_stop_video(endpoint_call_t* call);
  128. int endpoint_call_stop_double_record_broadcast_video();
  129. int local_play_start_video(endpoint_call_t* call, int local_view_x, int local_view_y, int local_view_cx, int local_view_cy, int local_move, video_session_callback_t* cb);
  130. int local_play_stop_video(endpoint_call_t* call);
  131. int local_remote_show_video(endpoint_call_t* call, int local_view_x, int local_view_y, int local_view_cx, int local_view_cy, int remote_view_x, int remote_view_y, int remote_view_cx, int remote_view_cy, int local_move, int remote_move, video_session_callback_t* cb);
  132. void Terminatedcall(endpoint_call_t* call);
  133. int translate_ipaddr_from_int(char* strdst, size_t ulen, unsigned long uip);
  134. int endpoint_getip_bydomain(char* strbuffer, size_t ulen, const char* pdomain);
  135. bool endpoint_addr_is_domain(const char* pserver_addr);
  136. #else
  137. int endpoint_call_start_video(endpoint_call_t* call, endpoint_call_param_t* pcallparam, rvc_video_render_callback_t* render_cb);
  138. int endpoint_call_stop_video(endpoint_call_t* call);
  139. void terminatedcall(endpoint_call_t* call);
  140. int translate_ipaddr_from_int(char* strdst, unsigned ulen, unsigned long uip);
  141. #endif //RVC_OS_WIN
  142. #endif // ENDPOINT_H