Rerun C++ SDK
Loading...
Searching...
No Matches
video_stream.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/archetypes/video_stream.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/draw_order.hpp"
10#include "../components/video_codec.hpp"
11#include "../components/video_sample.hpp"
12#include "../indicator_component.hpp"
13#include "../result.hpp"
14
15#include <cstdint>
16#include <optional>
17#include <utility>
18#include <vector>
19
20namespace rerun::archetypes {
21 /// **Archetype**: Video stream consisting of raw video chunks.
22 ///
23 /// For logging video containers like mp4, refer to `archetypes::AssetVideo` and `archetypes::VideoFrameReference`.
24 /// To learn more about video support in Rerun, check the [video reference](https://rerun.io/docs/reference/video).
25 ///
26 /// All components except `sample` are typically logged statically once per entity.
27 /// `sample` is then logged repeatedly for each frame on the timeline.
28 ///
29 /// TODO(#7484): Add snippet.
30 ///
31 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
32 ///
33 struct VideoStream {
34 /// Video sample data (also known as "video chunk").
35 ///
36 /// The current timestamp is used as presentation timestamp (PTS) for all data in this sample.
37 /// There is currently no way to log differing decoding timestamps, meaning
38 /// that there is no support for B-frames.
39 /// See <https://github.com/rerun-io/rerun/issues/10090> for more details.
40 ///
41 /// Unlike any other data in Rerun, video samples are not allowed to be logged out of order,
42 /// as this may break live video playback.
43 /// I.e. any appended sample should have a timestamp greater than all previously logged samples.
44 ///
45 /// The samples are expected to be encoded using the `codec` field.
46 /// Each video sample must contain enough data for exactly one video frame
47 /// (this restriction may be relaxed in the future for some codecs).
48 ///
49 /// See `components::VideoCodec` for codec specific requirements.
50 std::optional<ComponentBatch> sample;
51
52 /// The codec used to encode the video chunks.
53 ///
54 /// This property is expected to be constant over time and is ideally logged statically once per stream.
55 std::optional<ComponentBatch> codec;
56
57 /// An optional floating point value that specifies the 2D drawing order.
58 ///
59 /// Objects with higher values are drawn on top of those with lower values.
60 /// Defaults to `-15.0`.
61 std::optional<ComponentBatch> draw_order;
62
63 public:
64 static constexpr const char IndicatorComponentName[] =
65 "rerun.components.VideoStreamIndicator";
66
67 /// Indicator component, used to identify the archetype when converting to a list of components.
69 /// The name of the archetype as used in `ComponentDescriptor`s.
70 static constexpr const char ArchetypeName[] = "rerun.archetypes.VideoStream";
71
72 /// `ComponentDescriptor` for the `sample` field.
73 static constexpr auto Descriptor_sample = ComponentDescriptor(
74 ArchetypeName, "sample",
76 );
77 /// `ComponentDescriptor` for the `codec` field.
78 static constexpr auto Descriptor_codec = ComponentDescriptor(
79 ArchetypeName, "codec",
81 );
82 /// `ComponentDescriptor` for the `draw_order` field.
84 ArchetypeName, "draw_order",
86 );
87
88 public:
89 VideoStream() = default;
90 VideoStream(VideoStream&& other) = default;
91 VideoStream(const VideoStream& other) = default;
92 VideoStream& operator=(const VideoStream& other) = default;
93 VideoStream& operator=(VideoStream&& other) = default;
94
95 explicit VideoStream(
97 )
98 : sample(ComponentBatch::from_loggable(std::move(_sample), Descriptor_sample)
99 .value_or_throw()),
100 codec(ComponentBatch::from_loggable(std::move(_codec), Descriptor_codec)
101 .value_or_throw()) {}
102
103 /// Update only some specific fields of a `VideoStream`.
105 return VideoStream();
106 }
107
108 /// Clear all the fields of a `VideoStream`.
110
111 /// Video sample data (also known as "video chunk").
112 ///
113 /// The current timestamp is used as presentation timestamp (PTS) for all data in this sample.
114 /// There is currently no way to log differing decoding timestamps, meaning
115 /// that there is no support for B-frames.
116 /// See <https://github.com/rerun-io/rerun/issues/10090> for more details.
117 ///
118 /// Unlike any other data in Rerun, video samples are not allowed to be logged out of order,
119 /// as this may break live video playback.
120 /// I.e. any appended sample should have a timestamp greater than all previously logged samples.
121 ///
122 /// The samples are expected to be encoded using the `codec` field.
123 /// Each video sample must contain enough data for exactly one video frame
124 /// (this restriction may be relaxed in the future for some codecs).
125 ///
126 /// See `components::VideoCodec` for codec specific requirements.
128 sample = ComponentBatch::from_loggable(_sample, Descriptor_sample).value_or_throw();
129 return std::move(*this);
130 }
131
132 /// This method makes it possible to pack multiple `sample` in a single component batch.
133 ///
134 /// This only makes sense when used in conjunction with `columns`. `with_sample` should
135 /// be used when logging a single row's worth of data.
137 sample = ComponentBatch::from_loggable(_sample, Descriptor_sample).value_or_throw();
138 return std::move(*this);
139 }
140
141 /// The codec used to encode the video chunks.
142 ///
143 /// This property is expected to be constant over time and is ideally logged statically once per stream.
145 codec = ComponentBatch::from_loggable(_codec, Descriptor_codec).value_or_throw();
146 return std::move(*this);
147 }
148
149 /// This method makes it possible to pack multiple `codec` in a single component batch.
150 ///
151 /// This only makes sense when used in conjunction with `columns`. `with_codec` should
152 /// be used when logging a single row's worth of data.
154 codec = ComponentBatch::from_loggable(_codec, Descriptor_codec).value_or_throw();
155 return std::move(*this);
156 }
157
158 /// An optional floating point value that specifies the 2D drawing order.
159 ///
160 /// Objects with higher values are drawn on top of those with lower values.
161 /// Defaults to `-15.0`.
163 draw_order =
164 ComponentBatch::from_loggable(_draw_order, Descriptor_draw_order).value_or_throw();
165 return std::move(*this);
166 }
167
168 /// This method makes it possible to pack multiple `draw_order` in a single component batch.
169 ///
170 /// This only makes sense when used in conjunction with `columns`. `with_draw_order` should
171 /// be used when logging a single row's worth of data.
173 ) && {
174 draw_order =
175 ComponentBatch::from_loggable(_draw_order, Descriptor_draw_order).value_or_throw();
176 return std::move(*this);
177 }
178
179 /// Partitions the component data into multiple sub-batches.
180 ///
181 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
182 /// instead, via `ComponentBatch::partitioned`.
183 ///
184 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
185 ///
186 /// The specified `lengths` must sum to the total length of the component batch.
188
189 /// Partitions the component data into unit-length sub-batches.
190 ///
191 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
192 /// where `n` is automatically guessed.
194 };
195
196} // namespace rerun::archetypes
197
198namespace rerun {
199 /// \private
200 template <typename T>
201 struct AsComponents;
202
203 /// \private
204 template <>
205 struct AsComponents<archetypes::VideoStream> {
206 /// Serialize all set component batches.
207 static Result<Collection<ComponentBatch>> as_batches(
208 const archetypes::VideoStream& archetype
209 );
210 };
211} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
VideoCodec
Component: The codec used to encode video stored in components::VideoSample.
Definition video_codec.hpp:31
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:14
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Video stream consisting of raw video chunks.
Definition video_stream.hpp:33
static VideoStream update_fields()
Update only some specific fields of a VideoStream.
Definition video_stream.hpp:104
VideoStream with_sample(const rerun::components::VideoSample &_sample) &&
Video sample data (also known as "video chunk").
Definition video_stream.hpp:127
VideoStream with_draw_order(const rerun::components::DrawOrder &_draw_order) &&
An optional floating point value that specifies the 2D drawing order.
Definition video_stream.hpp:162
std::optional< ComponentBatch > sample
Video sample data (also known as "video chunk").
Definition video_stream.hpp:50
std::optional< ComponentBatch > draw_order
An optional floating point value that specifies the 2D drawing order.
Definition video_stream.hpp:61
static constexpr auto Descriptor_sample
ComponentDescriptor for the sample field.
Definition video_stream.hpp:73
VideoStream with_many_sample(const Collection< rerun::components::VideoSample > &_sample) &&
This method makes it possible to pack multiple sample in a single component batch.
Definition video_stream.hpp:136
static VideoStream clear_fields()
Clear all the fields of a VideoStream.
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
VideoStream with_many_codec(const Collection< rerun::components::VideoCodec > &_codec) &&
This method makes it possible to pack multiple codec in a single component batch.
Definition video_stream.hpp:153
static constexpr auto Descriptor_codec
ComponentDescriptor for the codec field.
Definition video_stream.hpp:78
VideoStream with_many_draw_order(const Collection< rerun::components::DrawOrder > &_draw_order) &&
This method makes it possible to pack multiple draw_order in a single component batch.
Definition video_stream.hpp:172
static constexpr auto Descriptor_draw_order
ComponentDescriptor for the draw_order field.
Definition video_stream.hpp:83
VideoStream with_codec(const rerun::components::VideoCodec &_codec) &&
The codec used to encode the video chunks.
Definition video_stream.hpp:144
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition video_stream.hpp:70
std::optional< ComponentBatch > codec
The codec used to encode the video chunks.
Definition video_stream.hpp:55
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Component: Draw order of 2D elements.
Definition draw_order.hpp:20
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: Video sample data (also known as "video chunk").
Definition video_sample.hpp:22