From 1dbb73e0fb4dea1c011c1d079df2502c686e00d9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Sep 2013 23:10:35 +0200 Subject: sd_ass: remove dead code This code was made inactive some months ago. At this time it wasn't entirely clear whether this code was still needed, but now I'm pretty sure it isn't. Even if it is, it didn't work anymore. --- sub/sd_ass.c | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) (limited to 'sub/sd_ass.c') diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 81e1df8dec..9b56eb5046 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -35,14 +35,9 @@ #include "ass_mp.h" #include "sd.h" -// Enable code that treats subtitle events with duration 0 specially, and -// adjust their duration so that they will disappear with the next event. -#define INCOMPLETE_EVENTS 0 - struct sd_ass_priv { struct ass_track *ass_track; bool is_converted; - bool incomplete_event; struct sub_bitmap *parts; bool flush_on_seek; char last_text[500]; @@ -62,13 +57,6 @@ static bool supports_format(const char *format) strcmp(format, "ass-text") == 0); } -static void free_last_event(ASS_Track *track) -{ - assert(track->n_events > 0); - ass_free_event(track, track->n_events - 1); - track->n_events--; -} - static int init(struct sd *sd) { struct MPOpts *opts = sd->opts; @@ -125,38 +113,6 @@ static void decode(struct sd *sd, struct demux_packet *packet) } long long ipts = pts * 1000 + 0.5; long long iduration = duration * 1000 + 0.5; -#if INCOMPLETE_EVENTS - if (ctx->incomplete_event) { - ctx->incomplete_event = false; - ASS_Event *event = track->events + track->n_events - 1; - if (ipts <= event->Start) - free_last_event(track); - else - event->Duration = ipts - event->Start; - } - // Note: we rely on there being guaranteed 0 bytes after data packets - int len = strlen(text); - if (len < 5) { - // Some tracks use a whitespace (but not empty) packet to mark end - // of previous subtitle. - for (int i = 0; i < len; i++) - if (!strchr(" \f\n\r\t\v", text[i])) - goto not_all_whitespace; - return; - } - not_all_whitespace:; - if (!sd->no_remove_duplicates) { - for (int i = 0; i < track->n_events; i++) - if (track->events[i].Start == ipts - && (duration <= 0 || track->events[i].Duration == iduration) - && strcmp(track->events[i].Text, text) == 0) - return; // We've already added this subtitle - } - if (duration <= 0) { - iduration = 10000; - ctx->incomplete_event = true; - } -#else if (duration <= 0) { mp_msg(MSGT_SUBREADER, MSGL_WARN, "Subtitle without duration or " "duration set to 0 at pts %f, ignored\n", pts); @@ -170,7 +126,6 @@ static void decode(struct sd *sd, struct demux_packet *packet) return; // We've already added this subtitle } } -#endif int eid = ass_alloc_event(track); ASS_Event *event = track->events + eid; event->Start = ipts; @@ -320,9 +275,6 @@ static void fix_events(struct sd *sd) static void reset(struct sd *sd) { struct sd_ass_priv *ctx = sd->priv; - if (ctx->incomplete_event) - free_last_event(ctx->ass_track); - ctx->incomplete_event = false; if (ctx->flush_on_seek) ass_flush_events(ctx->ass_track); ctx->flush_on_seek = false; -- cgit v1.2.3