12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #pragma once
- #include <memory>
- #include <string>
- #include <vector>
- #include <map>
- #include <list>
- #include <queue>
- #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<udp> {
- 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<cnstream::CNFrameInfo> 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<rapidjson::StringBuffer> writer_;
- int bindPort;
-
- std::string sendSockerIP;
- int sendPort;
-
- };
- };
|