123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- #ifndef CNSTREAM_FRAME_HPP_
- #define CNSTREAM_FRAME_HPP_
- #include <memory>
- #include <string>
- #include <unordered_map>
- #include <vector>
- #include "cnstream_collection.hpp"
- #include "cnstream_common.hpp"
- #include "util/cnstream_any.hpp"
- namespace cnstream {
- class Module;
- class Pipeline;
- enum class CNFrameFlag {
- CN_FRAME_FLAG_EOS = 1 << 0,
- CN_FRAME_FLAG_INVALID = 1 << 1,
- CN_FRAME_FLAG_REMOVED = 1 << 2
- };
- class CNFrameInfo : private NonCopyable {
- public:
-
- static std::shared_ptr<CNFrameInfo> Create(const std::string& stream_id, bool eos = false,
- std::shared_ptr<CNFrameInfo> payload = nullptr);
- CNS_IGNORE_DEPRECATED_PUSH
- private:
- CNFrameInfo() = default;
- public:
-
- ~CNFrameInfo();
- CNS_IGNORE_DEPRECATED_POP
-
- bool IsEos() { return (flags & static_cast<size_t>(cnstream::CNFrameFlag::CN_FRAME_FLAG_EOS)) ? true : false; }
-
- bool IsRemoved() {
- return (flags & static_cast<size_t>(cnstream::CNFrameFlag::CN_FRAME_FLAG_REMOVED)) ? true : false;
- }
-
- bool IsInvalid() {
- return (flags & static_cast<size_t>(cnstream::CNFrameFlag::CN_FRAME_FLAG_INVALID)) ? true : false;
- }
-
- void SetStreamIndex(uint32_t index) { channel_idx = index; }
-
- uint32_t GetStreamIndex() const { return channel_idx; }
- std::string stream_id;
- int64_t timestamp = -1;
- size_t flags = 0;
- std::string videoPath;
-
- CNS_DEPRECATED std::unordered_map<int, any> datas;
- CNS_DEPRECATED std::mutex datas_lock_;
- Collection collection;
- std::shared_ptr<cnstream::CNFrameInfo> payload = nullptr;
- private:
-
- friend class Pipeline;
- mutable uint32_t channel_idx = INVALID_STREAM_IDX;
- void SetModulesMask(uint64_t mask);
- uint64_t GetModulesMask();
- uint64_t MarkPassed(Module* current);
- std::mutex mask_lock_;
-
- uint64_t modules_mask_ = 0;
- };
- using CNFrameInfoPtr = std::shared_ptr<CNFrameInfo>;
- }
- #endif
|