endpoint.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #ifndef ENDPOINT_H
  2. #define ENDPOINT_H
  3. #pragma once
  4. #include "../include/EventCode.h"
  5. #include "../mod_counterconnector/CallType.h"
  6. #ifdef _WIN32
  7. #include <process.h>
  8. #include <objbase.h>
  9. #else
  10. #endif
  11. #ifndef RVC_MAX_IP_LEN
  12. #define RVC_MAX_IP_LEN 128
  13. #endif
  14. enum e_call_state
  15. {
  16. INIT,
  17. CALLING,
  18. PROCEEDING,
  19. COMPLETING,
  20. READY,
  21. TERMINATING,
  22. TERMINATED,
  23. };
  24. typedef struct endpoint_conf_t {
  25. char audio_handfree_in_dev[260];
  26. char audio_handfree_out_dev[260];
  27. char audio_pickup_in_dev[260];
  28. char audio_pickup_out_dev[260];
  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. int mtu;
  40. int quant;
  41. int media_start_port;
  42. int media_stop_port;
  43. char uri[256];
  44. int camera_count;
  45. int screen_count;
  46. volatile int *ref_active_camera;
  47. volatile int *ref_camera_switch;
  48. volatile int *ref_window_state;
  49. volatile int *ref_camera_state;
  50. volatile int *ref_active_img;
  51. volatile int *ref_Up_Fps;
  52. volatile int *ref_Is_ActiveInspect;
  53. volatile int *ref_Is_showPersonArea;
  54. volatile int *ref_Is_showRecordArea;
  55. }endpoint_conf_t;
  56. typedef struct endpoint_call_param_s {
  57. unsigned long local_ip;
  58. int local_port;
  59. unsigned long remote_ip;
  60. int remote_port;
  61. int local_view_x;
  62. int local_view_y;
  63. int local_view_cx;
  64. int local_view_cy;
  65. int remote_view_x;
  66. int remote_view_y;
  67. int remote_view_cx;
  68. int remote_view_cy;
  69. int remote_width;
  70. int remote_height;
  71. int local_hwd_move;
  72. int remote_hwd_move;
  73. int local_fresh_time;
  74. int remote_fresh_time;
  75. }endpoint_call_param_t;
  76. typedef struct endpoint_call_callback_t {
  77. void (*on_call_state)(int state, const char *state_desc, const char *phase, void *user_data);
  78. void *user_data;
  79. }endpoint_call_callback_t;
  80. typedef struct endpoint_call_t endpoint_call_t;
  81. typedef struct endpoint_t endpoint_t;
  82. typedef struct video_session_callback_s{
  83. void (*on_video_box_move)(int imessagetype, int ivideotype, int ileft, int ibottom, void *user_data);
  84. void *user_data;
  85. }video_session_callback_t;
  86. typedef struct endpoint_call_params_s{
  87. const char *to_uri;
  88. const char *from_uri;
  89. const char *call_id;
  90. const char *local_ip;
  91. const char *mapped_ip;
  92. int ilocal_audio_port;
  93. int imapped_audio_port;
  94. int ilocal_video_port;
  95. int imapped_video_port;
  96. DeviceTypeEnum nDeviceType;
  97. CallingTypeEnum nCallType;
  98. }endpoint_call_params_t;
  99. int endpoint_init_lib();
  100. void endpoint_deinit_lib();
  101. class CEntityBase;
  102. endpoint_t *endpoint_create(CEntityBase *pEntity, const endpoint_conf_t *conf,int nDev);
  103. void endpoint_destroy(endpoint_t *ep);
  104. int endpoint_invoke(endpoint_t *ep, int (*func)(void*), void *user_data, int *result);
  105. void endpoint_change_audio_dev(endpoint_t *ep, int dev_type);
  106. endpoint_call_t *endpoint_call_create(endpoint_t *ep, const endpoint_call_params_t* pcallparam, const endpoint_call_callback_t *cb);
  107. //endpoint_call_t *endpoint_call_create(endpoint_t *ep, const char *to_uri, const char *from_uri, const char *call_id, const char*local_ip,DeviceTypeEnum nDeviceType,CallingTypeEnum nCallType,const endpoint_call_callback_t *cb);
  108. int new_media_port(endpoint_t *ep);
  109. void endpoint_call_destroy(endpoint_call_t *call);
  110. int endpoint_call_start(endpoint_call_t *call);
  111. int endpoint_call_hangup(endpoint_call_t *call);
  112. /*
  113. add by chenlp 20190826 新增int local_move和int remote_move参数,分别用于设置本地和远端视频窗口是否支持移动
  114. */
  115. int endpoint_call_start_video(endpoint_call_t *call, endpoint_call_param_t* pcallparam, video_session_callback_t* cb);
  116. int endpoint_call_stop_video(endpoint_call_t *call);
  117. int endpoint_call_stop_double_record_broadcast_video();
  118. 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);
  119. int local_play_stop_video(endpoint_call_t *call);
  120. //add by clp 20190903
  121. 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);
  122. void Terminatedcall(endpoint_call_t *call);
  123. int translate_ipaddr_from_int(char* strdst, unsigned ulen, unsigned long uip);
  124. #endif // ENDPOINT_H