endpoint.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #ifndef ENDPOINT_H
  2. #define ENDPOINT_H
  3. #pragma once
  4. #include "../include/EventCode.h"
  5. #include "../mod_counterconnector/CallType.h"
  6. #ifdef RVC_OS_WIN
  7. #include <process.h>
  8. #include <objbase.h>
  9. #else
  10. #endif
  11. enum e_call_state
  12. {
  13. INIT,
  14. CALLING,
  15. PROCEEDING,
  16. COMPLETING,
  17. READY,
  18. TERMINATING,
  19. TERMINATED,
  20. };
  21. typedef struct endpoint_conf_t {
  22. char audio_handfree_in_dev[260];
  23. char audio_handfree_out_dev[260];
  24. char audio_pickup_in_dev[260];
  25. char audio_pickup_out_dev[260];
  26. bool audio_pickup_in_agc;
  27. bool audio_pickup_out_agc;
  28. bool audio_handfree_in_agc;
  29. bool audio_handfree_out_agc;
  30. bool audio_pickup_in_ns;
  31. bool audio_pickup_out_ns;
  32. bool audio_handfree_in_ns;
  33. bool audio_handfree_out_ns;
  34. bool audio_pickup_aec;
  35. bool audio_handfree_aec;
  36. int mtu;
  37. int quant;
  38. int media_start_port;
  39. int media_stop_port;
  40. char uri[256];
  41. int camera_count;
  42. int screen_count;
  43. volatile int *ref_active_camera;
  44. volatile int *ref_camera_switch;
  45. volatile int *ref_window_state;
  46. volatile int *ref_camera_state;
  47. volatile int *ref_active_img;
  48. volatile int *ref_Up_Fps;
  49. volatile int *ref_Is_ActiveInspect;
  50. volatile int *ref_Is_showPersonArea;
  51. volatile int *ref_Is_showRecordArea;
  52. }endpoint_conf_t;
  53. typedef struct endpoint_call_callback_t {
  54. void (*on_call_state)(int state, const char *state_desc, const char *phase, void *user_data);
  55. void *user_data;
  56. }endpoint_call_callback_t;
  57. typedef struct endpoint_call_t endpoint_call_t;
  58. typedef struct endpoint_t endpoint_t;
  59. typedef enum{
  60. INS_HANGUP = 1
  61. }endpoint_instruction_type_t;
  62. typedef struct endpoint_distribute_call_info_s{
  63. char server_ip[256];
  64. int server_port;
  65. endpoint_instruction_type_t etype;
  66. char call_name[256];
  67. }endpoint_distribute_call_info_t;
  68. typedef struct pad_req_switch_packet_s{
  69. unsigned int ulen; // 整个包的长度,包括当前字段
  70. unsigned int etype; // 指令类型
  71. unsigned int uparamlen; // 指令参数长度
  72. char* szparam; // 指令参数长度内容
  73. }pad_req_switch_packet_t;
  74. typedef struct video_session_callback_s{
  75. void (*on_video_box_move)(int imessagetype, int ivideotype, int ileft, int ibottom, void *user_data);
  76. void *user_data;
  77. }video_session_callback_t;
  78. int endpoint_init_lib();
  79. void endpoint_deinit_lib();
  80. class CEntityBase;
  81. endpoint_t *endpoint_create(CEntityBase *pEntity, const endpoint_conf_t *conf,int nDev);
  82. void endpoint_destroy(endpoint_t *ep);
  83. int endpoint_invoke(endpoint_t *ep, int (*func)(void*), void *user_data, int *result);
  84. void endpoint_change_audio_dev(endpoint_t *ep, int dev_type);
  85. endpoint_call_t *endpoint_call_create(endpoint_t *ep, const char *remote_uri, const char*local_ip,DeviceTypeEnum nDeviceType,CallingTypeEnum nCallType,const endpoint_call_callback_t *cb);
  86. void endpoint_call_destroy(endpoint_call_t *call);
  87. int endpoint_call_start(endpoint_call_t *call);
  88. int endpoint_call_hangup(endpoint_call_t *call);
  89. /*
  90. add by chenlp 20190826 新增int local_move和int remote_move参数,分别用于设置本地和远端视频窗口是否支持移动
  91. */
  92. int endpoint_call_start_video(endpoint_call_t *call, unsigned long remote_ip, int remote_video_rtp,
  93. unsigned long local_ip, int local_video_rtp,
  94. int remote_width, int remote_height,
  95. int local_view_x, int local_view_y, int local_view_cx, int local_view_cy,
  96. int remote_view_x, int remote_view_y, int remote_view_cx, int remote_view_cy,
  97. int local_move, int remote_move,video_session_callback_t* cb);
  98. int endpoint_call_stop_video(endpoint_call_t *call);
  99. int endpoint_call_stop_double_record_broadcast_video();
  100. 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);
  101. int local_play_stop_video(endpoint_call_t *call);
  102. //add by clp 20190903
  103. 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);
  104. void Terminatedcall(endpoint_call_t *call);
  105. int endpoint_distribute_hangup(endpoint_distribute_call_info_t *tinfo);
  106. int translate_ipaddr_from_int(char* strdst, unsigned ulen, unsigned long uip);
  107. #endif // ENDPOINT_H