diff options
Diffstat (limited to 'libhb/sync.c')
-rw-r--r-- | libhb/sync.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index 7bd712022..17a0e73bd 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -2639,7 +2639,20 @@ static hb_buffer_t * merge_ssa(hb_buffer_t *a, hb_buffer_t *b) } if (text != NULL) { - len = sprintf((char*)buf->data, "%s\n%s", a->data, text); + // Strip trailing CR and/or LF + len = strlen((char*)a->data); + if (len > 0 && a->data[len - 1] == '\n') + { + a->data[len - 1] = 0; + len--; + if (len > 0 && a->data[len - 1] == '\r') + { + a->data[len - 1] = 0; + } + } + // Text subtitles are SSA internally. Use SSA newline code + // and force style reset at beginning of new line. + len = sprintf((char*)buf->data, "%s\\N{\\r}%s", a->data, text); if (len >= 0) buf->size = len + 1; } |