diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-04 06:36:36 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-23 13:41:04 +0300 |
commit | 8716df2a41f6ff05f59577a0433401ea141226f3 (patch) | |
tree | 491d1c9e1cf862294283335ade557100c2181baf /libvo | |
parent | 2bcfe1e077fe043751d3f7c73c82be761629419f (diff) | |
download | mpv-8716df2a41f6ff05f59577a0433401ea141226f3.tar.bz2 mpv-8716df2a41f6ff05f59577a0433401ea141226f3.tar.xz |
Add context variable to vo_draw_text callback
Add a context variable and rename the function to osd_draw_text. Create
a new vo_draw_text that is a wrapper for VOs using old API.
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/old_vo_wrapper.c | 16 | ||||
-rw-r--r-- | libvo/old_vo_wrapper.h | 2 | ||||
-rw-r--r-- | libvo/sub.c | 17 | ||||
-rw-r--r-- | libvo/sub.h | 2 | ||||
-rw-r--r-- | libvo/vo_directx.c | 1 | ||||
-rw-r--r-- | libvo/vo_macosx.m | 1 | ||||
-rw-r--r-- | libvo/vo_quartz.c | 2 |
7 files changed, 29 insertions, 12 deletions
diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c index b52622321a..d4af6fcc10 100644 --- a/libvo/old_vo_wrapper.c +++ b/libvo/old_vo_wrapper.c @@ -20,6 +20,7 @@ #include <stdint.h> #include "old_vo_wrapper.h" #include "video_out.h" +#include "sub.h" int old_vo_preinit(struct vo *vo, const char *arg) { @@ -78,3 +79,18 @@ void old_vo_uninit(struct vo *vo) vo->driver->old_functions->uninit(); } + +static void draw_alpha_wrapper(void *ctx, int x0, int y0, int w, int h, + unsigned char *src, unsigned char *srca, + int stride) +{ + void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) = ctx; + draw_alpha(x0, y0, w, h, src, srca, stride); +} + + +void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) +{ + osd_draw_text(dxs, dys, draw_alpha_wrapper, draw_alpha); +} + diff --git a/libvo/old_vo_wrapper.h b/libvo/old_vo_wrapper.h index e6d20ce5ca..8c89790b85 100644 --- a/libvo/old_vo_wrapper.h +++ b/libvo/old_vo_wrapper.h @@ -17,4 +17,6 @@ void old_vo_flip_page(struct vo *vo); void old_vo_check_events(struct vo *vo); void old_vo_uninit(struct vo *vo); +void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); + #endif diff --git a/libvo/sub.c b/libvo/sub.c index aeb68d216b..3330baa718 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -154,9 +154,11 @@ static void alloc_buf(mp_osd_obj_t* obj) } // renders the buffer -inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ +inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx) +{ if (obj->allocated > 0) { - draw_alpha(obj->bbox.x1,obj->bbox.y1, + draw_alpha(ctx, + obj->bbox.x1,obj->bbox.y1, obj->bbox.x2-obj->bbox.x1, obj->bbox.y2-obj->bbox.y1, obj->bitmap_buffer, @@ -1022,9 +1024,9 @@ inline static void vo_update_spudec_sub(mp_osd_obj_t* obj, int dxs, int dys) obj->flags |= OSDFLAG_BBOX; } -inline static void vo_draw_spudec_sub(mp_osd_obj_t* obj, void (*draw_alpha)(int x0, int y0, int w, int h, unsigned char* src, unsigned char* srca, int stride)) +inline static void vo_draw_spudec_sub(mp_osd_obj_t* obj, void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h, unsigned char* src, unsigned char* srca, int stride), void *ctx) { - spudec_draw_scaled(vo_spudec, obj->dxs, obj->dys, draw_alpha); + spudec_draw_scaled(vo_spudec, obj->dxs, obj->dys, draw_alpha, ctx); } void *vo_spudec=NULL; @@ -1223,7 +1225,8 @@ void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)){ } } -void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ +void osd_draw_text(int dxs,int dys,void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx) +{ mp_osd_obj_t* obj=vo_osd_list; vo_update_osd(dxs,dys); while(obj){ @@ -1231,7 +1234,7 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack switch(obj->type){ case OSDTYPE_SPU: - vo_draw_spudec_sub(obj, draw_alpha); // FIXME + vo_draw_spudec_sub(obj, draw_alpha, ctx); // FIXME break; #ifdef USE_DVDNAV case OSDTYPE_DVDNAV: @@ -1242,7 +1245,7 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, case OSDTYPE_OSD: case OSDTYPE_SUBTITLE: case OSDTYPE_PROGBAR: - vo_draw_text_from_buffer(obj,draw_alpha); + vo_draw_text_from_buffer(obj, draw_alpha, ctx); break; } obj->old_bbox=obj->bbox; diff --git a/libvo/sub.h b/libvo/sub.h index f15b4e6c8d..d978935bf2 100644 --- a/libvo/sub.h +++ b/libvo/sub.h @@ -116,7 +116,7 @@ extern float spu_gaussvar; //extern void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); //extern void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); //extern void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); -extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); +extern void osd_draw_text(int dxs,int dys,void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx); extern void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)); void vo_init_osd(void); diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c index a241631bea..5d3bd355e3 100644 --- a/libvo/vo_directx.c +++ b/libvo/vo_directx.c @@ -87,7 +87,6 @@ static float window_aspect; static BOOL (WINAPI* myGetMonitorInfo)(HMONITOR, LPMONITORINFO) = NULL; static RECT last_rect = {0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE}; -extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); extern int vidmode; /***************************************************************************** diff --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m index 04d395ae56..5039fa3283 100644 --- a/libvo/vo_macosx.m +++ b/libvo/vo_macosx.m @@ -81,7 +81,6 @@ static vo_info_t info = LIBVO_EXTERN(macosx) extern void mplayer_put_key(int code); -extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) { diff --git a/libvo/vo_quartz.c b/libvo/vo_quartz.c index 40e704905b..ddaedd8b99 100644 --- a/libvo/vo_quartz.c +++ b/libvo/vo_quartz.c @@ -129,8 +129,6 @@ enum #include "osdep/keycodes.h" -extern void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); - //PROTOTYPE///////////////////////////////////////////////////////////////// static OSStatus KeyEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); static OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData); |