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

◆ advance_frame()

void FrameAccessProcessor::advance_frame ( uint64_t  frames_to_advance)
private

Advance the frame cursor, respecting loop boundaries.

Parameters
frames_to_advanceNumber of frames to step forward.

Definition at line 258 of file FrameAccessProcessor.cpp.

259{
260 uint64_t new_frame = m_current_frame + frames_to_advance;
261
262 if (new_frame >= m_total_frames) {
263 if (m_looping_enabled) {
264 uint64_t loop_start = 0;
265 uint64_t loop_end = m_total_frames - 1;
266
267 if (!m_loop_region.start_coordinates.empty()) {
268 loop_start = m_loop_region.start_coordinates[0];
269 }
270 if (!m_loop_region.end_coordinates.empty()) {
271 loop_end = m_loop_region.end_coordinates[0];
272 }
273
274 if (loop_end > loop_start) {
275 uint64_t loop_length = loop_end - loop_start + 1;
276 uint64_t overflow = new_frame - m_total_frames;
277 new_frame = loop_start + (overflow % loop_length);
278 } else {
279 new_frame = loop_start;
280 }
281 } else {
282 new_frame = m_total_frames > 0 ? m_total_frames - 1 : 0;
283 }
284 }
285
286 m_current_frame = new_frame;
287
288 if (auto stream = std::dynamic_pointer_cast<StreamContainer>(m_source_container_weak.lock())) {
289 stream->update_read_position_for_channel(0, m_current_frame);
290 }
291}
Core::GlobalStreamInfo stream
Definition Config.cpp:36
std::weak_ptr< SignalSourceContainer > m_source_container_weak
std::vector< uint64_t > end_coordinates
Ending frame index (inclusive)
Definition Region.hpp:78
std::vector< uint64_t > start_coordinates
Starting frame index (inclusive)
Definition Region.hpp:75

References MayaFlux::Kakshya::Region::end_coordinates, m_current_frame, m_loop_region, m_looping_enabled, m_source_container_weak, m_total_frames, MayaFlux::Kakshya::Region::start_coordinates, and stream.

Referenced by process().

+ Here is the caller graph for this function: