int FreezeFrameMain::load_configuration() { KeyFrame *prev_keyframe = get_prev_keyframe(get_source_position()); int64_t prev_position = edl_to_local(prev_keyframe->position); if(prev_position < get_source_start()) prev_position = get_source_start(); read_data(prev_keyframe); // Invalidate stored frame if(config.enabled) first_frame_position = prev_position; return 0; }
int InterpolateVideo::load_configuration() { KeyFrame *prev_keyframe, *next_keyframe; InterpolateVideoConfig old_config; old_config.copy_from(&config); next_keyframe = get_next_keyframe(get_source_position()); prev_keyframe = get_prev_keyframe(get_source_position()); // Previous keyframe stays in config object. read_data(prev_keyframe); int64_t prev_position = edl_to_local(prev_keyframe->position); int64_t next_position = edl_to_local(next_keyframe->position); if(prev_position == 0 && next_position == 0) { next_position = prev_position = get_source_start(); } // printf("InterpolateVideo::load_configuration 1 %lld %lld %lld %lld\n", // prev_keyframe->position, // next_keyframe->position, // prev_position, // next_position); // Get range to average in requested rate range_start = prev_position; range_end = next_position; // Use keyframes to determine range if(config.use_keyframes) { active_input_rate = get_framerate(); // Between keyframe and edge of range or no keyframes if(range_start == range_end) { // Between first keyframe and start of effect if(get_source_position() >= get_source_start() && get_source_position() < range_start) { range_start = get_source_start(); } else // Between last keyframe and end of effect if(get_source_position() >= range_start && get_source_position() < get_source_start() + get_total_len()) { // Last frame should be inclusive of current effect range_end = get_source_start() + get_total_len() - 1; } else { // Should never get here ; } } // Make requested rate equal to input rate for this mode. // Convert requested rate to input rate // printf("InterpolateVideo::load_configuration 2 %lld %lld %f %f\n", // range_start, // range_end, // get_framerate(), // config.input_rate); // range_start = (int64_t)((double)range_start / get_framerate() * active_input_rate + 0.5); // range_end = (int64_t)((double)range_end / get_framerate() * active_input_rate + 0.5); } else // Use frame rate { active_input_rate = config.input_rate; // Convert to input frame rate range_start = (int64_t)(get_source_position() / get_framerate() * active_input_rate); range_end = (int64_t)(get_source_position() / get_framerate() * active_input_rate) + 1; } // printf("InterpolateVideo::load_configuration 1 %lld %lld %lld %lld %lld %lld\n", // prev_keyframe->position, // next_keyframe->position, // prev_position, // next_position, // range_start, // range_end); return !config.equivalent(&old_config); }