Mercurial > mplayer.hg
changeset 32426:fbee56276c87
Add a flag "initialized" to the mp_eosd_source structure.
Use it to always init the ASS source on new files.
author | cigaes |
---|---|
date | Mon, 18 Oct 2010 20:27:07 +0000 |
parents | 0b221d9da48e |
children | 58232aeb3fdd |
files | ass_mp.c eosd.c eosd.h |
diffstat | 3 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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) :
--- 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)
--- 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; };