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
path: root/source
diff options
context:
space:
mode:
authorPaul Golter <pullpullson>2021-07-01 13:21:31 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-07-01 13:21:31 +0300
commit229c0580e2915b2dc349069ee7094d322408641f (patch)
treefac838af01b343a409086c9566ef10b2798ee73f /source
parent96d487b3ae112281290cfea8314771df55d0843d (diff)
Fix: Export subtitles timecode relative to scene start frame, ignore muted strips
This patch writes the timecode in the .srt file relative to the start frame of the scene. If the timecode is global but scene does not start at frame 0 the subtitles don't match if they get loaded in an external video player. Muted strips will be ignored. Don't allow negative timecodes in .srt. Reviewed By: Richard Antalik Differential Revision: http://developer.blender.org/D11762
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 25009532dd0..48b8a1b87a3 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2984,8 +2984,10 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ /* Only text strips that are not muted and don't end with negative frame. */
SEQ_ALL_BEGIN (ed, seq) {
- if (seq->type == SEQ_TYPE_TEXT) {
+ if ((seq->type == SEQ_TYPE_TEXT) && ((seq->flag & SEQ_MUTE) == 0) &&
+ (seq->enddisp > scene->r.sfra)) {
BLI_addtail(&text_seq, MEM_dupallocN(seq));
}
}
@@ -3006,16 +3008,17 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
char timecode_str_start[32];
char timecode_str_end[32];
+ /* Write timecode relative to start frame of scene. Don't allow negative timecodes. */
BLI_timecode_string_from_time(timecode_str_start,
sizeof(timecode_str_start),
-2,
- FRA2TIME(seq->startdisp),
+ FRA2TIME(max_ii(seq->startdisp - scene->r.sfra, 0)),
FPS,
USER_TIMECODE_SUBRIP);
BLI_timecode_string_from_time(timecode_str_end,
sizeof(timecode_str_end),
-2,
- FRA2TIME(seq->enddisp),
+ FRA2TIME(seq->enddisp - scene->r.sfra),
FPS,
USER_TIMECODE_SUBRIP);