116 enum Format : uint8_t {
128 kFormatBgr888Packed = 10,
129 kFormatRgb888Packed = 11,
130 kFormatRgb888Planar = 12,
144 enum Stream : uint8_t {
211 bool operator<<(
const Bytes& bytes)
noexcept;
223 bool operator>>(Bytes& bytes)
const noexcept;
234 [[nodiscard]]
static bool check_valid(
const Bytes& bytes)
noexcept;
244 [[nodiscard]]
size_t get_serialized_size()
const noexcept;
251 [[nodiscard]]
bool is_valid()
const noexcept;
263 bool shallow_copy(
const CameraFrame& target)
noexcept;
275 bool deep_copy(
const CameraFrame& target)
noexcept;
298 bool create(
size_t size)
noexcept;
303 void clear()
noexcept;
316 bool shallow_copy(uint8_t* data,
size_t size)
noexcept;
328 bool deep_copy(uint8_t* data,
size_t size)
noexcept;
337 bool fill_data(uint8_t* data,
size_t size)
noexcept;
344 [[nodiscard]] uint32_t channel()
const noexcept;
351 [[nodiscard]] uint32_t width()
const noexcept;
358 [[nodiscard]] uint32_t height()
const noexcept;
365 [[nodiscard]] uint32_t freq()
const noexcept;
372 [[nodiscard]] Format format()
const noexcept;
379 [[nodiscard]] Stream stream()
const noexcept;
386 [[nodiscard]]
const uint8_t* data()
const noexcept;
393 [[nodiscard]]
size_t size()
const noexcept;
404 [[nodiscard]]
bool is_owner()
const noexcept;
411 void set_channel(uint32_t channel)
noexcept;
418 void set_width(uint32_t width)
noexcept;
425 void set_height(uint32_t height)
noexcept;
432 void set_freq(uint32_t freq)
noexcept;
439 void set_format(Format format)
noexcept;
446 void set_stream(Stream stream)
noexcept;
453 uint32_t& get_reserved()
noexcept {
return reserved_; }
457 static constexpr bool kZerocopyTypes{
true};
460 uint8_t* data_{
nullptr};
462 uint32_t channel_{0};
466 Format format_{kFormatUnknown};
467 Stream stream_{kStreamUnknown};
468 bool is_owner_{
false};
469 uint32_t reserved_{0};
471 static constexpr uint32_t kMagicNumberBegin{0x98B7F15A};
472 static constexpr uint32_t kMagicNumberEnd{0x98B7F15F};