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

◆ processing_function()

void MayaFlux::Buffers::VideoStreamReader::processing_function ( const std::shared_ptr< Buffer > &  buffer)
overridevirtual

Extract the current frame from the container into the TextureBuffer.

Triggers the container's default processor if needed, extracts the processed uint8_t RGBA data, and copies it into the TextureBuffer's pixel storage via set_pixel_data().

Parameters
bufferThe TextureBuffer to write pixels into.

Implements MayaFlux::Buffers::BufferProcessor.

Definition at line 71 of file VideoContainerBuffer.cpp.

72{
73 if (!m_container || !buffer) {
74 return;
75 }
76
77 if (m_container->is_at_end()) {
78 buffer->mark_for_removal();
79 return;
80 }
81
82 try {
83 auto state = m_container->get_processing_state();
84
86 if (m_update_flags) {
87 buffer->mark_for_removal();
88 }
89 return;
90 }
91
94 if (m_container->try_acquire_processing_token(0)) {
95 m_container->process_default();
96 }
97 }
98 }
99
100 auto texture_buffer = std::dynamic_pointer_cast<TextureBuffer>(buffer);
101 if (!texture_buffer) {
102 return;
103 }
104
105 extract_frame_data(texture_buffer);
106
107 if (m_update_flags) {
108 buffer->mark_for_processing(true);
109 }
110
111 m_container->mark_dimension_consumed(0, m_reader_id);
112
113 if (m_container->all_dimensions_consumed()) {
114 m_container->update_processing_state(Kakshya::ProcessingState::READY);
115 m_container->reset_processing_token();
116 }
117
118 } catch (const std::exception& e) {
120 "VideoStreamReader: Error during processing: {}", e.what());
121 }
122}
#define MF_ERROR(comp, ctx,...)
void extract_frame_data(const std::shared_ptr< TextureBuffer > &texture_buffer)
Extract frame pixel data from processed_data into the TextureBuffer.
std::shared_ptr< Kakshya::StreamContainer > m_container
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
@ READY
Container has data loaded and is ready for processing.
@ NEEDS_REMOVAL
Container is marked for removal from the system.
@ PROCESSED
Container has completed processing and results are available.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, extract_frame_data(), m_container, m_reader_id, m_update_flags, MF_ERROR, MayaFlux::Kakshya::NEEDS_REMOVAL, MayaFlux::Kakshya::PROCESSED, and MayaFlux::Kakshya::READY.

+ Here is the call graph for this function: