From a232f564d3f271277135276281c03cca7807ef16 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 24 Jun 2008 01:53:58 +0300 Subject: Create a context struct for OSD state This commit creates the struct and passes it to some functions that needs to access OSD state but does not yet move much data from globals to it. vf_expand accesses the OSD state for rendering purposes outside of the normal OSD draw time. The way this currently works is suboptimal, but I did not attempt to clean it up now. To keep things working the same way vf_expand needs to know the address of the state object to be able to access the data even in the functions that should normally not need it. For that purpose this commit adds a VFCTRL to tell vf_expand the address of the object. --- libvo/vo_aa.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'libvo/vo_aa.c') diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c index f297e01b71..ca547f0e87 100644 --- a/libvo/vo_aa.c +++ b/libvo/vo_aa.c @@ -86,6 +86,8 @@ static struct SwsContext *sws=NULL; int aaopt_osdcolor = AA_SPECIAL; int aaopt_subcolor = AA_SPECIAL; +static unsigned char vo_osd_text[64]; + void resize(void){ /* @@ -182,15 +184,10 @@ osdpercent(int duration, int deko, int min, int max, int val, const char * desc, static void printosdtext(void) { - if(osd_text_length > 0 && !vo_osd_text) { - memset(c->textbuffer,' ',osd_text_length); - memset(c->attrbuffer,0,osd_text_length); - osd_text_length = 0; - } /* * places the mplayer status osd */ - if (vo_osd_text && vo_osd_text[0] != 0) { + if (vo_osd_text[0] != 0) { int len; if(vo_osd_text[0] < 32) { len = strlen(sub_osd_names_short[vo_osd_text[0]]) + strlen(vo_osd_text+1) + 2; @@ -534,18 +531,18 @@ static void clear_alpha(int x0,int y0, int w,int h) { static void draw_osd(void){ - char * vo_osd_text_save; + char vo_osd_text_save; int vo_osd_progbar_type_save; printosdprogbar(); /* let vo_draw_text only write subtitle */ - vo_osd_text_save=vo_osd_text; /* we have to save the osd_text */ - vo_osd_text=NULL; + vo_osd_text_save = global_osd->osd_text[0]; + global_osd->osd_text[0] = 0; vo_osd_progbar_type_save=vo_osd_progbar_type; vo_osd_progbar_type=-1; vo_remove_text(aa_scrwidth(c), aa_scrheight(c),clear_alpha); vo_draw_text(aa_scrwidth(c), aa_scrheight(c), draw_alpha); - vo_osd_text=vo_osd_text_save; + global_osd->osd_text[0] = vo_osd_text_save; vo_osd_progbar_type=vo_osd_progbar_type_save; } -- cgit v1.2.3