12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #pragma once
- #include "api.h"
- #include "message_queue.h"
-
- #define WM_NOTIFY_REP WM_APP+1
- #define WM_NOTIFY_ANSWER WM_APP+2
- //#define WM_NOTIFY_LEAVE WM_APP+3
- #define WM_NOTIFY_CANDIDATE WM_APP+4
- #define WM_NOTIFY_OFFER WM_APP+5
- #define WM_ASK_PING WM_APP+6
- #define WM_ASK_CHANNEL WM_APP+7
- #define WM_ASK_VIDEOREQ WM_APP+8
- class CPeerConnection;
- class IRender;
- class CEgoClient;
- enum ControlState
- {
- Check,
- Process,
- };
- class CEgoWindow : public CMessageQueue
- {
- public:
- CEgoWindow(CEgoClient* _egoclient,IRender * render,RenderPosition pos);
- virtual void Start() override;
-
- virtual void Process(CIOBuffer* pBuffer) override;
- virtual void Stop() override;
- virtual void OnIdle() override;
- void PostMessage(int32_t type, int64_t l = 0, int64_t r = 0);
- void SetPeer(int32_t peer);
- //void CreateVideoReq();
- //void DelayNextVideoReq();
- //void DelayDataChannel();
- //void DelayStartPing();
- void SendData(CIOBuffer& pBuffer);
- void SetPeerNotify();
- //virtual void WriteCanMessage(std::unordered_map<int32_t, cannet_frame>& node, bool bLidar) override;
- int32_t GetSteerAngle();
- void OnNotifyRep(int32_t peer);
- void OnNotifyAnswer(CIOBuffer* pBuffer);
- void OnNotifyLeave();
- void OnNotifyCandidate(CIOBuffer* pBuffer);
- void OnNotifyOffer(CIOBuffer* pBuffer);
- static void FrameCallback(void* user_data,
- const uint8_t* yptr, int32_t strideY,
- const uint8_t* uptr, int32_t strideU,
- const uint8_t* vptr, int32_t strideV,
- const int32_t stride, const int frame_width,
- const int frame_height);
- void OnArgb32FrameReady(const uint8_t* yptr, int32_t strideY, const uint8_t* uptr, int32_t strideU, const uint8_t* vptr, int32_t strideV, const int32_t stride, const int frame_width, const int frame_height);
- void SetSize(int32_t width, int32_t height);
- void OnAskVideoReq();
- void OnAskDataChannel();
- void OnAskPing();
- void StopPing();
- ControlState GetControlState();
- void SetControlState(ControlState state);
- CEgoClient* GetEgoClient();
- void SetReady(bool b);
- private:
- void InitPeerConnection(int32_t peer);
- void SetRenderWindow(int32_t width, int32_t height);
-
- private:
- CEgoClient* _client;
- std::unique_ptr<CPeerConnection> _peerconnection;
- int32_t _peer;
- RenderPosition _pos;
- BITMAPINFO bmi_;
- //SocketClient* _client;
- bool start_;
- //bool _channelcreated;
- //std::mutex buffer_lock_;
- std::unique_ptr<uint8_t> image_;
- std::unique_ptr<uint8_t> _rotate;
- //std::thread _delayThread;
- IRender* _render;
- ControlState _control;
- //std::unique_ptr<IPeerNotify> _peerNotify;
- };
|