video_session.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef MEDIACONTROLLER_VIDEO_H
  2. #define MEDIACONTROLLER_VIDEO_H
  3. #pragma once
  4. #include "EventCode.h"
  5. #include "mod_counterconnector/CallType.h"
  6. #include "endpoint.h"
  7. #if defined(RVC_OS_WIN)
  8. #include <videortp.h>
  9. #include <videoutil.h>
  10. #include "libvideoqueue.h"
  11. #include "rvc_media_common.h"
  12. #include <videocommon.h>
  13. #include <videoplayer.h>
  14. #include <videocap.h>
  15. #include <videoclock.h>
  16. #include <ipp.h>
  17. #include "cv.h"
  18. #include "mod_sipphone.h"
  19. #include "ivideorenderinterface.h"
  20. #else
  21. #include "video_render.h"
  22. #endif //RVC_OS_WIN
  23. typedef struct video_session_conf_t
  24. {
  25. unsigned long local_rtp_ip;
  26. int local_rtp_port;
  27. unsigned long remote_rtp_ip;
  28. int remote_rtp_port;
  29. int remote_video_width;
  30. int remote_video_height;
  31. #if defined(_MSC_VER)
  32. // remote video params
  33. int remote_video_view_x;
  34. int remote_video_view_y;
  35. int remote_video_view_cx;
  36. int remote_video_view_cy;
  37. // local video params
  38. int local_video_view_x;
  39. int local_video_view_y;
  40. int local_video_view_cx;
  41. int local_video_view_cy;
  42. int local_move;
  43. int remote_move;
  44. video_session_callback_t* video_echo_cb;
  45. eVideoRenderType eType;
  46. int ivideotype;
  47. #else
  48. rvc_video_render_callback_t video_render_cb;
  49. #endif //_MSC_VER
  50. int camera_count;
  51. int screen_count;
  52. volatile int *ref_active_camera;
  53. volatile int *ref_camera_switch;
  54. volatile int *ref_window_state;
  55. volatile int *ref_active_img;
  56. volatile int *ref_camera_state;
  57. volatile int *ref_Up_Fps;
  58. volatile int *ref_Is_ActiveInspect;
  59. volatile int *ref_Is_showPersonArea;
  60. volatile int *ref_Is_showRecordArea;
  61. int mtu;
  62. int video_quant; // 0-10
  63. int bit_rate; // 256*1024
  64. DeviceTypeEnum eDeviceType;
  65. CallingTypeEnum nCallType;
  66. int local_pt;
  67. int remote_pt;
  68. int ilocal_wind_flags;
  69. int iremote_wind_flags;
  70. }video_session_conf_t;
  71. #if defined(RVC_OS_WIN)
  72. typedef struct video_session_s video_session_t;
  73. typedef struct picture_record_s
  74. {
  75. HANDLE evt;
  76. HANDLE work_thread;
  77. video_session_t* session;
  78. video_frame* show_frame;
  79. video_frame* record_frame;
  80. }picture_record_t;
  81. struct video_session_s
  82. {
  83. video_session_conf_t conf;
  84. Clibvideoqueue* video_shm_q_env;// env rtp queue
  85. Clibvideoqueue* video_shm_q_opt;// opt rtp queue
  86. Clibvideoqueue* video_shm_q_preview; // preview queue
  87. Clibvideoqueue* video_shm_q_remote; // preview queue
  88. videoq_frame* video_error;
  89. videortp_t* rtp;
  90. videoclock_t local_clock;
  91. struct SwsContext* local_encode_sws_ctx_env;
  92. struct SwsContext* local_encode_sws_ctx_opt;
  93. IplImage* personimage;
  94. IplImage* personmask;
  95. HANDLE ui_thread;
  96. HANDLE ui_event;
  97. videoplayer_t* local_player;
  98. videoplayer_t* remote_player;
  99. HWND local_hwnd; // preview window
  100. HWND remote_hwnd; // remote window
  101. IVideoRender* plocal_render;
  102. IVideoRender* premote_render;
  103. bool bshow_remote;
  104. int ilast_windstae;
  105. bool bcamera_error_posted;
  106. int irecv_frameid;
  107. picture_record_t* pic_record;
  108. };
  109. int local_video_session_create(const video_session_conf_t* conf, video_session_t** p_session, bool bremote = false);
  110. void double_record_broadcast_video_session_stop();
  111. #else
  112. typedef struct video_session_t video_session_t;
  113. #endif //RVC_OS_WIN
  114. int video_session_create(const video_session_conf_t *conf, video_session_t **p_session);
  115. int video_session_start(video_session_t *session);
  116. void video_session_stop(video_session_t *session);
  117. void video_session_destroy(video_session_t *session);
  118. int video_lib_init();
  119. void video_lib_deinit();
  120. #endif