changeset 24292:ca146808e926

Proper support for flashing chars in teletext pages. Patch from Otvos Attila oattila at chello dot hu
author voroshil
date Sat, 01 Sep 2007 01:22:30 +0000
parents 1c14b18d6249
children c561d092b642
files libvo/sub.c stream/tv.h stream/tvi_vbi.c
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/sub.c	Fri Aug 31 22:37:42 2007 +0000
+++ b/libvo/sub.c	Sat Sep 01 01:22:30 2007 +0000
@@ -270,7 +270,7 @@
 }
 inline static void vo_update_text_teletext(mp_osd_obj_t *obj, int dxs, int dys)
 {
-    int h=0,w=0,i,j,font;
+    int h=0,w=0,i,j,font,flashon;
     int wm,hm;
     int color;
     int x,y,x0,y0;
@@ -290,6 +290,7 @@
         obj->flags&=~OSDFLAG_VISIBLE;
         return;
     }
+    flashon=(GetTimer()/1000000)%2;
     switch(vo_osd_teletext_half){
     case TT_ZOOM_TOP_HALF:
         start_row=0;
@@ -404,10 +405,11 @@
         x=x0;
         for(j=0;j<cols;j++){
             tc=tdp[(i+start_row)*VBI_COLUMNS+j];
-            if(!tc.gfx){
+            if(!tc.gfx || (tc.flh && !flashon)){
                 /* Rendering one text character */
                 draw_alpha_buf(obj,x,y,wm,hm,buf[tc.bg],buf[8],wm);
                 if(tc.unicode!=0x20 && tc.unicode!=0x00 && !tc.ctl &&
+                    (!tc.flh || flashon) &&
                     (font=vo_font->font[tc.unicode])>=0 && y+hm<dys){
                         tt_draw_alpha_buf(obj,x,y,vo_font->width[tc.unicode],vo_font->height,
                             vo_font->pic_b[font]->bmp+vo_font->start[tc.unicode]-vo_font->charspace*vo_font->pic_a[font]->w,
--- a/stream/tv.h	Fri Aug 31 22:37:42 2007 +0000
+++ b/stream/tv.h	Sat Sep 01 01:22:30 2007 +0000
@@ -276,6 +276,7 @@
     unsigned char fg;  ///< foreground color
     unsigned char bg;  ///< background color
     unsigned char gfx; ///< 0-no gfx, 1-solid gfx, 2-separated gfx
+    unsigned char flh; ///< 0-no flash, 1-flash
     unsigned char ctl; ///< control character
     unsigned char lng; ///< lang: 0-secondary language,1-primary language
     unsigned char raw; ///< raw character (as received from device)
--- a/stream/tvi_vbi.c	Fri Aug 31 22:37:42 2007 +0000
+++ b/stream/tvi_vbi.c	Sat Sep 01 01:22:30 2007 +0000
@@ -690,6 +690,7 @@
         int separated=0;
         int conceal=0;
         int hold=0;
+        int flash=0;
         tt_char tt_held=tt_space;
         for(col=0;col<VBI_COLUMNS;col++){
             int i=row*VBI_COLUMNS+col;
@@ -704,10 +705,12 @@
             p[i].ctl=(c&0x60)==0?1:0;
             p[i].fg=fg_color;
             p[i].bg=bg_color;
+            p[i].flh=flash;
             
             if ((c&0x60)==0){ //control chars
                 if(c>=0x08 && c<=0x09){//Flash/Steady
-                    FFSWAP(int,bg_color,fg_color);
+                    flash=c==0x08;
+                    p[i].flh=flash;
                     if(c==0x09){
                         p[i].fg=fg_color;
                         p[i].bg=bg_color;