sub: cache subtitle state per track instead of per demuxer stream

Since commit 6d9cb893, subtitle state doesn't survive timeline switches
(ordered chapters etc.). So there is no point in caching the state per
sh_stream anymore (which would be required to deal with multiple
segments). Move the cache to struct track.

(Whether it's worth caching the subtitle state just for the situation
when subtitle tracks get reselected is questionable. But for now, it's
nice to have the subtitles immediately show up when reselecting a
subtitle.)
This commit is contained in:
wm4
2015-12-26 18:32:27 +01:00
parent 504286b006
commit ce8524cb47
6 changed files with 31 additions and 49 deletions

View File

@@ -510,18 +510,13 @@ static void fill_plaintext(struct sd *sd, double pts)
track->styles[track->default_style].Alignment = ctx->on_top ? 6 : 2;
}
static void clear(struct sd *sd)
{
struct sd_ass_priv *ctx = sd->priv;
ass_flush_events(ctx->ass_track);
ctx->num_seen_packets = 0;
}
static void reset(struct sd *sd)
{
struct sd_ass_priv *ctx = sd->priv;
if (sd->opts->sub_clear_on_seek)
clear(sd);
if (sd->opts->sub_clear_on_seek) {
ass_flush_events(ctx->ass_track);
ctx->num_seen_packets = 0;
}
if (ctx->converter)
lavc_conv_reset(ctx->converter);
}
@@ -554,9 +549,6 @@ static int control(struct sd *sd, enum sd_ctrl cmd, void *arg)
case SD_CTRL_SET_TOP:
ctx->on_top = *(bool *)arg;
return CONTROL_OK;
case SD_CTRL_CLEAR:
clear(sd);
return CONTROL_OK;
default:
return CONTROL_UNKNOWN;
}