MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kriya::BufferOperation Class Reference

Fundamental unit of operation in buffer processing pipelines. More...

#include <BufferOperation.hpp>

+ Collaboration diagram for MayaFlux::Kriya::BufferOperation:

Public Types

enum class  OpType : uint8_t {
  CAPTURE , TRANSFORM , ROUTE , LOAD ,
  SYNC , CONDITION , BRANCH , DISPATCH ,
  FUSE , MODIFY
}
 Defines the fundamental operation types in the processing pipeline. More...
 

Public Member Functions

BufferOperation & as_capture_phase ()
 Hint that this operation should execute in capture phase.
 
BufferOperation & as_process_phase ()
 Hint that this operation should execute in process phase.
 
BufferOperation & as_streaming ()
 Mark this operation as streaming (executes continuously) Useful for modify_buffer and similar stateful operations.
 
 BufferOperation (OpType type, BufferCapture capture)
 
 BufferOperation (OpType type, Buffers::ProcessingToken token)
 
BufferOperation & every_n_cycles (uint32_t n)
 Set cycle interval for periodic execution.
 
BufferOperation & for_cycles (uint32_t count)
 
ExecutionPhase get_execution_phase () const
 Get the execution phase hint for this operation.
 
std::shared_ptr< Kakshya::DynamicVideoStream > get_graphics_stream () const
 The dynamic video stream this operation writes to.
 
uint8_t get_priority () const
 Getters for internal state (read-only)
 
const std::string & get_tag () const
 Getters for user defined tag.
 
Buffers::ProcessingToken get_token () const
 Return the operation's processing token.
 
OpType get_type () const
 Getters for internal state (read-only)
 
bool is_streaming () const
 Check if this operation is a streaming operation.
 
BufferOperation & on_token (Buffers::ProcessingToken token)
 Set processing token for execution context.
 
BufferOperation & with_priority (uint8_t priority)
 Set execution priority for scheduler ordering.
 
BufferOperation & with_tag (const std::string &tag)
 Assign identification tag.
 

Static Public Member Functions

static BufferOperation capture (BufferCapture capture)
 Create a capture operation using BufferCapture configuration.
 
static BufferOperation capture_camera (const std::shared_ptr< IO::IOManager > &io_manager, const IO::CameraConfig &config, BufferCapture::CaptureMode mode=BufferCapture::CaptureMode::TRANSIENT, uint32_t cycle_count=1, std::optional< Portal::Graphics::RenderConfig > render=std::nullopt)
 Open and capture a camera through IOManager.
 
static CaptureBuilder capture_camera_from (const std::shared_ptr< IO::IOManager > &io_manager, const IO::CameraConfig &config, std::optional< Portal::Graphics::RenderConfig > render=std::nullopt)
 Open a camera and return its capture builder.
 
static BufferOperation capture_file (const std::shared_ptr< IO::IOManager > &io_manager, const std::string &filepath, IO::VideoLoadConfig config, uint32_t cycle_count=1, std::optional< Portal::Graphics::RenderConfig > render=std::nullopt)
 Capture a video file with explicit video load configuration.
 
static BufferOperation capture_file (const std::shared_ptr< IO::IOManager > &io_manager, const std::string &filepath, uint32_t channel=0, uint32_t cycle_count=0)
 Create a file capture operation that reads from file and stores in stream.
 
static CaptureBuilder capture_file_from (const std::shared_ptr< IO::IOManager > &io_manager, const std::string &filepath, IO::VideoLoadConfig config, std::optional< Portal::Graphics::RenderConfig > render=std::nullopt)
 Create a capture builder for a video file.
 
static CaptureBuilder capture_file_from (const std::shared_ptr< IO::IOManager > &io_manager, const std::string &filepath, uint32_t channel=0)
 Create CaptureBuilder for file with fluent configuration.
 
static CaptureBuilder capture_from (std::nullptr_t)
 
static CaptureBuilder capture_from (std::shared_ptr< Buffers::AudioBuffer > buffer)
 Create a CaptureBuilder for fluent capture configuration.
 
static CaptureBuilder capture_from (std::shared_ptr< Buffers::VKBuffer > buffer, std::optional< Portal::Graphics::RenderConfig > render=std::nullopt)
 
static BufferOperation capture_input (const std::shared_ptr< Buffers::BufferManager > &buffer_manager, uint32_t input_channel, BufferCapture::CaptureMode mode=BufferCapture::CaptureMode::ACCUMULATE, uint32_t cycle_count=0)
 Create capture operation from input channel using convenience API.
 
static CaptureBuilder capture_input_from (const std::shared_ptr< Buffers::BufferManager > &buffer_manager, uint32_t input_channel)
 Create CaptureBuilder for input channel with fluent configuration.
 
static BufferOperation capture_to_stream (const std::shared_ptr< IO::IOManager > &io_manager, const IO::CameraConfig &config, uint64_t ring_frames=0, std::optional< Portal::Graphics::RenderConfig > live=std::nullopt, std::optional< Portal::Graphics::RenderConfig > display=std::nullopt)
 Capture a camera straight into a dynamic video stream it creates.
 
