#ifndef CLIVEVIODEPROC_H #define CLIVEVIODEPROC_H #include "ITRTCCloud.h" #include #include enum LIVE_TYPE { lt_unknown = 0, lt_client_camera, //摄像头 lt_client_screen, //屏幕 lt_client_camera_screen //摄像头+屏幕 }; class CVideoRenderCallBack : public ITRTCVideoRenderCallback { public: CVideoRenderCallBack(); virtual void onRenderVideoFrame(const char* userId, TRTCVideoStreamType streamType, TRTCVideoFrame* frame); private: __int64 m_nLastFrameTime; }; class CLiveViodeProc : public QObject, public ITRTCCloudCallback { Q_OBJECT public: CLiveViodeProc(); ~CLiveViodeProc(); void initParam(int nLiveType, uint32_t nSdkAppId, std::string sUserId, std::string sUserSig, std::string sRoomId, std::string sCameraStreamName, std::string sCameraStreamRecordId, std::string sScreenStreamName, std::string sScreenStreamRecordId); void EnterRoom(); void exitRoom(); void enableFrameCallBack(bool bEnable); void enableLoaclAudio(bool bEnable); void startPlayAudio(); void setHandle(HWND hwnd); void startTest(HWND hwnd); void startTest(ITRTCVideoRenderCallback *pCallBack, bool bHighDpi = false); void stopTest(bool bHighDpi = false); bool isCameraTest(); int getCameraCount(); QString setCurrentCamera(int nIndex); QString getCurrentCamera(); signals: void videoErrorMsg(QString); void enterRoomSucceed(); void videoConnectionLost(); void videoConnectionRecovery(); void invigilatorEnterRoom(); void invigilatorLeaveRoom(); void invigilatorVolume(int); void cameraUseFailed(); private: virtual void onError(TXLiteAVError errCode, const char* errMsg, void* arg); virtual void onWarning(TXLiteAVWarning warningCode, const char* warningMsg, void* arg); virtual void onEnterRoom(int result); virtual void onExitRoom(int reason); virtual void onRemoteUserEnterRoom(const char* userId); virtual void onRemoteUserLeaveRoom(const char* userId, int reason); virtual void onUserVideoAvailable(const char* userId, bool available); virtual void onUserAudioAvailable(const char* userId, bool available); // onScreenCaptureStarted // onScreenCaptureStoped virtual void onConnectionLost(); virtual void onConnectionRecovery(); virtual void onUserVoiceVolume(TRTCVolumeInfo* userVolumes, uint32_t userVolumesCount, uint32_t totalVolume); private: HWND m_hwnd; ITRTCCloud * m_pTRTCSDK; CVideoRenderCallBack *m_pVideoRenderCallBack; uint32_t m_nSdkAppId; std::string m_sUserId; std::string m_sUserSig; std::string m_sRoomId; std::string m_sCameraStreamName; std::string m_sCameraStreamRecordId; std::string m_sScreenStreamName; std::string m_sScreenStreamRecordId; bool m_bFrameCallBack; int m_nLiveType; bool m_bPlay; bool m_bEnableLocalAudo; bool m_bIsCameraTest; int m_nCameraCount; }; extern std::shared_ptr g_clientVideoProcPtr; #endif // CLIVEVIODEPROC_H