endpoint.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. #ifndef ENDPOINT_H
  2. #define ENDPOINT_H
  3. #pragma once
  4. #include "EventCode.h"
  5. #include "mod_counterconnector/CallType.h"
  6. #include "CommEntityUtil.hpp"
  7. #ifdef _WIN32
  8. #else
  9. #include "video_render.h"
  10. #endif
  11. #ifndef RVC_MAX_IP_LEN
  12. #define RVC_MAX_IP_LEN 128
  13. #endif
  14. #ifndef MAX_PATH
  15. #define MAX_PATH 260
  16. #endif
  17. enum e_call_state
  18. {
  19. INIT,
  20. CALLING,
  21. PROCEEDING,
  22. COMPLETING,
  23. READY,
  24. TERMINATING,
  25. TERMINATED,
  26. };
  27. typedef struct endpoint_audiodsp_config_s
  28. {
  29. bool audio_pickup_in_agc;
  30. bool audio_pickup_out_agc;
  31. bool audio_handfree_in_agc;
  32. bool audio_handfree_out_agc;
  33. bool audio_pickup_in_ns;
  34. bool audio_pickup_out_ns;
  35. bool audio_handfree_in_ns;
  36. bool audio_handfree_out_ns;
  37. bool audio_pickup_aec;
  38. bool audio_handfree_aec;
  39. }endpoint_audiodsp_config_t;
  40. typedef struct endpoint_conf_t {
  41. char audio_handfree_in_dev[MAX_PATH];
  42. char audio_handfree_out_dev[MAX_PATH];
  43. char audio_pickup_in_dev[MAX_PATH];
  44. char audio_pickup_out_dev[MAX_PATH];
  45. endpoint_audiodsp_config_t audio_dsp;
  46. #ifdef _WIN32
  47. int irendertype;
  48. #endif //_WIN32
  49. int mtu;
  50. int quant;
  51. int media_start_port;
  52. int media_stop_port;
  53. char uri[MAX_PATH];
  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_call_t endpoint_call_t;
  79. typedef struct endpoint_t endpoint_t;
  80. typedef struct video_session_callback_s{
  81. void (*on_video_box_move)(int imessagetype, int ivideotype, int ileft, int ibottom, void *user_data);
  82. void *user_data;
  83. }video_session_callback_t;
  84. typedef struct endpoint_call_params_s{
  85. const char *to_uri;
  86. const char *from_uri;
  87. const char *call_id;
  88. const char *local_ip;
  89. int ilocal_audio_port;
  90. int ilocal_video_port;
  91. DeviceTypeEnum nDeviceType;
  92. CallingTypeEnum nCallType;
  93. }endpoint_call_params_t;
  94. int endpoint_init_lib();
  95. void endpoint_deinit_lib();
  96. class CEntityBase;
  97. endpoint_t *endpoint_create(CEntityBase *pEntity, const endpoint_conf_t *conf,int nDev);
  98. void endpoint_destroy(endpoint_t *ep);
  99. int endpoint_invoke(endpoint_t *ep, int (*func)(void*), void *user_data, int *result);
  100. void endpoint_change_audio_dev(endpoint_t *ep, int dev_type);
  101. endpoint_call_t* endpoint_call_create(endpoint_t* ep, const endpoint_call_params_t* pcallparam, const endpoint_call_callback_t* cb);
  102. int new_media_port(endpoint_t *ep);
  103. void endpoint_call_destroy(endpoint_call_t *call);
  104. int endpoint_call_start(endpoint_call_t *call);
  105. int endpoint_call_hangup(endpoint_call_t *call);
  106. #ifdef _WIN32
  107. int endpoint_call_start_video(endpoint_call_t* call, unsigned long remote_ip, int remote_video_rtp,
  108. unsigned long local_ip, int local_video_rtp,
  109. int remote_width, int remote_height,
  110. int local_view_x, int local_view_y, int local_view_cx, int local_view_cy,
  111. int remote_view_x, int remote_view_y, int remote_view_cx, int remote_view_cy,
  112. int local_move, int remote_move, video_session_callback_t* cb);
  113. int endpoint_call_stop_video(endpoint_call_t* call);
  114. int endpoint_call_stop_double_record_broadcast_video();
  115. int local_play_stop_video(endpoint_call_t* call);
  116. 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);
  117. void terminatedcall(endpoint_call_t* call);
  118. #else
  119. int endpoint_call_start_video(endpoint_call_t* call, endpoint_call_param_t* pcallparam, rvc_video_render_callback_t* render_cb);
  120. int endpoint_call_stop_video(endpoint_call_t* call);
  121. void terminatedcall(endpoint_call_t* call);
  122. #endif //_WIN32
  123. #endif // ENDPOINT_H