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

◆ on_attach()

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

Attach the reader to a TextureBuffer.

Registers as a dimension reader on the container, validates that the container is ready, and performs an initial frame extraction.

Parameters
bufferThe TextureBuffer to attach to.

Reimplemented from MayaFlux::Buffers::BufferProcessor.

Definition at line 25 of file VideoContainerBuffer.cpp.

26{
27 if (!m_container || !buffer) {
28 return;
29 }
30
31 m_reader_id = m_container->register_dimension_reader(0);
32
33 if (!m_container->is_ready_for_processing()) {
35 std::source_location::current(),
36 "VideoStreamReader: Container not ready for processing");
37 }
38
39 try {
40 auto texture_buffer = std::dynamic_pointer_cast<TextureBuffer>(buffer);
41 if (!texture_buffer) {
43 std::source_location::current(),
44 "VideoStreamReader: Buffer must be a TextureBuffer");
45 }
46
47 extract_frame_data(texture_buffer);
48
49 if (m_update_flags) {
50 buffer->mark_for_processing(true);
51 }
52
53 } catch (const std::exception& e) {
55 "VideoStreamReader: Error during on_attach: {}", e.what());
56 }
57}
#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.

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

+ Here is the call graph for this function: