Mercurial > mplayer.hg
changeset 32397:b3110e526e19
EOSD: add a function to test if a source has already been registered.
Use it to avoid adding the ASS source twice.
author | cigaes |
---|---|
date | Tue, 12 Oct 2010 22:08:46 +0000 |
parents | 6e65cda7f150 |
children | 68722c75c922 |
files | ass_mp.c eosd.c eosd.h |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ass_mp.c Tue Oct 12 16:53:43 2010 +0000 +++ b/ass_mp.c Tue Oct 12 22:08:46 2010 +0000 @@ -374,5 +374,6 @@ if (!ass_renderer) return; ass_configure_fonts(ass_renderer); - eosd_register(&eosd_ass); + if (!eosd_registered(&eosd_ass)) + eosd_register(&eosd_ass); }
--- a/eosd.c Tue Oct 12 16:53:43 2010 +0000 +++ b/eosd.c Tue Oct 12 22:08:46 2010 +0000 @@ -44,6 +44,15 @@ *prev = src; } +int eosd_registered(struct mp_eosd_source *source) +{ + struct mp_eosd_source *p; + for (p = sources; p; p = p->priv_next) + if (p == source) + return 1; + return 0; +} + void eosd_configure(struct mp_eosd_settings *res) { if (res->w != settings.w ||
--- a/eosd.h Tue Oct 12 16:53:43 2010 +0000 +++ b/eosd.h Tue Oct 12 22:08:46 2010 +0000 @@ -142,6 +142,11 @@ void eosd_register(struct mp_eosd_source *source); /** + * Test whether a source has already been registered. + */ +int eosd_registered(struct mp_eosd_source *source); + +/** * Allocate a structure for an EOSD image. */ struct mp_eosd_image *eosd_image_alloc(void);