diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2021-07-06 20:48:06 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2021-08-16 16:10:58 +0300 |
commit | ded68fb10275c9f9a66e7019171b83cab0e9485d (patch) | |
tree | 8a7d8ad343433070b79f6bceec92871c564da1ec /source/blender/editors/space_sequencer/sequencer_draw.c | |
parent | 6df81ddb84c60876ac3ebd87d1d134109f34eabd (diff) |
VSE: Fix audaspace not reading ffmpeg files with start offset correctly
The duration and start time for audio strips were not correctly read in
audaspace.
Some video files have a "lead in" section of audio that plays before the
video starts playing back. Before this patch, we would play this lead in
audio at the same time as the video started and thus the audio would not
be in sync anymore.
Now the lead in audio is cut off and the duration should be correctly
calculated with this in mind.
If the audio starts after the video, the audio strip is shifted to
account for this, but it will also lead to cut off audio which might not
be wanted. However we don't have a simple way to solve this at this
point.
Differential Revision: http://developer.blender.org/D11917
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_draw.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 0472e1264ce..e49a88c88d2 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -284,10 +284,12 @@ static void draw_seq_waveform_overlay(View2D *v2d, return; } - startsample = floor((seq->startofs + seq->anim_startofs) / FPS * - SOUND_WAVE_SAMPLES_PER_SECOND); - endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS * - SOUND_WAVE_SAMPLES_PER_SECOND); + startsample = (seq->startofs + seq->anim_startofs) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND; + startsample += seq->sound->offset_time * SOUND_WAVE_SAMPLES_PER_SECOND; + + endsample = (seq->enddisp - seq->startdisp) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND; + endsample += startsample; + samplestep = (endsample - startsample) * stepsize / (x2 - x1); length = min_ii( |