Extract the current frame(s) into the container's processed_data.
130{
133 "FrameAccessProcessor not prepared for processing");
134 return;
135 }
136
138 if (!source_container || source_container.get() != container.get()) {
140 "FrameAccessProcessor: source container mismatch or expired");
141 return;
142 }
143
146
147 try {
150
155 }
157 }
158
159 if (frames_to_extract == 0) {
161 return;
162 }
163
164 auto video_container = std::dynamic_pointer_cast<VideoStreamContainer>(source_container);
165 if (!video_container) {
167 "FrameAccessProcessor: container is not a VideoStreamContainer");
169 return;
170 }
171
173
174 auto& processed_data_vector = container->get_processed_data();
175 processed_data_vector.resize(1);
176
177 auto* dest = std::get_if<std::vector<uint8_t>>(&processed_data_vector[0]);
178 if (!dest) {
179 processed_data_vector[0] = std::vector<uint8_t>();
180 dest = std::get_if<std::vector<uint8_t>>(&processed_data_vector[0]);
181 }
182 dest->resize(byte_count);
183
184 uint8_t* write_ptr = dest->data();
185 bool all_ok = true;
186
187 for (uint64_t i = 0; i < frames_to_extract; ++i) {
189 if (pixels.empty()) {
191 all_ok = false;
192 } else {
194 }
196 }
197
198 if (!all_ok) {
200 "FrameAccessProcessor: one or more frames unavailable at frame {}",
202 }
203
205 if (!all_ok) {
207 "FrameAccessProcessor: auto-advance enabled but frame data was incomplete. Waiting for next process call without advancing frame.");
208 }
212 if (frames_to_advance > 0) {
215 }
216 } else {
218 }
219 }
220
221 } catch (const std::exception& e) {
223 "FrameAccessProcessor::process failed: {}", e.what());
224 }
225
227}
#define MF_RT_ERROR(comp, ctx,...)
std::chrono::steady_clock::time_point m_last_process_time
void advance_frame(uint64_t frames_to_advance)
Advance the frame cursor, respecting loop boundaries.
uint64_t m_frame_byte_size
std::weak_ptr< SignalSourceContainer > m_source_container_weak
uint64_t m_frames_per_batch
double m_frame_accumulator
Sub-frame accumulator for wall-clock-driven advancement.
double m_frame_rate
Cached video frame rate in frames per second.
std::atomic< bool > m_is_processing
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
std::vector< uint64_t > start_coordinates
Starting frame index (inclusive)