summaryrefslogtreecommitdiffstats
path: root/libvo/sub.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-27 00:32:24 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-27 00:32:24 +0000
commit180ba6b3554ca9c7b0955fb46738645a7f4b2b5f (patch)
tree9c22a6054a088fc2aeeac0643fd82c4fb179cadf /libvo/sub.c
parent3bdf0810d74da672d4a00ea88a3187e4e80efc04 (diff)
downloadmpv-180ba6b3554ca9c7b0955fb46738645a7f4b2b5f.tar.bz2
mpv-180ba6b3554ca9c7b0955fb46738645a7f4b2b5f.tar.xz
sub/osd interface changes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@219 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/sub.c')
-rw-r--r--libvo/sub.c104
1 files changed, 89 insertions, 15 deletions
diff --git a/libvo/sub.c b/libvo/sub.c
index d64862f899..7f40f2816d 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -1,19 +1,12 @@
+#include "sub.h"
+
//static int vo_font_loaded=-1;
font_desc_t* vo_font=NULL;
-int vo_sub_lines=2;
-unsigned char* vo_sub_text[8];
-
unsigned char* vo_osd_text="00:00:00";
-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)){
- int i;
- int y;
-
- if(!vo_font) return; // no font
-
- if(vo_osd_text){
+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)){
int len=strlen(vo_osd_text);
int j;
int y=10;
@@ -31,12 +24,78 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h,
vo_font->pic_a[font]->w);
x+=vo_font->width[c]+vo_font->charspace;
}
+
+}
+
+int vo_osd_progbar_type=-1;
+int vo_osd_progbar_value=100; // 0..255
+
+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)){
+ int len=strlen(vo_osd_text);
+ int i;
+ int y=dys/2;
+ int x;
+ int c,font;
+ int width=(dxs/2-vo_font->width[0x10]-vo_font->width[0x12]);
+ int elems=width/vo_font->width[0x11];
+ int mark=(vo_osd_progbar_value*(elems+1))>>8;
+ x=(dxs-width)/2;
+// printf("osd.progbar width=%d xpos=%d\n",width,x);
+
+ c=vo_osd_progbar_type;font=vo_font->font[c];
+ if(vo_osd_progbar_type>0 && font>=0)
+ draw_alpha(x-vo_font->width[c]-vo_font->spacewidth,y,
+ vo_font->width[c],
+ vo_font->pic_a[font]->h,
+ vo_font->pic_b[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->w);
+
+ c=OSD_PB_START;font=vo_font->font[c];
+ if(font>=0)
+ draw_alpha(x,y,
+ vo_font->width[c],
+ vo_font->pic_a[font]->h,
+ vo_font->pic_b[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->w);
+ x+=vo_font->width[c];
+
+ for(i=0;i<elems;i++){
+ c=(i<mark)?OSD_PB_0:OSD_PB_1;font=vo_font->font[c];
+ if(font>=0)
+ draw_alpha(x,y,
+ vo_font->width[c],
+ vo_font->pic_a[font]->h,
+ vo_font->pic_b[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->w);
+ x+=vo_font->width[c];
+ }
+
+ c=OSD_PB_END;font=vo_font->font[c];
+ if(font>=0)
+ draw_alpha(x,y,
+ vo_font->width[c],
+ vo_font->pic_a[font]->h,
+ vo_font->pic_b[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->bmp+vo_font->start[c],
+ vo_font->pic_a[font]->w);
+// x+=vo_font->width[c];
- }
-#if 1
+// vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF;
+
+}
+
+
+int vo_sub_lines=2;
+unsigned char* vo_sub_text[8];
+
+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)){
+ int i;
+ int y;
- if(vo_sub_lines<=0) return; // no text
y=dys-(1+vo_sub_lines)*vo_font->height;
for(i=0;i<vo_sub_lines;i++){
@@ -74,9 +133,24 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h,
y+=vo_font->height;
}
-#endif
-
}
+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)){
+
+ if(!vo_font) return; // no font
+
+ if(vo_osd_text){
+ vo_draw_text_osd(dxs,dys,draw_alpha);
+ }
+
+ if(vo_sub_lines>0){
+ vo_draw_text_sub(dxs,dys,draw_alpha);
+ }
+
+ if(vo_osd_progbar_type>=0){
+ vo_draw_text_progbar(dxs,dys,draw_alpha);
+ }
+
+}