diff options
author | John Stebbins <[email protected]> | 2019-01-07 10:52:28 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-01-14 13:36:08 -0800 |
commit | 1f52f52337028b977a83a0e1061b4cc36918c34f (patch) | |
tree | 7066a5ec5e4bc760ddfac69206eda40611bd7166 /libhb/sync.c | |
parent | 31e676d288bb1be2f1d6096b26159ac92c7e143f (diff) |
ssa: improve SSA to TX3G conversion
We were only applying SSA inline override tags. With this patch we now
parse SSA style descritions in the SSA header and apply them per event.
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; } |