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.
This commit is contained in:
wm4 2013-09-24 23:10:35 +02:00
parent fdd5140f43
commit 1dbb73e0fb
1 changed files with 0 additions and 48 deletions

View File

@ -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;