[MPlayer-cvslog] r32483 - in trunk: ass_mp.c eosd.c eosd.h

cigaes subversion at mplayerhq.hu
Wed Oct 13 00:08:46 CEST 2010


Author: cigaes
Date: Wed Oct 13 00:08:46 2010
New Revision: 32483

Log:
EOSD: add a function to test if a source has already been registered.
Use it to avoid adding the ASS source twice.

Modified:
   trunk/ass_mp.c
   trunk/eosd.c
   trunk/eosd.h

Modified: trunk/ass_mp.c
==============================================================================
--- trunk/ass_mp.c	Tue Oct 12 18:53:43 2010	(r32482)
+++ trunk/ass_mp.c	Wed Oct 13 00:08:46 2010	(r32483)
@@ -374,5 +374,6 @@ void eosd_ass_init(ASS_Library *ass_libr
 	if (!ass_renderer)
 		return;
 	ass_configure_fonts(ass_renderer);
-	eosd_register(&eosd_ass);
+	if (!eosd_registered(&eosd_ass))
+		eosd_register(&eosd_ass);
 }

Modified: trunk/eosd.c
==============================================================================
--- trunk/eosd.c	Tue Oct 12 18:53:43 2010	(r32482)
+++ trunk/eosd.c	Wed Oct 13 00:08:46 2010	(r32483)
@@ -44,6 +44,15 @@ void eosd_register(struct mp_eosd_source
     *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        ||

Modified: trunk/eosd.h
==============================================================================
--- trunk/eosd.h	Tue Oct 12 18:53:43 2010	(r32482)
+++ trunk/eosd.h	Wed Oct 13 00:08:46 2010	(r32483)
@@ -142,6 +142,11 @@ void eosd_uninit(void);
 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);


More information about the MPlayer-cvslog mailing list