# HG changeset patch # User cigaes # Date 1287433627 0 # Node ID fbee56276c87220321e1320d26a46598df114d27 # Parent 0b221d9da48e30e9c04bb7045cec4f0db5a8b5f5 Add a flag "initialized" to the mp_eosd_source structure. Use it to always init the ASS source on new files. diff -r 0b221d9da48e -r fbee56276c87 ass_mp.c --- a/ass_mp.c Mon Oct 18 15:00:17 2010 +0000 +++ b/ass_mp.c Mon Oct 18 20:27:07 2010 +0000 @@ -327,11 +327,12 @@ long long ts_ms = (ts + sub_delay) * 1000 + .5; ASS_Image *aimg; struct mp_eosd_image *img; - if (res->changed) { + if (res->changed || !src->initialized) { double dar = (double) (res->w - res->ml - res->mr) / (res->h - res->mt - res->mb); ass_configure(ass_renderer, res->w, res->h, res->unscaled); ass_set_margins(ass_renderer, res->mt, res->mb, res->ml, res->mr); ass_set_aspect_ratio(ass_renderer, dar, (double)res->srcw / res->srch); + src->initialized = 1; } aimg = sub_visibility && ass_track && ts != MP_NOPTS_VALUE ? ass_mp_render_frame(ass_renderer, ass_track, ts_ms, &src->changed) : diff -r 0b221d9da48e -r fbee56276c87 eosd.c --- a/eosd.c Mon Oct 18 15:00:17 2010 +0000 +++ b/eosd.c Mon Oct 18 20:27:07 2010 +0000 @@ -42,6 +42,7 @@ prev = &p->priv_next; src->priv_next = p; *prev = src; + src->initialized = 0; } int eosd_registered(struct mp_eosd_source *source) @@ -87,9 +88,12 @@ void eosd_uninit(void) { struct mp_eosd_source *src; - for (src = sources; src; src = src->priv_next) + for (src = sources; src; src = src->priv_next) { + // TODO: maybe only call if src->initialized is set. if (src->uninit) src->uninit(src); + src->initialized = 0; + } } struct mp_eosd_image *eosd_image_alloc(void) diff -r 0b221d9da48e -r fbee56276c87 eosd.h --- a/eosd.h Mon Oct 18 15:00:17 2010 +0000 +++ b/eosd.h Mon Oct 18 20:27:07 2010 +0000 @@ -91,6 +91,13 @@ */ int z_index; + /** + * Initialized flag of the source. + * Set by the source, automatically cleared when a source is added, + * removed or reinitialized. + */ + int initialized; + struct mp_eosd_source *priv_next; };