static BufferOperation capture_to_stream (const std::shared_ptr< IO::IOManager > &io_manager, const std::shared_ptr< Kakshya::VideoStreamContainer > &container, uint64_t ring_frames=0, std::optional< Portal::Graphics::RenderConfig > live=std::nullopt, std::optional< Portal::Graphics::RenderConfig > display=std::nullopt)
 Capture an opened camera or loaded video into a dynamic video stream it creates.
 
static BufferOperation capture_to_stream (const std::shared_ptr< IO::IOManager > &io_manager, const std::string &filepath, IO::VideoLoadConfig config, uint64_t ring_frames=0, std::optional< Portal::Graphics::RenderConfig > live=std::nullopt, std::optional< Portal::Graphics::RenderConfig > display=std::nullopt)
 Capture a video file straight into a dynamic video stream it creates.
 
static BufferOperation dispatch_to (OperationFunction handler, Buffers::ProcessingToken token=Buffers::ProcessingToken::AUDIO_BACKEND)
 Create a dispatch operation for external processing.
 
static BufferOperation file_to_stream (const std::shared_ptr< IO::IOManager > &io_manager, const std::string &filepath, std::shared_ptr< Kakshya::DynamicSoundStream > target_stream, uint32_t cycle_count=0)
 Create operation to route file data to DynamicSoundStream.
 
static BufferOperation file_to_stream (const std::shared_ptr< IO::IOManager > &io_manager, const std::string &filepath, std::shared_ptr< Kakshya::DynamicVideoStream > target_stream, IO::VideoLoadConfig config, uint32_t cycle_count=0, std::optional< Portal::Graphics::RenderConfig > render=std::nullopt)
 Route frames from a video file to a dynamic video stream.
 
static BufferOperation fuse_containers (std::vector< std::shared_ptr< Kakshya::DynamicSoundStream > > sources, TransformVectorFunction fusion_func, std::shared_ptr< Kakshya::DynamicSoundStream > target)
 Create a fusion operation for multiple DynamicSoundStream sources.
 
static BufferOperation fuse_containers (std::vector< std::shared_ptr< Kakshya::DynamicVideoStream > > sources, TransformVectorFunction fusion_func, std::shared_ptr< Kakshya::DynamicVideoStream > target)
 Fuse video stream frames into a dynamic video stream.
 
static BufferOperation fuse_data (std::vector< std::shared_ptr< Buffers::AudioBuffer > > sources, TransformVectorFunction fusion_func, std::shared_ptr< Buffers::AudioBuffer > target)
 Create a fusion operation for multiple AudioBuffer sources.
 
static BufferOperation fuse_data (std::vector< std::shared_ptr< Buffers::VKBuffer > > sources, TransformVectorFunction fusion_func, std::shared_ptr< Buffers::VKBuffer > target)
 Fuse graphics buffer data into a graphics destination.
 
static bool is_capture_phase_operation (const BufferOperation &op)
 
static bool is_process_phase_operation (const BufferOperation &op)
 
static BufferOperation load_from_container (std::shared_ptr< Kakshya::DynamicSoundStream > source, std::shared_ptr< Buffers::AudioBuffer > target, uint64_t start_frame=0, uint32_t length=0)
 Create a load operation from container to buffer.
 
static BufferOperation load_from_container (std::shared_ptr< Kakshya::DynamicVideoStream > source, std::shared_ptr< Buffers::VKBuffer > target, uint64_t start_frame=0, uint32_t length=0)
 Load video frames from a dynamic stream into a graphics buffer.
 
static BufferOperation modify_buffer (std::shared_ptr< Buffers::AudioBuffer > buffer, Buffers::AudioProcessingFunction modifier)
 Create a modify operation for direct buffer manipulation.
 
static BufferOperation modify_buffer (std::shared_ptr< Buffers::VKBuffer > buffer, Buffers::GraphicsProcessingFunction modifier)
 Attach a graphics quick processor to a Vulkan buffer.
 
static BufferOperation route_to_buffer (std::shared_ptr< Buffers::AudioBuffer > target)
 Create a routing operation to AudioBuffer destination.
 
static BufferOperation route_to_buffer (std::shared_ptr< Buffers::TextureArrayBuffer > target, std::vector< std::shared_ptr< Core::VKImage > > images)
 Route many GPU images into the layers of a texture array buffer.
 
static BufferOperation route_to_buffer (std::shared_ptr< Buffers::TextureArrayBuffer > target, uint32_t layer=0)
 Route frames into one layer of a texture array buffer.
 
static BufferOperation route_to_buffer (std::shared_ptr< Buffers::VKBuffer > target)
 Route data to a graphics buffer.
 
static BufferOperation route_to_container (std::shared_ptr< Kakshya::DynamicSoundStream > target, uint32_t channel=0)
 Create a routing operation to DynamicSoundStream destination.
 
static BufferOperation route_to_container (std::shared_ptr< Kakshya::DynamicVideoStream > target, std::optional< Portal::Graphics::RenderConfig > render=std::nullopt)
 Append frames to a dynamic video stream.
 
