Skip to main content

GraphMetadata.h File

Stream metadata helpers for graph samples. More...

Included Headers

#include "graph/Graph.h" #include "pipeline/SessionOptions.h" #include <cstdint> #include <string> #include <unordered_map>

Namespaces Index

namespacesimaai
namespaceneat
namespacegraph

Classes Index

structStreamMetadataDefaults

Description

Stream metadata helpers for graph samples.

File Listing

The file content with the documentation metadata removed is:

1
6#pragma once
7
8#include "graph/Graph.h"
10
11#include <cstdint>
12#include <string>
13#include <unordered_map>
14
15namespace simaai::neat::graph {
16
18 std::string stream_id;
19 std::string caps_string;
20 std::string port_name;
21 std::string media_type;
22 std::string format;
23 std::string payload_tag;
24 bool fill_stream_id = true;
25 bool fill_input_seq = true;
26 bool fill_orig_input_seq = true;
27};
28
29inline void ensure_stream_metadata(Sample& sample, const StreamMetadataDefaults& defaults,
30 std::unordered_map<std::string, int64_t>* next_seq = nullptr) {
31 if (sample.stream_id.empty() && defaults.fill_stream_id) {
32 if (!defaults.stream_id.empty()) {
33 sample.stream_id = defaults.stream_id;
34 } else {
35 sample.stream_id = "stream0";
36 }
37 }
38
39 if (defaults.fill_input_seq && sample.input_seq < 0) {
40 if (sample.orig_input_seq >= 0) {
41 sample.input_seq = sample.orig_input_seq;
42 } else if (next_seq) {
43 auto& next = (*next_seq)[sample.stream_id];
44 sample.input_seq = next++;
45 } else {
46 sample.input_seq = 0;
47 }
48 }
49
50 if (defaults.fill_orig_input_seq && sample.orig_input_seq < 0) {
51 sample.orig_input_seq = sample.input_seq;
52 }
53
54 if (sample.caps_string.empty() && !defaults.caps_string.empty()) {
55 sample.caps_string = defaults.caps_string;
56 }
57 if (sample.port_name.empty() && !defaults.port_name.empty()) {
58 sample.port_name = defaults.port_name;
59 }
60 if (sample.media_type.empty() && !defaults.media_type.empty()) {
61 sample.media_type = defaults.media_type;
62 }
63 if (sample.format.empty() && !defaults.format.empty()) {
64 sample.format = defaults.format;
65 }
66 if (sample.payload_tag.empty() && !defaults.payload_tag.empty()) {
67 sample.payload_tag = defaults.payload_tag;
68 }
69}
70
71} // namespace simaai::neat::graph

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.1.