Skip to main content

Input.h File

Input Node — push-mode source. More...

Included Headers

#include "builder/Node.h" #include "builder/OutputSpec.h" #include "pipeline/FormatSpec.h" #include "pipeline/PayloadType.h" #include <memory> #include <cstdint> #include <optional> #include <string> #include <string_view> #include <vector>

Namespaces Index

namespacesimaai
namespaceneat
namespacenodes

Classes Index

structPreprocessMetaTemplate

Preprocess metadata template attached to ingress buffers. More...

structInputOptions

Caps, buffering, and pool options for the Input Node. More...

classInput

Push-mode source Node. More...

Description

Input Node — push-mode source.

Lets the application feed samples via Run::push().

Wraps an appsrc-style element. Use this when the application owns frame production (e.g. capturing from a custom source, replaying a buffer, or feeding test data) and needs to deliver samples to the pipeline by hand. A Graph that begins with an Input Node is built with Graph::build() and driven by Run::push() rather than Run::run().

File Listing

The file content with the documentation metadata removed is:

1
12#pragma once
13
14#include "builder/Node.h"
15#include "builder/OutputSpec.h"
18
19#include <memory>
20#include <cstdint>
21#include <optional>
22#include <string>
23#include <string_view>
24#include <vector>
25
26namespace simaai::neat {
27
38 bool enabled = false;
39 int target_width = 0;
40 int target_height = 0;
41 int scaled_width = 0;
42 int scaled_height = 0;
43 std::string resize_mode = "none";
44 int pad_value = 0;
45
46 std::string color_in;
47 std::string color_out;
49 std::vector<int> axis_perm;
50
51 bool normalize = false;
52 bool quantize = false;
53 bool tessellate = false;
54};
55
64enum class InputMemoryPolicy {
65 Auto = 0,
66 Ev74,
67 Dms0,
69};
70
79 int width = -1;
80 int height = -1;
81 int depth = -1;
84 int max_width = -1;
85 int max_height = -1;
86 int max_depth = -1;
88 int fps_n = 0;
89 int fps_d = 1;
91 std::string caps_override;
92
93 bool is_live = true;
94 bool do_timestamp = true;
95 bool block = true;
96 int stream_type = 0;
97 std::uint64_t max_bytes = 0;
98
99 bool use_simaai_pool = true;
105
107 std::string buffer_name;
108
111 std::optional<PreprocessMetaTemplate> preprocess_meta;
112};
113
115inline std::string resolve_input_media_type(const InputOptions& opt) {
116 switch (opt.payload_type) {
118 return "video/x-raw";
120 return "application/vnd.simaai.tensor";
122 if (opt.format.tag == FormatTag::H264) {
123 return "video/x-h264";
124 }
125 return "";
127 default:
128 return "";
129 }
130}
131
141class Input final : public Node, public OutputSpecProvider {
142public:
144 explicit Input(InputOptions opt);
146 explicit Input(std::string name);
148 Input(std::string name, InputOptions opt);
149
151 std::string kind() const override {
152 return "Input";
153 }
155 std::string user_label() const override {
156 if (!endpoint_name_.empty()) {
157 return endpoint_name_;
158 }
159 return "mysrc";
160 }
162 const std::string& endpoint_name() const noexcept {
163 return endpoint_name_;
164 }
166 InputRole input_role() const override {
167 return InputRole::Push;
168 }
170 NodeCapsBehavior caps_behavior() const override {
171 return NodeCapsBehavior::Static;
172 }
174 std::string buffer_name_hint(int node_index) const override;
175
177 std::string backend_fragment(int node_index) const override;
179 std::vector<std::string> element_names(int node_index) const override;
181 OutputSpec output_spec(const OutputSpec& input) const override;
182
184 const InputOptions& options() const {
185 return opt_;
186 }
188 std::string caps_string() const;
189
190private:
191 InputOptions opt_;
192 std::string endpoint_name_;
193};
194
195} // namespace simaai::neat
196
197namespace simaai::neat::nodes {
199std::shared_ptr<simaai::neat::Node> Input(InputOptions opt = {});
201std::shared_ptr<simaai::neat::Node> Input(std::string name, InputOptions opt = {});
202} // namespace simaai::neat::nodes

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.