summaryrefslogtreecommitdiffstats
path: root/sub/ass_mp.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-28 21:12:18 +0200
committerwm4 <wm4@nowhere>2013-05-30 22:20:02 +0200
commit38bd757e4fd4d87441cdc20777c0cc2eaab85db8 (patch)
tree1d654bb16f375ba998cb17fbd993f4507d60729e /sub/ass_mp.c
parentb44202b69fc4a1dd1659f7940c5f8846d316e0ff (diff)
downloadmpv-38bd757e4fd4d87441cdc20777c0cc2eaab85db8.tar.bz2
mpv-38bd757e4fd4d87441cdc20777c0cc2eaab85db8.tar.xz
sub: remove check_duplicate_plaintext_event()
This was once needed to handle subtitle packages coming from a demuxer, where seeking back might repeat previous events. This doesn't happen anymore, and this code is used to convert complete files. So if there are any duplicate lines, they must have been duplicated in the file, and the old subtitle renderer would have shown them twice as well. Today checking for duplicate events happens in sd_ass.c (and has been for a while). There's no reason to keep this code, and it actually causes trouble. Loading big subtitle files is extremely slow because this makes adding n subtitles O(n^2).
Diffstat (limited to 'sub/ass_mp.c')
-rw-r--r--sub/ass_mp.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 497e307953..f00bf22428 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -102,19 +102,6 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts)
return track;
}
-static int check_duplicate_plaintext_event(ASS_Track *track)
-{
- int i;
- ASS_Event *evt = track->events + track->n_events - 1;
-
- for (i = 0; i < track->n_events - 1; ++i) // ignoring last event, it is the one we are comparing with
- if (track->events[i].Start == evt->Start &&
- track->events[i].Duration == evt->Duration &&
- strcmp(track->events[i].Text, evt->Text) == 0)
- return 1;
- return 0;
-}
-
/**
* \brief Convert subtitle to ASS_Events for the given track
* \param track track
@@ -159,12 +146,6 @@ static int ass_process_subtitle(ASS_Track *track, subtitle *sub)
p -= 2; // remove last "\N"
*p = 0;
- if (check_duplicate_plaintext_event(track)) {
- ass_free_event(track, eid);
- track->n_events--;
- return -1;
- }
-
mp_msg(MSGT_ASS, MSGL_V,
"plaintext event at %" PRId64 ", +%" PRId64 ": %s \n",
(int64_t) event->Start, (int64_t) event->Duration, event->Text);