mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
72d755e7dd
commit
641a7ddabd
|
@ -405,6 +405,7 @@ inline static void vo_update_text_teletext(mp_osd_obj_t *obj, int dxs, int dys)
|
|||
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);
|
||||
|
|
12
stream/tv.h
12
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;
|
||||
|
|
|
@ -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<VBI_COLUMNS;col++){
|
||||
int i=row*VBI_COLUMNS+col;
|
||||
|
@ -710,6 +712,10 @@ static void decode_page(tt_char* p,unsigned char* raw,int primary_lang,int secon
|
|||
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 @@ static void decode_page(tt_char* p,unsigned char* raw,int primary_lang,int secon
|
|||
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 @@ 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;i<VBI_ROWS;i++){
|
||||
fprintf(f,"|");
|
||||
if(colored) fprintf(f,"\033[40m");
|
||||
|
@ -1101,7 +1109,7 @@ static int decode_pkt0(priv_vbi_t* priv,unsigned char* data,int magAddr)
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue