MayaFlux 0.5.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 26 of file VideoContainerBuffer.cpp.

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