YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
Loading...
Searching...
No Matches
yodau::backend Namespace Reference

Classes

struct  point
 Point in percentage-based image coordinates. More...
struct  line
 Polyline / polygon described in percentage coordinates. More...
class  stream
 Represents a single video stream and its analytic connections. More...
struct  event
 Generic event produced by the backend. More...
struct  frame
 Video frame container. More...
class  cli_client
 Simple interactive CLI (REPL) for controlling a stream_manager. More...
class  stream_manager
 Central coordinator for streams, geometry, frame processing and events. More...

Typedefs

using line_ptr = std::shared_ptr<line const>
 Shared, immutable line pointer.

Enumerations

enum class  tripwire_dir { any , neg_to_pos , pos_to_neg }
 Allowed crossing direction for a tripwire. More...
enum  stream_type { local , file , rtsp , http }
 Source/transport type of a video stream. More...
enum class  stream_pipeline { manual , automatic , none }
 Processing pipeline mode for a stream. More...
enum class  event_kind { motion , tripwire , roi , info }
 High-level classification of backend events. More...
enum class  pixel_format {
  gray8 , rgb24 , bgr24 , rgba32 ,
  bgra32
}
 Pixel format of a frame buffer. More...

Functions

line_ptr make_line (std::vector< point > points, std::string name, bool closed=false)
 Create and normalize a line.
std::vector< pointparse_points (const std::string &points_str)
 Parse points from a textual representation.
std::string normalize_str (std::string_view str)
 Remove whitespace and parentheses from a string.
float parse_float (std::string_view num_str)
 Parse a float from a string view.

Typedef Documentation

◆ line_ptr

using yodau::backend::line_ptr = std::shared_ptr<line const>

Shared, immutable line pointer.

Definition at line 146 of file geometry.hpp.

Enumeration Type Documentation

◆ event_kind

enum class yodau::backend::event_kind
strong

High-level classification of backend events.

Events are produced by analytics / processing modules and can represent detections (e.g., motion), logical triggers (tripwire/ROI), or informational messages.

Enumerator
motion 

Motion was detected in the stream.

tripwire 

A tripwire (line crossing) condition was triggered.

roi 

A region-of-interest related event was triggered.

info 

Informational / diagnostic event that doesn't fit other categories.

Definition at line 19 of file event.hpp.

◆ pixel_format

enum class yodau::backend::pixel_format
strong

Pixel format of a frame buffer.

The enumerators describe the byte layout of pixels in frame::data. All formats are tightly packed without per-pixel padding.

Enumerator
gray8 

8-bit grayscale, 1 byte per pixel.

rgb24 

RGB, 8-bit per channel, 3 bytes per pixel.

bgr24 

BGR, 8-bit per channel, 3 bytes per pixel.

rgba32 

RGBA, 8-bit per channel, 4 bytes per pixel.

bgra32 

BGRA, 8-bit per channel, 4 bytes per pixel.

Definition at line 16 of file frame.hpp.

◆ stream_pipeline

Processing pipeline mode for a stream.

A stream can be inactive (none), or active in either a user-managed (manual) or auto-managed (automatic) pipeline.

Enumerator
manual 

Stream is active with manual/user-controlled processing.

automatic 

Stream is active with automatic backend-controlled processing.

none 

Stream is not active in any pipeline.

Definition at line 40 of file stream.hpp.

◆ stream_type

Source/transport type of a video stream.

This is a lightweight classification inferred from the stream path/URL or specified explicitly by the user.

See also
stream::identify
stream::type_name
Enumerator
local 

Local capture device (e.g., /dev/video*).

file 

File-based stream (path to a video file).

rtsp 

RTSP network stream.

http 

HTTP/HTTPS network stream.

Definition at line 23 of file stream.hpp.

23 {
25 local,
27 file,
29 rtsp,
31 http
32};

◆ tripwire_dir

enum class yodau::backend::tripwire_dir
strong

Allowed crossing direction for a tripwire.

Enumerator
any 

Direction is not constrained; any crossing counts.

neg_to_pos 

Crossing from negative side to positive side counts.

pos_to_neg 

Crossing from positive side to negative side counts.

Definition at line 62 of file geometry.hpp.

Function Documentation

◆ make_line()

yodau::backend::line_ptr yodau::backend::make_line ( std::vector< point > points,
std::string name,
bool closed = false )

Create and normalize a line.

Allocates a new line, moves in points and name, sets closed, and calls line::normalize().

Parameters
pointsVertex list to move into the line.
nameLogical name to move into the line.
closedWhether the line should be treated as closed.
Returns
A shared pointer to an immutable line instance.

Definition at line 82 of file geometry.cpp.

84 {
85 auto line_ptr = std::make_shared<line>();
86 line_ptr->points = std::move(points);
87 line_ptr->name = std::move(name);
88 line_ptr->closed = closed;
89 line_ptr->normalize();
90 return line_ptr;
91}
std::shared_ptr< line const > line_ptr
Shared, immutable line pointer.
Definition geometry.hpp:146

◆ normalize_str()

std::string yodau::backend::normalize_str ( std::string_view str)

Remove whitespace and parentheses from a string.

Used internally to simplify parsing of point lists.

Parameters
strInput string view.
Returns
Normalized string with spaces and '(' / ')' removed.

Definition at line 133 of file geometry.cpp.

133 {
134 std::string normalized;
135 normalized.reserve(str.size());
136 for (const char ch : str) {
137 if (std::isspace(ch) || ch == '(' || ch == ')') {
138 continue;
139 }
140 normalized.push_back(ch);
141 }
142 return normalized;
143}

◆ parse_float()

float yodau::backend::parse_float ( std::string_view num_str)

Parse a float from a string view.

Uses std::from_chars for locale-independent parsing.

Parameters
num_strNumber representation.
Returns
Parsed float value.
Exceptions
std::runtime_errorif the input is not a valid float.

Definition at line 145 of file geometry.cpp.

145 {
146 float value {};
147 const char* first = num_str.data();
148 const char* last = num_str.data() + num_str.size();
149 auto [ptr, ec] = std::from_chars(first, last, value);
150 if (ec != std::errc() || ptr != last) {
151 throw std::runtime_error(
152 "Invalid float value: " + std::string(num_str)
153 );
154 }
155 return value;
156}

◆ parse_points()

std::vector< yodau::backend::point > yodau::backend::parse_points ( const std::string & points_str)

Parse points from a textual representation.

Input format:

  • Points are separated by semicolons ';'
  • Each point is "x,y"
  • Whitespace and parentheses are ignored.

Examples:

  • "(10, 20); (30,40)"
  • "10,20;30,40; 50, 60"
Parameters
points_strInput string containing points.
Returns
Parsed list of points.
Exceptions
std::runtime_errorif parsing fails or no valid points are found.

Definition at line 94 of file geometry.cpp.

94 {
95 std::string normalized = normalize_str(points_str);
96 std::string_view input { normalized };
97 std::vector<point> points;
98 size_t start = 0;
99 while (start < input.size()) {
100 size_t end = input.find(';', start);
101 if (end == std::string_view::npos) {
102 end = input.size();
103 }
104 std::string_view segment { input.substr(start, end - start) };
105 if (!segment.empty()) {
106 const size_t comma_pos = segment.find(',');
107 if (comma_pos == std::string_view::npos) {
108 throw std::runtime_error(
109 "Missing comma separator: " + std::string(segment)
110 );
111 }
112 std::string_view x_str = segment.substr(0, comma_pos);
113 std::string_view y_str = segment.substr(comma_pos + 1);
114 if (x_str.empty() || y_str.empty()) {
115 throw std::runtime_error(
116 "Empty coordinate in point: " + std::string(segment)
117 );
118 }
119 float x = parse_float(x_str);
120 float y = parse_float(y_str);
121 points.emplace_back(x, y);
122 }
123 start = end + 1;
124 }
125 if (points.empty()) {
126 throw std::runtime_error(
127 "No valid points found in input: " + points_str
128 );
129 }
130 return points;
131}
std::string normalize_str(std::string_view str)
Remove whitespace and parentheses from a string.
Definition geometry.cpp:133
float parse_float(std::string_view num_str)
Parse a float from a string view.
Definition geometry.cpp:145