#pragma once #include #include #include #include #include #include #include "cnstream_frame.hpp" #include "cnstream_module.hpp" #include "easyinfer/model_loader.h" #include "easytrack/easy_track.h" #include "cnstream_frame_va.hpp" #include "Util/util.h" #include "Util/logger.h" #include "Network/Socket.h" #include "rapidjson/prettywriter.h" using namespace toolkit; namespace cnstream{ class udp : public cnstream::Module, public cnstream::ModuleCreator { using super = cnstream::Module; public: explicit udp(const std::string &name) : super(name) {} bool Open(cnstream::ModuleParamSet paramSet) override; void Close() override { std::cout << this->GetName() << " Close called" << std::endl; } int Process(std::shared_ptr data) override; static void makeAddr(struct sockaddr *out,const char *ip,uint16_t port); private: udp(const udp &) = delete; udp &operator=(udp const &) = delete; Socket::Ptr sockerUdp = nullptr; rapidjson::StringBuffer buffer_; rapidjson::PrettyWriter writer_; int bindPort; std::string sendSockerIP; int sendPort; }; };