Mercurial > mplayer.hg
changeset 34486:6e2b26c5d6de
Eliminate duplicate subtitle lines which will most likely
be artefacts from ASS effects.
author | reimar |
---|---|
date | Sun, 15 Jan 2012 12:08:26 +0000 |
parents | 78e6943b7764 |
children | ebf95780af6e |
files | sub/subreader.c |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/sub/subreader.c Sun Jan 15 11:18:13 2012 +0000 +++ b/sub/subreader.c Sun Jan 15 12:08:26 2012 +0000 @@ -2565,6 +2565,16 @@ if (sub->lines < SUB_MAX_TEXT && strlen(sub->text[sub->lines])) sub->lines++; + if (sub->lines > 1 && + strcmp(sub->text[sub->lines-1], sub->text[sub->lines-2]) == 0) { + // remove duplicate lines. These can happen with some + // "clever" ASS effects. + sub->lines--; + sub->endpts[sub->lines-1] = + FFMAX(sub->endpts[sub->lines-1], + sub->endpts[sub->lines]); + free(sub->text[sub->lines]); + } #ifdef CONFIG_FRIBIDI sub = sub_fribidi(sub, sub_utf8, orig_lines); #endif