[PATCH] EOSD: add EOSD_Image type, replacing ASS_Image

Grigori Goronzy greg at blackbox
Fri Jul 30 20:41:40 CEST 2010


---
 libass/ass_mp.c  |    5 +++--
 libass/ass_mp.h  |   16 ++++++++++++++--
 libvo/vo_gl.c    |    8 ++++----
 libvo/vo_vdpau.c |    4 ++--
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/libass/ass_mp.c b/libass/ass_mp.c
index a0bf809..2105c56 100644
--- a/libass/ass_mp.c
+++ b/libass/ass_mp.c
@@ -323,12 +323,13 @@ ASS_Library* ass_init(void) {
 
 int ass_force_reload = 0; // flag set if global ass-related settings were changed
 
-ASS_Image* ass_mp_render_frame(ASS_Renderer *priv, ASS_Track* track, long long now, int* detect_change) {
+EOSD_Image* ass_mp_render_frame(ASS_Renderer *priv, ASS_Track* track, long long now, int* detect_change) {
 	if (ass_force_reload) {
 		ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
 		ass_set_use_margins(priv, ass_use_margins);
 		ass_set_font_scale(priv, ass_font_scale);
 		ass_force_reload = 0;
 	}
-	return ass_render_frame(priv, track, now, detect_change);
+	// currently, EOSD_Image and ASS_Image are the same, thus a cast is safe
+	return (EOSD_Image *) ass_render_frame(priv, track, now, detect_change);
 }
diff --git a/libass/ass_mp.h b/libass/ass_mp.h
index d24e750..e7b581c 100644
--- a/libass/ass_mp.h
+++ b/libass/ass_mp.h
@@ -55,12 +55,24 @@ void ass_configure(ASS_Renderer* priv, int w, int h, int hinting);
 void ass_configure_fonts(ASS_Renderer* priv);
 ASS_Library* ass_init(void);
 
+typedef struct eosd_image {
+	int w, h;			// Bitmap width/height
+	int stride;			// Bitmap stride
+	unsigned char *bitmap;		// 1bpp stride*h alpha buffer
+					// Note: the last row may not be padded to
+					// bitmap stride!
+	uint32_t color;			// Bitmap color and alpha, RGBA
+	int dst_x, dst_y;		// Bitmap placement inside the video frame
+
+	struct eosd_image *next;	// next image, or NULL
+} EOSD_Image;
+
 typedef struct {
-	ASS_Image* imgs;
+	EOSD_Image* imgs;
 	int changed;
 } EOSD_ImageList;
 
 extern int ass_force_reload;
-ASS_Image* ass_mp_render_frame(ASS_Renderer *priv, ASS_Track* track, long long now, int* detect_change);
+EOSD_Image* ass_mp_render_frame(ASS_Renderer *priv, ASS_Track* track, long long now, int* detect_change);
 
 #endif /* LIBASS_MP_H */
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 1fb49d8..2db5d4a 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -313,11 +313,11 @@ static void clearEOSD(void) {
   eosdtex = NULL;
 }
 
-static inline int is_tinytex(ASS_Image *i, int tinytexcur) {
+static inline int is_tinytex(EOSD_Image *i, int tinytexcur) {
   return i->w < TINYTEX_SIZE && i->h < TINYTEX_SIZE && tinytexcur < TINYTEX_MAX;
 }
 
-static inline int is_smalltex(ASS_Image *i, int smalltexcur) {
+static inline int is_smalltex(EOSD_Image *i, int smalltexcur) {
   return i->w < SMALLTEX_SIZE && i->h < SMALLTEX_SIZE && smalltexcur < SMALLTEX_MAX;
 }
 
@@ -342,8 +342,8 @@ static void genEOSD(EOSD_ImageList *imgs) {
   int smalltexcur = 0;
   GLuint *curtex;
   GLint scale_type = scaled_osd ? GL_LINEAR : GL_NEAREST;
-  ASS_Image *img = imgs->imgs;
-  ASS_Image *i;
+  EOSD_Image *img = imgs->imgs;
+  EOSD_Image *i;
 
   if (imgs->changed == 0) // there are elements, but they are unchanged
       return;
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index ce6bf19..ff8cb8f 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -859,8 +859,8 @@ static void generate_eosd(EOSD_ImageList *imgs)
     VdpStatus vdp_st;
     VdpRect destRect;
     int j, found;
-    ASS_Image *img = imgs->imgs;
-    ASS_Image *i;
+    EOSD_Image *img = imgs->imgs;
+    EOSD_Image *i;
 
     // Nothing changed, no need to redraw
     if (imgs->changed == 0)
-- 
1.6.3.2


--------------010602080006060309090402--


More information about the MPlayer-dev-eng mailing list