diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-04 16:53:56 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-04 17:43:24 +0300 |
commit | c919ce3aa9684b88849d5628e629c3a1ac87e40b (patch) | |
tree | e2bf241e5f7de13b4d8a85c28e9c7e91dbfa9e9c /source/blender/editors/space_sequencer | |
parent | 123b64f818da77dfaf3783d88f5c6be8bbd99a87 (diff) |
Fix (unreported) broken export of timecodes in SubRip VSE exporter.
Would write 1.04 seconds as `00:00:01,40` instead of `00:00:01,040`...
Anyway, we already have BLI API for timecodes, much better to add
SubRip timecode format there, heavily simplifies code.
To be backported to final 2.76.
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 3cc0276104e..88a2f386b9b 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3892,24 +3892,15 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) { if (seq->type == SEQ_TYPE_TEXT) { TextVars *data = seq->effectdata; - char timecode_str[32]; - double sec; - int frac; - int len; - fprintf(file, "%d\n", iter++); - sec = FRA2TIME(seq->startdisp); - frac = 1000 * (sec - floor(sec)); - sec = floor(sec); - BLI_timecode_string_from_time(timecode_str, sizeof(timecode_str), 1, sec, FPS, USER_TIMECODE_SMPTE_FULL); - len = strlen(timecode_str); - timecode_str[len - 3] = 0; - fprintf(file, "%s,%d", timecode_str, frac); - sec = FRA2TIME(seq->enddisp); - BLI_timecode_string_from_time(timecode_str, sizeof(timecode_str), 1, sec, FPS, USER_TIMECODE_SMPTE_FULL); - len = strlen(timecode_str); - timecode_str[len - 3] = 0; - fprintf(file, " --> %s,%d\n", timecode_str, frac); - fprintf(file, "%s\n\n", data->text); + char timecode_str_start[32]; + char timecode_str_end[32]; + + BLI_timecode_string_from_time(timecode_str_start, sizeof(timecode_str_start), + -2, FRA2TIME(seq->startdisp), FPS, USER_TIMECODE_SUBRIP); + BLI_timecode_string_from_time(timecode_str_end, sizeof(timecode_str_end), + -2, FRA2TIME(seq->enddisp), FPS, USER_TIMECODE_SUBRIP); + + fprintf(file, "%d\n%s --> %s\n%s\n\n", iter++, timecode_str_start, timecode_str_end, data->text); } } SEQ_END |