Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2022-06-29 13:45:59 +0300
committerRichard Antalik <richardantalik@gmail.com>2022-06-29 13:48:34 +0300
commit302b04a5a3fc0e767ac784424f78ce2edf5d2844 (patch)
treedef4de621fbb0a194b350da781f054c6aefbab35 /source/blender/sequencer/intern/strip_add.c
parentc51b8ec86364585c4088837c603b39752065bc34 (diff)
VSE: Improved Retiming system
Patch implements better way to control playback speed than it is possible to do with speed effect. Speed factor property can be set in Time panel. There are 2 layers of control: Option to retime movie to match scene FPS rate. Custom speed factor to control playback rate. Since playback rate is strip property, it is now possible to manipulate strip as normal one even if it is retimed. To facilitate manipulation, some functions need to consider speed factor and apply necessary corrections to strip offset or strip start. These corrections may need to be float numbers, so start and offsets must be float as well. Sound strips now use speed factor instead of pitch. This means, that strips will change length to match usable length. In addition, it is possible to group movie and sound strip and change speed of meta strip.
Diffstat (limited to 'source/blender/sequencer/intern/strip_add.c')
-rw-r--r--source/blender/sequencer/intern/strip_add.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c
index 4f0b2e38f56..753a6ee39e0 100644
--- a/source/blender/sequencer/intern/strip_add.c
+++ b/source/blender/sequencer/intern/strip_add.c
@@ -181,7 +181,7 @@ Sequence *SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, struct SeqLoadDa
seq_add_set_name(scene, seq, load_data);
seq_add_generic_update(scene, seq);
- seq_time_effect_range_set(seq);
+ seq_time_effect_range_set(scene, seq);
return seq;
}
@@ -191,9 +191,10 @@ void SEQ_add_image_set_directory(Sequence *seq, char *path)
BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));
}
-void SEQ_add_image_load_file(Sequence *seq, size_t strip_frame, char *filename)
+void SEQ_add_image_load_file(Scene *scene, Sequence *seq, size_t strip_frame, char *filename)
{
- StripElem *se = SEQ_render_give_stripelem(seq, seq->start + strip_frame);
+ StripElem *se = SEQ_render_give_stripelem(
+ scene, seq, SEQ_time_start_frame_get(seq) + strip_frame);
BLI_strncpy(se->name, filename, sizeof(se->name));
}
@@ -468,9 +469,19 @@ Sequence *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqL
orig_height = IMB_anim_get_image_height(anim_arr[0]);
SEQ_set_scale_to_fit(
seq, orig_width, orig_height, scene->r.xsch, scene->r.ysch, load_data->fit_method);
+
+ short frs_sec;
+ float frs_sec_base;
+ if (IMB_anim_get_fps(anim_arr[0], &frs_sec, &frs_sec_base, true)) {
+ seq->media_playback_rate = (float)frs_sec / frs_sec_base;
+ }
}
seq->len = MAX2(1, seq->len);
+ if (load_data->adjust_playback_rate) {
+ seq->flag |= SEQ_AUTO_PLAYBACK_RATE;
+ }
+
BLI_strncpy(seq->strip->colorspace_settings.name,
colorspace,
sizeof(seq->strip->colorspace_settings.name));
@@ -511,8 +522,8 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo
if (lock_range) {
/* keep so we don't have to move the actual start and end points (only the data) */
- prev_startdisp = SEQ_time_left_handle_frame_get(seq);
- prev_enddisp = SEQ_time_right_handle_frame_get(seq);
+ prev_startdisp = SEQ_time_left_handle_frame_get(scene, seq);
+ prev_enddisp = SEQ_time_right_handle_frame_get(scene, seq);
}
switch (seq->type) {