From 641a7ddabd7bc93e05d603dbbbc9bb506d4c72f2 Mon Sep 17 00:00:00 2001 From: voroshil Date: Sat, 8 Sep 2007 09:48:43 +0000 Subject: Implement boxes for subtitle teletext pages. Text is shown in opaque boxes inside transparent teletext page. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24364 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/tv.h | 12 +++++++++++- stream/tvi_vbi.c | 22 +++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'stream') diff --git a/stream/tv.h b/stream/tv.h index f69d8f3371..5e67ef96f6 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -280,6 +280,7 @@ typedef struct tt_char_s{ 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 @@ typedef struct tt_page_s{ 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; diff --git a/stream/tvi_vbi.c b/stream/tvi_vbi.c index 930dab4e48..cf1bfcc0bf 100644 --- a/stream/tvi_vbi.c +++ b/stream/tvi_vbi.c @@ -157,8 +157,8 @@ typedef struct { 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 @@ static void destroy_cache(priv_vbi_t* priv){ * 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 @@ static void decode_page(tt_char* p,unsigned char* raw,int primary_lang,int secon int conceal=0; int hold=0; int flash=0; + int box=0; + tt_char tt_held=tt_space; for(col=0;col=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 @@ static void prepare_visible_page(priv_vbi_t* priv){ 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 @@ static void render2text(tt_page* pt,FILE* f,int colored){ 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;imag[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; -- cgit v1.2.3