summaryrefslogtreecommitdiffstats
path: root/libvo
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
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')
-rw-r--r--libvo/sub.c104
-rw-r--r--libvo/sub.h29
-rw-r--r--libvo/video_out.h4
3 files changed, 118 insertions, 19 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);
+ }
+
+}
diff --git a/libvo/sub.h b/libvo/sub.h
new file mode 100644
index 0000000000..e464b11efc
--- /dev/null
+++ b/libvo/sub.h
@@ -0,0 +1,29 @@
+
+extern font_desc_t* vo_font;
+
+extern unsigned char* vo_osd_text;
+
+extern int vo_osd_progbar_type;
+extern int vo_osd_progbar_value; // 0..255
+
+extern int vo_sub_lines;
+extern unsigned char* vo_sub_text[8];
+
+#define OSD_PLAY 0x01
+#define OSD_PAUSE 0x02
+#define OSD_STOP 0x03
+#define OSD_REW 0x04
+#define OSD_FFW 0x05
+#define OSD_CLOCK 0x06
+#define OSD_CONTRAST 0x07
+#define OSD_SATURATION 0x08
+#define OSD_VOLUME 0x09
+#define OSD_BRIGHTNESS 0x0A
+#define OSD_HUE 0x0B
+
+#define OSD_PB_START 0x10
+#define OSD_PB_0 0x11
+#define OSD_PB_END 0x12
+#define OSD_PB_1 0x13
+
+
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 43479df972..4dcb19a570 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -105,8 +105,4 @@ typedef struct vo_functions_s
// NULL terminated array of all drivers
extern vo_functions_t* video_out_drivers[];
-extern int vo_sub_lines;
-extern unsigned char* vo_sub_text[8];
-extern unsigned char* vo_osd_text;
-extern font_desc_t* vo_font;