CLiveViodeProc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef CLIVEVIODEPROC_H
  2. #define CLIVEVIODEPROC_H
  3. #include "ITRTCCloud.h"
  4. #include <QString>
  5. #include <QObject>
  6. enum LIVE_TYPE
  7. {
  8. lt_unknown = 0,
  9. lt_client_camera, //摄像头
  10. lt_client_screen, //屏幕
  11. lt_client_camera_screen //摄像头+屏幕
  12. };
  13. class CVideoRenderCallBack : public ITRTCVideoRenderCallback
  14. {
  15. public:
  16. CVideoRenderCallBack();
  17. virtual void onRenderVideoFrame(const char* userId, TRTCVideoStreamType streamType, TRTCVideoFrame* frame);
  18. private:
  19. __int64 m_nLastFrameTime;
  20. };
  21. class CLiveViodeProc : public QObject, public ITRTCCloudCallback
  22. {
  23. Q_OBJECT
  24. public:
  25. CLiveViodeProc();
  26. ~CLiveViodeProc();
  27. void initParam(int nLiveType, uint32_t nSdkAppId, std::string sUserId, std::string sUserSig,
  28. std::string sRoomId, std::string sCameraStreamName, std::string sCameraStreamRecordId,
  29. std::string sScreenStreamName, std::string sScreenStreamRecordId);
  30. void EnterRoom();
  31. void exitRoom();
  32. void enableFrameCallBack(bool bEnable);
  33. void enableLoaclAudio(bool bEnable);
  34. void startPlayAudio();
  35. void setHandle(HWND hwnd);
  36. void startTest(HWND hwnd);
  37. void startTest(ITRTCVideoRenderCallback *pCallBack, bool bHighDpi = false);
  38. void stopTest(bool bHighDpi = false);
  39. bool isCameraTest();
  40. int getCameraCount();
  41. QString setCurrentCamera(int nIndex);
  42. QString getCurrentCamera();
  43. signals:
  44. void videoErrorMsg(QString);
  45. void enterRoomSucceed();
  46. void videoConnectionLost();
  47. void videoConnectionRecovery();
  48. void invigilatorEnterRoom();
  49. void invigilatorLeaveRoom();
  50. void invigilatorVolume(int);
  51. void cameraUseFailed();
  52. private:
  53. virtual void onError(TXLiteAVError errCode, const char* errMsg, void* arg);
  54. virtual void onWarning(TXLiteAVWarning warningCode, const char* warningMsg, void* arg);
  55. virtual void onEnterRoom(int result);
  56. virtual void onExitRoom(int reason);
  57. virtual void onRemoteUserEnterRoom(const char* userId);
  58. virtual void onRemoteUserLeaveRoom(const char* userId, int reason);
  59. virtual void onUserVideoAvailable(const char* userId, bool available);
  60. virtual void onUserAudioAvailable(const char* userId, bool available);
  61. // onScreenCaptureStarted
  62. // onScreenCaptureStoped
  63. virtual void onConnectionLost();
  64. virtual void onConnectionRecovery();
  65. virtual void onUserVoiceVolume(TRTCVolumeInfo* userVolumes, uint32_t userVolumesCount, uint32_t totalVolume);
  66. private:
  67. HWND m_hwnd;
  68. ITRTCCloud * m_pTRTCSDK;
  69. CVideoRenderCallBack *m_pVideoRenderCallBack;
  70. uint32_t m_nSdkAppId;
  71. std::string m_sUserId;
  72. std::string m_sUserSig;
  73. std::string m_sRoomId;
  74. std::string m_sCameraStreamName;
  75. std::string m_sCameraStreamRecordId;
  76. std::string m_sScreenStreamName;
  77. std::string m_sScreenStreamRecordId;
  78. bool m_bFrameCallBack;
  79. int m_nLiveType;
  80. bool m_bPlay;
  81. bool m_bEnableLocalAudo;
  82. bool m_bIsCameraTest;
  83. int m_nCameraCount;
  84. };
  85. extern std::shared_ptr<CLiveViodeProc> g_clientVideoProcPtr;
  86. #endif // CLIVEVIODEPROC_H