changeset 218:fbfc2077ba72

sub/osd interface changes
author arpi_esp
date Tue, 27 Mar 2001 00:32:24 +0000
parents cb3b0d65dddd
children bc5c75b7a401
files libvo/sub.c libvo/sub.h libvo/video_out.h
diffstat 3 files changed, 120 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/sub.c	Mon Mar 26 20:28:09 2001 +0000
+++ b/libvo/sub.c	Tue Mar 27 00:32:24 2001 +0000
@@ -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 @@
               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);
 
-#if 1
+        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];
+        }
 
-    if(vo_sub_lines<=0) return; // no text
+        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];
+        
+
+//        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;
+
     y=dys-(1+vo_sub_lines)*vo_font->height;
     
     for(i=0;i<vo_sub_lines;i++){
@@ -74,9 +133,24 @@
         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);
+    }
 
 }
 
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libvo/sub.h	Tue Mar 27 00:32:24 2001 +0000
@@ -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
+
+
--- a/libvo/video_out.h	Mon Mar 26 20:28:09 2001 +0000
+++ b/libvo/video_out.h	Tue Mar 27 00:32:24 2001 +0000
@@ -105,8 +105,4 @@
 // 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;