25 container->mark_ready_for_processing(
true);
28 "ContiguousAccessProcessor attached: {} layout, {} total elements, {} channels",
33 }
catch (
const std::exception& e) {
36 std::source_location::current(),
37 "Failed to attach ContiguousAccessProcessor: {}",
57 std::min<uint64_t>(1024UL, num_frames),
62 if (
auto stream = std::dynamic_pointer_cast<StreamContainer>(container)) {
66 auto stream_positions = stream->get_read_position();
67 if (!stream_positions.empty()) {
77 "ContiguousAccessProcessor validation: Container has no data elements");
82 std::source_location::current(),
83 "Audio output shape must be [frames, channels]");
90 if (frames_requested == 0 || channels_requested == 0) {
92 std::source_location::current(),
93 "Frame and channel counts cannot be zero");
98 std::source_location::current(),
99 "Requested {} frames exceeds available {} samples per channel",
104 if (channels_requested > available_channels) {
106 std::source_location::current(),
107 "Requested {} channels exceeds available {} channels",
114 "Current position size {} doesn't match available channel count {}, resetting positions",
121 "ContiguousAccessProcessor validated: memory layout {}, processing {}×{} blocks, current positions for {} channels",
139 "ContiguousAccessProcessor not prepared for processing");
144 if (!source_container || source_container.get() != container.get()) {
146 "ContiguousAccessProcessor: Source container mismatch or expired");
155 std::vector<uint64_t> region_coords = { min_frame, 0 };
159 auto region_data = container->get_region_data(output_region);
160 auto& processed_data_vector = container->get_processed_data();
163 processed_data_vector.resize(1);
164 if (!region_data.empty()) {
168 uint64_t channels_to_process = std::min(
m_output_shape[1],
static_cast<uint64_t
>(region_data.size()));
169 processed_data_vector.resize(channels_to_process);
171 for (
size_t ch = 0; ch < channels_to_process; ++ch) {
186 if (
auto stream = std::dynamic_pointer_cast<StreamContainer>(container)) {
192 }
catch (
const std::exception& e) {
194 "Error during ContiguousAccessProcessor processing: {}",
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
void set_output_size(const std::vector< uint64_t > &shape)
Set the output buffer size (shape) for each processing call.
void on_detach(const std::shared_ptr< SignalSourceContainer > &container) override
Detach the processor from its container.
void validate()
Validate the container's structure and output configuration.
std::vector< uint64_t > m_output_shape
uint64_t m_total_elements
std::chrono::steady_clock::time_point m_last_process_time
void on_attach(const std::shared_ptr< SignalSourceContainer > &container) override
Attach the processor to a signal source container.
std::atomic< bool > m_is_processing
ContainerDataStructure m_structure
void store_metadata(const std::shared_ptr< SignalSourceContainer > &container)
Store dimension and layout metadata from the container.
void process(const std::shared_ptr< SignalSourceContainer > &container) override
Process the current region or block of data.
std::weak_ptr< SignalSourceContainer > m_source_container_weak
std::vector< uint64_t > m_current_position
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ ERROR
Container is in an error state and cannot proceed.
@ PROCESSED
Container has completed processing and results are available.
std::vector< uint64_t > advance_position(const std::vector< uint64_t > ¤t_positions, uint64_t frames_to_advance, const ContainerDataStructure &structure, bool looping_enabled, const Region &loop_region)
Advance current positions by a number of frames, with optional looping.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo)
void safe_copy_data_variant(const DataVariant &input, DataVariant &output)
Safely copy data from a DataVariant to another DataVariant, handling type conversion.
Region calculate_output_region(const std::vector< uint64_t > ¤t_pos, const std::vector< uint64_t > &output_shape)
Calculate output region bounds from current position and shape.
static uint64_t get_channel_count(const std::vector< DataDimension > &dimensions)
Extract channel count from dimensions.
OrganizationStrategy organization
static uint64_t get_samples_count_per_channel(const std::vector< DataDimension > &dimensions)
Get samples per channel (time dimension only).
static uint64_t get_total_elements(const std::vector< DataDimension > &dimensions)
Get total elements across all dimensions.
Represents a point or span in N-dimensional space.