6#include "../archetype_utils.hpp"
7#include "../collection.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/blob.hpp"
11#include "../components/media_type.hpp"
12#include "../result.hpp"
64 std::optional<ComponentBatch>
blob;
85 static constexpr const char ArchetypeName[] =
"rerun.archetypes.AssetAudio";
112 std::optional<rerun::components::MediaType>
media_type = {}
116 return std::move(asset).with_media_type(
media_type.value());
124 AssetAudio() =
default;
125 AssetAudio(AssetAudio&& other) =
default;
126 AssetAudio(
const AssetAudio& other) =
default;
127 AssetAudio& operator=(
const AssetAudio& other) =
default;
128 AssetAudio& operator=(AssetAudio&& other) =
default;
145 return std::move(*
this);
154 return std::move(*
this);
175 return std::move(*
this);
186 return std::move(*
this);
198 return detail::partition_batches({&
blob, &
media_type}, lengths_).value_or_throw();
206 return detail::partition_batches_of_unit_length({&
blob, &
media_type}).value_or_throw();
214 template <
typename T>
219 struct AsComponents<archetypes::AssetAudio> {
221 static Result<Collection<ComponentBatch>> as_batches(
const archetypes::AssetAudio& archetype
223 return detail::collect_batches({&archetype.blob, &archetype.media_type});
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:90
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
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:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: An audio file, stored as-is (.aac, .flac, .m4a, .mp3, .ogg, .wav).
Definition asset_audio.hpp:62
static Result< AssetAudio > from_file_path(const std::filesystem::path &path)
Creates a new AssetAudio from the file contents at path.
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition asset_audio.hpp:205
AssetAudio with_media_type(const rerun::components::MediaType &_media_type) &&
The Media Type of the asset.
Definition asset_audio.hpp:172
std::optional< ComponentBatch > blob
The asset's bytes.
Definition asset_audio.hpp:64
static AssetAudio update_fields()
Update only some specific fields of a AssetAudio.
Definition asset_audio.hpp:135
AssetAudio with_blob(const rerun::components::Blob &_blob) &&
The asset's bytes.
Definition asset_audio.hpp:143
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition asset_audio.hpp:85
AssetAudio with_many_blob(const Collection< rerun::components::Blob > &_blob) &&
This method makes it possible to pack multiple blob in a single component batch.
Definition asset_audio.hpp:152
static constexpr auto Descriptor_blob
ComponentDescriptor for the blob field.
Definition asset_audio.hpp:88
static constexpr auto Descriptor_media_type
ComponentDescriptor for the media_type field.
Definition asset_audio.hpp:92
std::optional< ComponentBatch > media_type
The Media Type of the asset.
Definition asset_audio.hpp:81
static AssetAudio from_file_contents(rerun::Collection< uint8_t > bytes, std::optional< rerun::components::MediaType > media_type={})
Creates a new AssetAudio from the given bytes.
Definition asset_audio.hpp:110
AssetAudio with_many_media_type(const Collection< rerun::components::MediaType > &_media_type) &&
This method makes it possible to pack multiple media_type in a single component batch.
Definition asset_audio.hpp:182
static AssetAudio clear_fields()
Clear all the fields of a AssetAudio.
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition asset_audio.hpp:197
Component: A binary blob of data.
Definition blob.hpp:16