static BufferOperation transform (TransformationFunction transformer, Buffers::ProcessingToken token=Buffers::ProcessingToken::AUDIO_BACKEND)
 Create a transform operation with custom transformation function.
 
static BufferOperation when (std::function< bool(uint32_t)> condition, Buffers::ProcessingToken token=Buffers::ProcessingToken::AUDIO_BACKEND)
 Create a conditional operation for pipeline branching.
 

Private Types

enum class  ExecutionPhase : uint8_t { AUTO , CAPTURE , PROCESS }
 

Private Attributes

std::shared_ptr< Buffers::BufferProcessor > m_attached_processor
 
Buffers::AudioProcessingFunction m_audio_buffer_modifier
 
BufferCapture m_capture
 
std::function< bool(uint32_t)> m_condition
 
uint32_t m_cycle_interval = 1
 
OperationFunction m_dispatch_handler
 
bool m_display_attached {}
 
ExecutionPhase m_execution_phase { ExecutionPhase::AUTO }
 
TransformVectorFunction m_fusion_function
 
Buffers::GraphicsProcessingFunction m_graphics_buffer_modifier
 
bool m_is_streaming {}
 
uint32_t m_load_length {}
 
uint32_t m_modify_cycle_count {}
 
uint8_t m_priority = 128
 
std::optional< Portal::Graphics::RenderConfig > m_render
 
std::vector< std::shared_ptr< Buffers::AudioBuffer > > m_source_audio_buffers
 
std::shared_ptr< Kakshya::DynamicSoundStream > m_source_audio_stream
 
std::vector< std::shared_ptr< Kakshya::DynamicSoundStream > > m_source_audio_streams
 
std::shared_ptr< Buffers::VKBuffer > m_source_graphics_buffer
 
std::vector< std::shared_ptr< Buffers::VKBuffer > > m_source_graphics_buffers
 
std::shared_ptr< Kakshya::VideoStreamContainer > m_source_graphics_stream
 
std::vector< std::shared_ptr< Kakshya::DynamicVideoStream > > m_source_graphics_streams
 
std::vector< std::shared_ptr< Core::VKImage > > m_source_images
 
uint64_t m_start_frame {}
 
std::string m_tag
 
std::shared_ptr< Buffers::AudioBuffer > m_target_audio_buffer
 
uint32_t m_target_audio_channel {}
 
std::shared_ptr< Kakshya::DynamicSoundStream > m_target_audio_stream
 
std::shared_ptr< Buffers::VKBuffer > m_target_graphics_buffer
 
std::shared_ptr< Kakshya::DynamicVideoStream > m_target_graphics_stream
 
uint32_t m_target_layer {}
 
Buffers::ProcessingToken m_token { Buffers::ProcessingToken::AUDIO_BACKEND }
 
TransformationFunction m_transformer
 
OpType m_type
 

Friends

class BufferPipeline
 

Detailed Description

Fundamental unit of operation in buffer processing pipelines.

BufferOperation encapsulates discrete processing steps that can be composed into complex data flow pipelines. Each operation represents a specific action such as capturing data, transforming it, routing to destinations, or applying conditional logic. Operations are designed to be chainable and support sophisticated scheduling and priority management.

Operation Types:

  • CAPTURE: Extract data from a buffer using configurable capture strategies
  • TRANSFORM: Apply functional transformations to data variants
  • ROUTE: Direct data to audio or graphics buffers and streams
  • LOAD: Read data from containers into buffers with position control
  • SYNC: Coordinate timing and synchronization across pipeline stages
  • CONDITION: Apply conditional logic and branching to data flow
  • DISPATCH: Send data to external handlers and callback systems
  • FUSE: Combine multiple data sources using custom fusion functions

Example Usage:

// Capture audio with windowed analysis
auto capture_op = BufferOperation::capture_from(input_buffer)
.with_window(512, 0.5f)
.on_data_ready([](const auto& data, uint32_t cycle) {
analyze_spectrum(data);
});
// Transform and route to output
auto pipeline = BufferPipeline()
>> capture_op
>> BufferOperation::transform([](const auto& data, uint32_t cycle) {
return apply_reverb(data);
static BufferOperation route_to_container(std::shared_ptr< Kakshya::DynamicSoundStream > target, uint32_t channel=0)
Create a routing operation to DynamicSoundStream destination.
static BufferOperation transform(TransformationFunction transformer, Buffers::ProcessingToken token=Buffers::ProcessingToken::AUDIO_BACKEND)
Create a transform operation with custom transformation function.
static CaptureBuilder capture_from(std::shared_ptr< Buffers::AudioBuffer > buffer)
Create a CaptureBuilder for fluent capture configuration.
CaptureBuilder & on_data_ready(OperationFunction callback)
Set data ready callback.
Definition Capture.cpp:160
CaptureBuilder & with_window(uint32_t window_size, float overlap_ratio=0.0F)
Configure windowed capture (enables WINDOWED mode).
Definition Capture.cpp:154
@ AUDIO_BACKEND
Standard audio processing backend configuration.

Definition at line 147 of file BufferOperation.hpp.


The documentation for this class was generated from the following files: