ass_mp: add mp_ass_flush_old_events()

This commit is contained in:
Aman Gupta 2016-01-07 13:31:09 -08:00
parent 5053f4cc3f
commit 1781bf26f1
2 changed files with 15 additions and 0 deletions

View File

@ -163,3 +163,17 @@ ASS_Library *mp_ass_init(struct mpv_global *global, struct mp_log *log)
talloc_free(path);
return priv;
}
void mp_ass_flush_old_events(ASS_Track *track, long long ts)
{
int n = 0;
for (; n < track->n_events; n++) {
if ((track->events[n].Start + track->events[n].Duration) >= ts)
break;
ass_free_event(track, n);
track->n_events--;
}
for (int i = 0; n > 0 && i < track->n_events; i++) {
track->events[i] = track->events[i+n];
}
}

View File

@ -44,6 +44,7 @@ struct mpv_global;
struct mp_osd_res;
struct osd_style_opts;
void mp_ass_flush_old_events(ASS_Track *track, long long ts);
void mp_ass_set_style(ASS_Style *style, double res_y,
const struct osd_style_opts *opts);