changeset 24344:09d402672398

Implement boxes for subtitle teletext pages. Text is shown in opaque boxes inside transparent teletext page.
author voroshil
date Sat, 08 Sep 2007 09:48:43 +0000
parents bf37d4ba4b65
children 388ac5e95da1
files libvo/sub.c stream/tv.h stream/tvi_vbi.c
diffstat 3 files changed, 27 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/sub.c	Sat Sep 08 06:01:43 2007 +0000
+++ b/libvo/sub.c	Sat Sep 08 09:48:43 2007 +0000
@@ -405,6 +405,7 @@
         x=x0;
         for(j=0;j<cols;j++){
             tc=tdp[(i+start_row)*VBI_COLUMNS+j];
+            if (tc.hidden) { x+=wm; continue;}
             if(!tc.gfx || (tc.flh && !flashon)){
                 /* Rendering one text character */
                 draw_alpha_buf(obj,x,y,wm,hm,buf[tc.bg],buf[8],wm);
--- a/stream/tv.h	Sat Sep 08 06:01:43 2007 +0000
+++ b/stream/tv.h	Sat Sep 08 09:48:43 2007 +0000
@@ -280,6 +280,7 @@
     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 hidden; ///< char is hidden (for subtitle pages)
     unsigned char ctl; ///< control character
     unsigned char lng; ///< lang: 0-secondary language,1-primary language
     unsigned char raw; ///< raw character (as received from device)
@@ -296,12 +297,21 @@
     unsigned char primary_lang;   ///< primary language code
     unsigned char secondary_lang; ///< secondary language code
     unsigned char active; ///< page is complete and ready for rendering
-    unsigned char flags;  ///< page flags, not used
+    unsigned char flags;  ///< page flags
     unsigned char raw[VBI_ROWS*VBI_COLUMNS]; ///< page data
     struct tt_page_s* next_subpage;
     struct tt_link_s links[6];
 }  tt_page;
 
+#define TT_PGFL_SUPPRESS_HEADER  0x01
+#define TT_PGFL_UPDATE_INDICATOR 0x02
+#define TT_PGFL_INTERRUPTED_SEQ  0x04
+#define TT_PGFL_INHIBIT_DISPLAY  0x08
+#define TT_PGFL_NEWFLASH         0x10
+#define TT_PGFL_SUBTITLE         0x20
+#define TT_PGFL_ERASE_PAGE       0x40
+#define TT_PGFL_MAGAZINE_SERIAL  0x80
+
 typedef struct tt_stream_props_s{
     int sampling_rate;
     int samples_per_line;
--- a/stream/tvi_vbi.c	Sat Sep 08 06:01:43 2007 +0000
+++ b/stream/tvi_vbi.c	Sat Sep 08 09:48:43 2007 +0000
@@ -157,8 +157,8 @@
 
 static unsigned char fixParity[256];
 
-static tt_char tt_space={0x20,7,0,0,0,0,0x20};
-static tt_char tt_error={'?',1,0,0,0,0,'?'}; // Red '?' on black background
+static tt_char tt_space={0x20,7,0,0,0,0,0,0,0x20};
+static tt_char tt_error={'?',1,0,0,0,0,0,0,'?'}; // Red '?' on black background
 static double si[12];
 static double co[12];
 
@@ -686,7 +686,7 @@
  * info about foreground and background colors, character
  * type (graphics/control/text).
  */
-static void decode_page(tt_char* p,unsigned char* raw,int primary_lang,int secondary_lang)
+static void decode_page(tt_char* p,unsigned char* raw,int primary_lang,int secondary_lang,int flags)
 {
     int row,col;
     int prim_charset=lang2charset(primary_lang);
@@ -701,6 +701,8 @@
         int conceal=0;
         int hold=0;
         int flash=0;
+        int box=0;
+
         tt_char tt_held=tt_space;
         for(col=0;col<VBI_COLUMNS;col++){
             int i=row*VBI_COLUMNS+col;
@@ -710,6 +712,10 @@
                 p[i]=tt_error;
                 continue;
             }
+            if((flags&TT_PGFL_SUBTITLE) || (flags&TT_PGFL_NEWFLASH))
+                p[i].hidden=!box;
+            else
+                p[i].hidden=0;
             p[i].gfx=gfx?(separated?2:1):0;
             p[i].lng=prim_lang;
             p[i].ctl=(c&0x60)==0?1:0;
@@ -725,7 +731,9 @@
                         p[i].fg=fg_color;
                         p[i].bg=bg_color;
                     }
-                }else if(c>=0x0a && c<=0x0f){
+                }else if(c>=0x0a && c<=0x0b){
+                    box=c&1;
+                }else if(c>=0x0c && c<=0x0f){
                 }else if (c<=0x17){ //colors
                     fg_color=c&0x0f;
                     gfx=c>>4;
@@ -815,7 +823,7 @@
             priv->display_page[i]=tt_space;
         }
     }else{
-        decode_page(priv->display_page,pg->raw,pg->primary_lang,pg->secondary_lang);
+        decode_page(priv->display_page,pg->raw,pg->primary_lang,pg->secondary_lang,pg->flags);
         mp_msg(MSGT_TV,MSGL_DBG3,"page #%x was decoded!\n",pg->pagenum);
     }
 
@@ -894,7 +902,7 @@
     0);
     fprintf(f,"+----------------------------------------+\n");
 
-    decode_page(dp,pt->raw,pt->primary_lang,pt->secondary_lang);
+    decode_page(dp,pt->raw,pt->primary_lang,pt->secondary_lang,pt->flags);
     for(i=0;i<VBI_ROWS;i++){
         fprintf(f,"|");
         if(colored) fprintf(f,"\033[40m");
@@ -1101,7 +1109,7 @@
     priv->mag[magAddr].pt->secondary_lang=priv->secondary_language;
     priv->mag[magAddr].pt->subpagenum=(d[2]|(d[3]<<4)|(d[4]<<8)|(d[5]<<12))&0x3f7f;
     priv->mag[magAddr].pt->pagenum=(magAddr<<8) | d[0] | (d[1]<<4);
-    priv->mag[magAddr].pt->flags=( d[6] | (d[7]<<4));
+    priv->mag[magAddr].pt->flags=((d[7]&1)<<7) | ((d[3]&8)<<3) | ((d[5]&12)<<2) | d[6];
 
     memset(priv->mag[magAddr].pt->raw, 0x00, VBI_COLUMNS*VBI_ROWS);
     priv->mag[magAddr].order=0;