MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ extract_frame_data()

void MayaFlux::Buffers::VideoStreamReader::extract_frame_data ( const std::shared_ptr< TextureBuffer > &  texture_buffer)
private

Extract frame pixel data from processed_data into the TextureBuffer.

Parameters
texture_bufferThe TextureBuffer to write into.

Definition at line 129 of file VideoContainerBuffer.cpp.

130{
131 if (!m_container) {
132 return;
133 }
134
135 auto& processed_data = m_container->get_processed_data();
136 if (processed_data.empty()) {
137 return;
138 }
139
140 const auto* pixel_vec = std::get_if<std::vector<uint8_t>>(&processed_data[0]);
141 if (!pixel_vec || pixel_vec->empty()) {
142 return;
143 }
144
145 uint64_t expected_size = static_cast<uint64_t>(texture_buffer->get_width())
146 * texture_buffer->get_height()
147 * Portal::Graphics::TextureLoom::get_bytes_per_pixel(texture_buffer->get_format());
148
149 size_t copy_size = std::min(pixel_vec->size(), static_cast<size_t>(expected_size));
150
151 if (copy_size < expected_size) {
153 "VideoStreamReader: processed frame is {} bytes, texture expects {}; "
154 "uploading a partial surface",
155 pixel_vec->size(), expected_size);
156 }
157
158 texture_buffer->set_pixel_data(pixel_vec->data(), copy_size);
159}
#define MF_WARN(comp, ctx,...)
std::shared_ptr< Kakshya::StreamContainer > m_container
static size_t get_bytes_per_pixel(ImageFormat format)
Get bytes per pixel for a format.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Portal::Graphics::TextureLoom::get_bytes_per_pixel(), m_container, and MF_WARN.

Referenced by on_attach(), and processing_function().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: