changeset 32460:d80bbc5868de

Move eosd.[ch] to the sub directory. Remove a duplicate include of eosd.h.
author cigaes
date Wed, 27 Oct 2010 17:03:26 +0000
parents 1a605463f62b
children bc43cf7638e6
files Makefile ass_mp.c command.c eosd.c eosd.h libmpcodecs/dec_video.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c libvo/vo_gl.c libvo/vo_vdpau.c mencoder.c mplayer.c sub/eosd.c sub/eosd.h
diffstat 14 files changed, 386 insertions(+), 388 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Oct 27 16:58:23 2010 +0000
+++ b/Makefile	Wed Oct 27 17:03:26 2010 +0000
@@ -335,7 +335,6 @@
               codec-cfg.c \
               cpudetect.c \
               edl.c \
-              eosd.c \
               fmt-conversion.c \
               m_config.c \
               m_option.c \
@@ -517,6 +516,7 @@
               stream/stream_mf.c \
               stream/stream_null.c \
               stream/url.c \
+              sub/eosd.c \
               sub/find_sub.c \
               sub/spudec.c \
               sub/sub_cc.c \
--- a/ass_mp.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/ass_mp.c	Wed Oct 27 17:03:26 2010 +0000
@@ -28,7 +28,7 @@
 #include "sub/subreader.h"
 
 #include "ass_mp.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 #include "mpcommon.h"
 #include "libvo/sub.h"
 #include "help_mp.h"
--- a/command.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/command.c	Wed Oct 27 17:03:26 2010 +0000
@@ -62,7 +62,7 @@
 #include "m_struct.h"
 #include "libmenu/menu.h"
 #include "gui/interface.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 #include "pnm_loader.h"
 
 #include "mp_core.h"
--- a/eosd.c	Wed Oct 27 16:58:23 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
- * Extended On Screen Display
- * Copyright (C) 2010 Nicolas George
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "mpcommon.h"
-#include "libmpcodecs/vf.h"
-#include "libvo/video_out.h"
-#include "libvo/sub.h"
-#include "ass_mp.h"
-#include "eosd.h"
-
-static struct mp_eosd_source *sources;
-static struct mp_eosd_settings settings;
-static struct mp_eosd_image *image_pool;
-
-void eosd_init(vf_instance_t *vf)
-{
-    vf->control(vf, VFCTRL_INIT_EOSD, NULL);
-}
-
-void eosd_register(struct mp_eosd_source *src)
-{
-    struct mp_eosd_source *p, **prev = &sources;
-    for (p = sources; p && p->z_index < src->z_index; p = p->priv_next)
-        prev = &p->priv_next;
-    src->priv_next = p;
-    *prev          = src;
-    src->initialized = 0;
-}
-
-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        ||
-        res->h        != settings.h        ||
-        res->srcw     != settings.srcw     ||
-        res->srch     != settings.srch     ||
-        res->mt       != settings.mt       ||
-        res->mt       != settings.mb       ||
-        res->mt       != settings.ml       ||
-        res->mt       != settings.mr       ||
-        res->unscaled != settings.unscaled) {
-        settings         = *res;
-        settings.changed = 1;
-    }
-}
-
-void eosd_render_frame(double ts, struct mp_eosd_image_list *images)
-{
-    struct mp_eosd_source *src;
-    int changed = 0;
-    for (src = sources; src; src = src->priv_next) {
-        if (src->update)
-            src->update(src, &settings, ts);
-        changed |= src->changed;
-        src->changed = 0;
-    }
-    settings.changed = 0;
-    images->first_source = sources;
-    images->changed      = changed;
-}
-
-void eosd_uninit(void)
-{
-    struct mp_eosd_source *src;
-    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)
-{
-    struct mp_eosd_image *r;
-    if (!image_pool) {
-        const unsigned n_alloc = 127; /* arbitrary */
-        unsigned i;
-        image_pool = calloc(n_alloc, sizeof(*image_pool));
-        for (i = 0; i < n_alloc - 1; i++)
-            image_pool[i].next = image_pool + i + 1;
-        image_pool[i].next = NULL;
-    }
-    r          = image_pool;
-    image_pool = image_pool->next;
-    return r;
-}
-
-void eosd_image_free(struct mp_eosd_image *image)
-{
-    image->next = image_pool;
-    image_pool  = image;
-}
-
-void eosd_image_append(struct mp_eosd_source *source,
-                       struct mp_eosd_image *image)
-{
-    image->next          = NULL;
-    *source->images_tail = image;
-    source->images_tail  = &image->next;
-}
-
-void eosd_image_remove(struct mp_eosd_source *source,
-                       struct mp_eosd_image *image,
-                       struct mp_eosd_image **prev)
-{
-    *prev = image->next;
-    if (!*prev)
-        source->images_tail = prev;
-    eosd_image_free(image);
-}
-
-void eosd_image_remove_all(struct mp_eosd_source *source)
-{
-    struct mp_eosd_image *image;
-
-    while (source->images) {
-        image          = source->images;
-        source->images = source->images->next;
-        eosd_image_free(image);
-    }
-    source->images_tail = &source->images;
-}
-
-static void next_image_in_sources(struct mp_eosd_image_list *images,
-                                  struct mp_eosd_source *src)
-{
-    images->source = src;
-    while (images->source && !images->source->images)
-        images->source = images->source->priv_next;
-    images->image = images->source ? images->source->images : NULL;
-}
-
-struct mp_eosd_image *eosd_image_first(struct mp_eosd_image_list *images)
-{
-    next_image_in_sources(images, images->first_source);
-    return images->image;
-}
-
-struct mp_eosd_image *eosd_image_next(struct mp_eosd_image_list *images)
-{
-    images->image = images->image->next;
-    if (!images->image)
-        next_image_in_sources(images, images->source->priv_next);
-    return images->image;
-}
--- a/eosd.h	Wed Oct 27 16:58:23 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * Extended On Screen Display
- * Copyright (C) 2010 Nicolas George
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_EOSD_H
-#define MPLAYER_EOSD_H
-
-#include <stdint.h>
-#include "libmpcodecs/vf.h"
-
-enum {
-    EOSD_CHANGED_LAYOUT = 0x1,
-    EOSD_CHANGED_BITMAP = 0x2,
-};
-
-struct mp_eosd_settings {
-    int w, h;           ///< screen dimensions, including black borders
-    int srcw, srch;     ///< unscaled source dimensions
-    int mt, mb, ml, mr; ///< borders (top, bottom, left, right)
-    int unscaled;       ///< EOSD objects are rendered at native resolution
-    int changed;        ///< settings have changed since last update
-};
-
-struct mp_eosd_image {
-    struct mp_eosd_image *next; ///< Next image, or NULL
-    uint8_t *bitmap;            ///< 1bpp stride*h alpha buffer
-    void *opaque;               ///< Arbitrary value for the client's use
-    int w, h;                   ///< Bitmap width, height
-    int stride;                 ///< Bitmap stride
-    uint32_t color;             ///< Bitmap color and transparency, RGBT
-                                ///  T is the complement of A (alpha=opacity).
-    int dst_x, dst_y;           ///< Bitmap placement inside the video frame
-};
-
-struct mp_eosd_source {
-
-    /**
-     * Linked list of images element.
-     * The client is responsible for initializing and maintaining this list.
-     * It can alter it at any time in the main MPlayer thread.
-     */
-    struct mp_eosd_image *images;
-
-    /**
-     * Pointer to the next field of the last image, or to images if the list
-     * is empty.
-     * The client is not required to handle this field, but list
-     * manipulation functions (see below) use it.
-     */
-    struct mp_eosd_image **images_tail;
-
-    /**
-     * Callback to update the images. Can be NULL.
-     */
-    void (*update)(struct mp_eosd_source *, const struct mp_eosd_settings *,
-                   double);
-
-    /**
-     * Callback to uninit the source. Can be NULL.
-     */
-    void (*uninit)(struct mp_eosd_source *);
-
-    /**
-     * Changed flags of the images.
-     * The client must set it to a combination of EOSD_CHANGED_* whenever
-     * the images are altered.
-     * The core EOSD system resets it.
-     */
-    int changed;
-
-    /**
-     * Z-index of the images.
-     * Images with a higher Z-index are rendered on top.
-     */
-    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;
-};
-
-struct mp_eosd_image_list {
-    struct mp_eosd_source *first_source;
-    struct mp_eosd_source *source;
-    struct mp_eosd_image *image;
-    int changed;
-};
-
-/**
- * Initialize the EOSD subsystem.
- *
- * @param vf  the video filter chain where the rendering will take place.
- */
-void eosd_init(vf_instance_t *vf);
-
-/**
- * Configure the resolution for EOSD rendering.
- * Should be called by the rendering engine whenever the resolution or
- * settings change.
- *
- * @param res      resolution and margins of the rendering area.
- */
-void eosd_configure(struct mp_eosd_settings *res);
-
-/**
- * Renders the EOSD elements for the current frame.
- * Should be called by the rendering engine when it is about to do or
- * prepare the rendering.
- *
- * @param[in]  ts      presentation timestamp of the frame.
- * @param[out] images  list of images to render.
- *                     The list and list elements are only valid until any
- *                     client alter them.
- *                     The renderer should therefore not call anything that
- *                     may alter the EOSD elements.
- */
-void eosd_render_frame(double ts, struct mp_eosd_image_list *images);
-
-/**
- * Shut down the EOSD subsystem and free the associated resources.
- */
-void eosd_uninit(void);
-
-/**
- * Register a source of EOSD images.
- */
-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);
-
-/**
- * Free a previously allocated structure.
- */
-void eosd_image_free(struct mp_eosd_image *image);
-
-/**
- * Append an image to the list of images associated to a source.
- * This function requires that the images_tail pointer is correctly set.
- */
-void eosd_image_append(struct mp_eosd_source *source,
-                       struct mp_eosd_image *image);
-
-/**
- * Remove an image from the list of images associated to a source.
- * The image structure is freed using eosd_image_free.
- *
- * @param source  source where the image is.
- * @param image   image to remove.
- * @param prev    pointeur to the prev field of the previous image,
- *                or to source->images if this is the first image.
- */
-void eosd_image_remove(struct mp_eosd_source *source,
-                       struct mp_eosd_image *image,
-                       struct mp_eosd_image **prev);
-
-/**
- * Remove all images associated to a source and free the corresponding
- * structures.
- * This function also resets the images_tail pointer.
- */
-void eosd_image_remove_all(struct mp_eosd_source *source);
-
-/**
- * Reset the cursor of an image list and get the first image.
- */
-struct mp_eosd_image *eosd_image_first(struct mp_eosd_image_list *images);
-
-/**
- * Get the next image in an image list.
- * The renderer must NOT use the next field in the image structure.
- */
-struct mp_eosd_image *eosd_image_next(struct mp_eosd_image_list *images);
-
-#endif /* MPLAYER_EOSD_H */
--- a/libmpcodecs/dec_video.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/libmpcodecs/dec_video.c	Wed Oct 27 17:03:26 2010 +0000
@@ -40,7 +40,7 @@
 #include "libmpdemux/stheader.h"
 #include "vd.h"
 #include "vf.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 
 #include "dec_video.h"
 
--- a/libmpcodecs/vf_ass.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/libmpcodecs/vf_ass.c	Wed Oct 27 17:03:26 2010 +0000
@@ -41,7 +41,7 @@
 #include "m_struct.h"
 
 #include "ass_mp.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 
 #define _r(c)  ((c)>>24)
 #define _g(c)  (((c)>>16)&0xFF)
--- a/libmpcodecs/vf_vo.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/libmpcodecs/vf_vo.c	Wed Oct 27 17:03:26 2010 +0000
@@ -28,9 +28,7 @@
 
 #include "libvo/sub.h"
 #include "libvo/video_out.h"
-#include "eosd.h"
-
-#include "eosd.h"
+#include "sub/eosd.h"
 
 //===========================================================================//
 
--- a/libvo/vo_gl.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/libvo/vo_gl.c	Wed Oct 27 17:03:26 2010 +0000
@@ -38,7 +38,7 @@
 #include "gl_common.h"
 #include "aspect.h"
 #include "fastmemcpy.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 
 #ifdef CONFIG_GL_SDL
 #ifdef CONFIG_SDL_SDL_H
--- a/libvo/vo_vdpau.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/libvo/vo_vdpau.c	Wed Oct 27 17:03:26 2010 +0000
@@ -43,7 +43,7 @@
 #include "aspect.h"
 #include "font_load.h"
 #include "sub.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 #include "subopt-helper.h"
 
 #include "libavcodec/vdpau.h"
--- a/mencoder.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/mencoder.c	Wed Oct 27 17:03:26 2010 +0000
@@ -96,7 +96,7 @@
 #include "path.h"
 #include "sub/spudec.h"
 #include "sub/vobsub.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 #include "mencoder.h"
 
 
--- a/mplayer.c	Wed Oct 27 16:58:23 2010 +0000
+++ b/mplayer.c	Wed Oct 27 17:03:26 2010 +0000
@@ -123,7 +123,7 @@
 #include "sub/spudec.h"
 #include "sub/subreader.h"
 #include "sub/vobsub.h"
-#include "eosd.h"
+#include "sub/eosd.h"
 #include "osdep/getch2.h"
 #include "osdep/timer.h"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sub/eosd.c	Wed Oct 27 17:03:26 2010 +0000
@@ -0,0 +1,172 @@
+/*
+ * Extended On Screen Display
+ * Copyright (C) 2010 Nicolas George
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "mpcommon.h"
+#include "libmpcodecs/vf.h"
+#include "libvo/video_out.h"
+#include "libvo/sub.h"
+#include "ass_mp.h"
+#include "sub/eosd.h"
+
+static struct mp_eosd_source *sources;
+static struct mp_eosd_settings settings;
+static struct mp_eosd_image *image_pool;
+
+void eosd_init(vf_instance_t *vf)
+{
+    vf->control(vf, VFCTRL_INIT_EOSD, NULL);
+}
+
+void eosd_register(struct mp_eosd_source *src)
+{
+    struct mp_eosd_source *p, **prev = &sources;
+    for (p = sources; p && p->z_index < src->z_index; p = p->priv_next)
+        prev = &p->priv_next;
+    src->priv_next = p;
+    *prev          = src;
+    src->initialized = 0;
+}
+
+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        ||
+        res->h        != settings.h        ||
+        res->srcw     != settings.srcw     ||
+        res->srch     != settings.srch     ||
+        res->mt       != settings.mt       ||
+        res->mt       != settings.mb       ||
+        res->mt       != settings.ml       ||
+        res->mt       != settings.mr       ||
+        res->unscaled != settings.unscaled) {
+        settings         = *res;
+        settings.changed = 1;
+    }
+}
+
+void eosd_render_frame(double ts, struct mp_eosd_image_list *images)
+{
+    struct mp_eosd_source *src;
+    int changed = 0;
+    for (src = sources; src; src = src->priv_next) {
+        if (src->update)
+            src->update(src, &settings, ts);
+        changed |= src->changed;
+        src->changed = 0;
+    }
+    settings.changed = 0;
+    images->first_source = sources;
+    images->changed      = changed;
+}
+
+void eosd_uninit(void)
+{
+    struct mp_eosd_source *src;
+    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)
+{
+    struct mp_eosd_image *r;
+    if (!image_pool) {
+        const unsigned n_alloc = 127; /* arbitrary */
+        unsigned i;
+        image_pool = calloc(n_alloc, sizeof(*image_pool));
+        for (i = 0; i < n_alloc - 1; i++)
+            image_pool[i].next = image_pool + i + 1;
+        image_pool[i].next = NULL;
+    }
+    r          = image_pool;
+    image_pool = image_pool->next;
+    return r;
+}
+
+void eosd_image_free(struct mp_eosd_image *image)
+{
+    image->next = image_pool;
+    image_pool  = image;
+}
+
+void eosd_image_append(struct mp_eosd_source *source,
+                       struct mp_eosd_image *image)
+{
+    image->next          = NULL;
+    *source->images_tail = image;
+    source->images_tail  = &image->next;
+}
+
+void eosd_image_remove(struct mp_eosd_source *source,
+                       struct mp_eosd_image *image,
+                       struct mp_eosd_image **prev)
+{
+    *prev = image->next;
+    if (!*prev)
+        source->images_tail = prev;
+    eosd_image_free(image);
+}
+
+void eosd_image_remove_all(struct mp_eosd_source *source)
+{
+    struct mp_eosd_image *image;
+
+    while (source->images) {
+        image          = source->images;
+        source->images = source->images->next;
+        eosd_image_free(image);
+    }
+    source->images_tail = &source->images;
+}
+
+static void next_image_in_sources(struct mp_eosd_image_list *images,
+                                  struct mp_eosd_source *src)
+{
+    images->source = src;
+    while (images->source && !images->source->images)
+        images->source = images->source->priv_next;
+    images->image = images->source ? images->source->images : NULL;
+}
+
+struct mp_eosd_image *eosd_image_first(struct mp_eosd_image_list *images)
+{
+    next_image_in_sources(images, images->first_source);
+    return images->image;
+}
+
+struct mp_eosd_image *eosd_image_next(struct mp_eosd_image_list *images)
+{
+    images->image = images->image->next;
+    if (!images->image)
+        next_image_in_sources(images, images->source->priv_next);
+    return images->image;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sub/eosd.h	Wed Oct 27 17:03:26 2010 +0000
@@ -0,0 +1,204 @@
+/*
+ * Extended On Screen Display
+ * Copyright (C) 2010 Nicolas George
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_EOSD_H
+#define MPLAYER_EOSD_H
+
+#include <stdint.h>
+#include "libmpcodecs/vf.h"
+
+enum {
+    EOSD_CHANGED_LAYOUT = 0x1,
+    EOSD_CHANGED_BITMAP = 0x2,
+};
+
+struct mp_eosd_settings {
+    int w, h;           ///< screen dimensions, including black borders
+    int srcw, srch;     ///< unscaled source dimensions
+    int mt, mb, ml, mr; ///< borders (top, bottom, left, right)
+    int unscaled;       ///< EOSD objects are rendered at native resolution
+    int changed;        ///< settings have changed since last update
+};
+
+struct mp_eosd_image {
+    struct mp_eosd_image *next; ///< Next image, or NULL
+    uint8_t *bitmap;            ///< 1bpp stride*h alpha buffer
+    void *opaque;               ///< Arbitrary value for the client's use
+    int w, h;                   ///< Bitmap width, height
+    int stride;                 ///< Bitmap stride
+    uint32_t color;             ///< Bitmap color and transparency, RGBT
+                                ///  T is the complement of A (alpha=opacity).
+    int dst_x, dst_y;           ///< Bitmap placement inside the video frame
+};
+
+struct mp_eosd_source {
+
+    /**
+     * Linked list of images element.
+     * The client is responsible for initializing and maintaining this list.
+     * It can alter it at any time in the main MPlayer thread.
+     */
+    struct mp_eosd_image *images;
+
+    /**
+     * Pointer to the next field of the last image, or to images if the list
+     * is empty.
+     * The client is not required to handle this field, but list
+     * manipulation functions (see below) use it.
+     */
+    struct mp_eosd_image **images_tail;
+
+    /**
+     * Callback to update the images. Can be NULL.
+     */
+    void (*update)(struct mp_eosd_source *, const struct mp_eosd_settings *,
+                   double);
+
+    /**
+     * Callback to uninit the source. Can be NULL.
+     */
+    void (*uninit)(struct mp_eosd_source *);
+
+    /**
+     * Changed flags of the images.
+     * The client must set it to a combination of EOSD_CHANGED_* whenever
+     * the images are altered.
+     * The core EOSD system resets it.
+     */
+    int changed;
+
+    /**
+     * Z-index of the images.
+     * Images with a higher Z-index are rendered on top.
+     */
+    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;
+};
+
+struct mp_eosd_image_list {
+    struct mp_eosd_source *first_source;
+    struct mp_eosd_source *source;
+    struct mp_eosd_image *image;
+    int changed;
+};
+
+/**
+ * Initialize the EOSD subsystem.
+ *
+ * @param vf  the video filter chain where the rendering will take place.
+ */
+void eosd_init(vf_instance_t *vf);
+
+/**
+ * Configure the resolution for EOSD rendering.
+ * Should be called by the rendering engine whenever the resolution or
+ * settings change.
+ *
+ * @param res      resolution and margins of the rendering area.
+ */
+void eosd_configure(struct mp_eosd_settings *res);
+
+/**
+ * Renders the EOSD elements for the current frame.
+ * Should be called by the rendering engine when it is about to do or
+ * prepare the rendering.
+ *
+ * @param[in]  ts      presentation timestamp of the frame.
+ * @param[out] images  list of images to render.
+ *                     The list and list elements are only valid until any
+ *                     client alter them.
+ *                     The renderer should therefore not call anything that
+ *                     may alter the EOSD elements.
+ */
+void eosd_render_frame(double ts, struct mp_eosd_image_list *images);
+
+/**
+ * Shut down the EOSD subsystem and free the associated resources.
+ */
+void eosd_uninit(void);
+
+/**
+ * Register a source of EOSD images.
+ */
+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);
+
+/**
+ * Free a previously allocated structure.
+ */
+void eosd_image_free(struct mp_eosd_image *image);
+
+/**
+ * Append an image to the list of images associated to a source.
+ * This function requires that the images_tail pointer is correctly set.
+ */
+void eosd_image_append(struct mp_eosd_source *source,
+                       struct mp_eosd_image *image);
+
+/**
+ * Remove an image from the list of images associated to a source.
+ * The image structure is freed using eosd_image_free.
+ *
+ * @param source  source where the image is.
+ * @param image   image to remove.
+ * @param prev    pointeur to the prev field of the previous image,
+ *                or to source->images if this is the first image.
+ */
+void eosd_image_remove(struct mp_eosd_source *source,
+                       struct mp_eosd_image *image,
+                       struct mp_eosd_image **prev);
+
+/**
+ * Remove all images associated to a source and free the corresponding
+ * structures.
+ * This function also resets the images_tail pointer.
+ */
+void eosd_image_remove_all(struct mp_eosd_source *source);
+
+/**
+ * Reset the cursor of an image list and get the first image.
+ */
+struct mp_eosd_image *eosd_image_first(struct mp_eosd_image_list *images);
+
+/**
+ * Get the next image in an image list.
+ * The renderer must NOT use the next field in the image structure.
+ */
+struct mp_eosd_image *eosd_image_next(struct mp_eosd_image_list *images);
+
+#endif /* MPLAYER_EOSD_H */