#ifndef __VIDEOINPUT_H__ #define __VIDEOINPUT_H__ #include #include #include #include #include class VideoInputPrivate; class VideoInput { public: using PacketHandler = std::function; VideoInput(int32_t width, int32_t height); ~VideoInput(); bool start(); void stop(); bool isStarted() const; bool startEncode(); bool startFileInput(const std::string &path, int32_t width, int32_t height); void setPacketHandler(const PacketHandler &hanlder); protected: void run(); void fakeRun(); void encodeRun(); private: VideoInputPrivate *m_d = nullptr; int32_t m_width; int32_t m_height; std::string m_path; std::shared_ptr m_ifs; int32_t m_vid = -1; int32_t m_decodeChannel = -1; bool m_exit = true; std::thread m_thread; std::thread m_encodeThread; PacketHandler m_handler; }; #endif // __VIDEOINPUT_H__