#ifndef __VIDEOINPUT_H__ #define __VIDEOINPUT_H__ #include #include #include class VideoInput { public: using PacketHandler = std::function; VideoInput(int32_t width, int32_t height); ~VideoInput(); bool start(); void stop(); bool isStarted() const; bool startEncode(); void setPacketHandler(const PacketHandler &hanlder); protected: void run(); void encodeRun(); private: int32_t m_width; int32_t m_height; int32_t m_vid = -1; int32_t m_encodeChannel = -1; bool m_exit = true; std::thread m_thread; std::thread m_encodeThread; PacketHandler m_handler; }; #endif // __VIDEOINPUT_H__