libtuxtxt: Transfer from neutrino-mp for better compatibility

Origin commit data
------------------
Branch: ni/coolstream
Commit: 5612baaff7
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2017-02-15 (Wed, 15 Feb 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2017-02-15 18:32:35 +01:00
parent 22d123dd40
commit aaef3934cb
5 changed files with 279 additions and 113 deletions

View File

@@ -1,6 +1,8 @@
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-I$(top_builddir) \ -I$(top_builddir) \
-I$(top_srcdir) \ -I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/libconfigfile \
-I$(top_srcdir)/src \ -I$(top_srcdir)/src \
-I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/src/zapit/include \
$(FREETYPE_CFLAGS) \ $(FREETYPE_CFLAGS) \

View File

@@ -37,6 +37,8 @@ int tuxtxt_init()
tuxtxt_cache.vtxtpid = -1; tuxtxt_cache.vtxtpid = -1;
tuxtxt_cache.thread_id = 0; tuxtxt_cache.thread_id = 0;
tuxtxt_cache.dmx = -1; tuxtxt_cache.dmx = -1;
/* not sure if this is correct here... */
tuxtxt_cache.page = 0x100;
return 1;//tuxtxt_init_demuxer(); return 1;//tuxtxt_init_demuxer();
} }

View File

@@ -11,6 +11,8 @@
* * * *
* ported 2009 to HD1 by Coolstream LTD * * ported 2009 to HD1 by Coolstream LTD *
* * * *
* TD, SPARK and AZbox port (C) 2010-2013 Stefan Seyfried *
* *
******************************************************************************/ ******************************************************************************/
#include "teletext.h" #include "teletext.h"
@@ -19,6 +21,7 @@
#include <dmx.h> #include <dmx.h>
#include <video.h> #include <video.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <global.h>
#include <system/set_threadname.h> #include <system/set_threadname.h>
/* same as in rcinput.h... */ /* same as in rcinput.h... */
@@ -26,6 +29,12 @@
#define KEY_TTZOOM KEY_FN_2 #define KEY_TTZOOM KEY_FN_2
#define KEY_REVEAL KEY_FN_D #define KEY_REVEAL KEY_FN_D
#ifdef HAVE_SPARK_HARDWARE
#define MARK_FB(a, b, c, d) if (p == lfb) CFrameBuffer::getInstance()->mark(a, b, (a) + (c), (b) + (d))
#else
#define MARK_FB(a, b, c, d)
#endif
extern cVideo * videoDecoder; extern cVideo * videoDecoder;
static pthread_t ttx_sub_thread; static pthread_t ttx_sub_thread;
@@ -36,11 +45,24 @@ static int sub_pid, sub_page;
static bool use_gui; static bool use_gui;
static int cfg_national_subset; static int cfg_national_subset;
static int screen_x, screen_y, screen_w, screen_h;
//#define USE_FBPAN // FBIOPAN_DISPLAY seems to be working in current driver //#define USE_FBPAN // FBIOPAN_DISPLAY seems to be working in current driver
unsigned char *getFBp(int *y)
{
if (*y < (int)var_screeninfo.yres)
return lfb;
*y -= var_screeninfo.yres;
return lbb;
}
void FillRect(int x, int y, int w, int h, int color) void FillRect(int x, int y, int w, int h, int color)
{ {
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; unsigned char *p = getFBp(&y);
MARK_FB(x, y, w, h);
p += x*4 + y * fix_screeninfo.line_length;
#if !HAVE_TRIPLEDRAGON #if !HAVE_TRIPLEDRAGON
unsigned int col = bgra[color][3] << 24 | bgra[color][2] << 16 | bgra[color][1] << 8 | bgra[color][0]; unsigned int col = bgra[color][3] << 24 | bgra[color][2] << 16 | bgra[color][1] << 8 | bgra[color][0];
#else #else
@@ -55,6 +77,7 @@ void FillRect(int x, int y, int w, int h, int color)
} }
} }
void FillBorder(int color) void FillBorder(int color)
{ {
int ys = (var_screeninfo.yres-var_screeninfo.yoffset); int ys = (var_screeninfo.yres-var_screeninfo.yoffset);
@@ -180,6 +203,9 @@ int toptext_getnext(int startpage, int up, int findgroup)
nextgrp = nextblk = 0; nextgrp = nextblk = 0;
current = startpage; current = startpage;
if (startpage == 0)
return 0;
do { do {
if (up) if (up)
tuxtxt_next_dec(&current); tuxtxt_next_dec(&current);
@@ -220,6 +246,13 @@ void RenderClearMenuLineBB(char *p, tstPageAttr *attrcol, tstPageAttr *attr)
#if 0 #if 0
RenderCharBB(' ', attr); /* separator */ RenderCharBB(' ', attr); /* separator */
#endif #endif
/* the fontwidth_topmenusmall is not correctly calculated: the navigation
* indicator ' ' is not considered and thus the font is slightly too wide.
* Shift the topmenu to the left instead of using a smaller font, since
* the worst that can happen is that the indicator is partly obscured and
* that looks better than empty space on the right of the topmenu.
*/
PosX = screen_x + screen_w - TOPMENUCHARS * fontwidth_topmenusmall;
for(col = 0; col < TOPMENUCHARS; col++) for(col = 0; col < TOPMENUCHARS; col++)
{ {
RenderCharBB(*p++, attr); RenderCharBB(*p++, attr);
@@ -242,7 +275,8 @@ void ClearFB(int /*color*/)
//never used //never used
void ClearB(int color) void ClearB(int color)
{ {
FillRect(0,0,var_screeninfo.xres,var_screeninfo.yres*2,color); FillRect(0, 0, var_screeninfo.xres, var_screeninfo.yres, color); /* framebuffer */
FillRect(0, var_screeninfo.yres, var_screeninfo.xres, var_screeninfo.yres, color); /* backbuffer */
} }
#endif #endif
int GetCurFontWidth() int GetCurFontWidth()
@@ -250,6 +284,7 @@ int GetCurFontWidth()
int mx = (displaywidth)%(40-nofirst); // # of unused pixels int mx = (displaywidth)%(40-nofirst); // # of unused pixels
int abx = (mx == 0 ? displaywidth+1 : (displaywidth)/(mx+1));// distance between 'inserted' pixels int abx = (mx == 0 ? displaywidth+1 : (displaywidth)/(mx+1));// distance between 'inserted' pixels
int nx= abx+1-((PosX-sx) % (abx+1)); // # of pixels to next insert int nx= abx+1-((PosX-sx) % (abx+1)); // # of pixels to next insert
return fontwidth+(((PosX+fontwidth+1-sx) <= displaywidth && nx <= fontwidth+1) ? 1 : 0); return fontwidth+(((PosX+fontwidth+1-sx) <= displaywidth && nx <= fontwidth+1) ? 1 : 0);
} }
@@ -1535,7 +1570,7 @@ static void* reader_thread(void * /*arg*/)
void tuxtx_pause_subtitle(bool pause) void tuxtx_pause_subtitle(bool pause)
{ {
if(!pause) { if(!pause) {
printf("TuxTxt subtitle unpause, running %d pid %d page %d\n", reader_running, sub_pid, sub_page); //printf("TuxTxt subtitle unpause, running %d pid %d page %d\n", reader_running, sub_pid, sub_page);
ttx_paused = 0; ttx_paused = 0;
if(!reader_running && sub_pid && sub_page) if(!reader_running && sub_pid && sub_page)
tuxtx_main(0, sub_pid, sub_page); tuxtx_main(0, sub_pid, sub_page);
@@ -1572,8 +1607,8 @@ void tuxtx_set_pid(int pid, int page, const char * cc)
sub_page = page; sub_page = page;
cfg_national_subset = GetNationalSubset(cc); cfg_national_subset = GetNationalSubset(cc);
printf("TuxTxt subtitle set pid %d page %d lang %s (%d)\n", sub_pid, sub_page, cc, cfg_national_subset);
#if 0 #if 0
printf("TuxTxt subtitle set pid %d page %d lang %s (%d)\n", sub_pid, sub_page, cc, cfg_national_subset);
ttx_paused = 1; ttx_paused = 1;
if(sub_pid && sub_page) if(sub_pid && sub_page)
tuxtx_main(0, sub_pid, sub_page); tuxtx_main(0, sub_pid, sub_page);
@@ -1597,7 +1632,7 @@ int tuxtx_subtitle_running(int *pid, int *page, int *running)
return ret; return ret;
} }
int tuxtx_main(int _rc, int pid, int page, int source) int tuxtx_main(int /*_rc*/, int pid, int page, int source)
{ {
char cvs_revision[] = "$Revision: 1.95 $"; char cvs_revision[] = "$Revision: 1.95 $";
@@ -1621,14 +1656,18 @@ int tuxtx_main(int _rc, int pid, int page, int source)
printf("TuxTxt %s\n", versioninfo); printf("TuxTxt %s\n", versioninfo);
printf("for 32bpp framebuffer\n"); printf("for 32bpp framebuffer\n");
fb = -1;
#ifdef USE_FBPAN
if ((fb=open("/dev/fb/0", O_RDWR)) == -1) if ((fb=open("/dev/fb/0", O_RDWR)) == -1)
{ {
perror("TuxTxt <open /dev/fb/0>"); perror("TuxTxt <open /dev/fb/0>");
return 0; return 0;
} }
#endif
rc = _rc; CFrameBuffer *fbp = CFrameBuffer::getInstance();
lfb = (unsigned char *) CFrameBuffer::getInstance()->getFrameBufferPointer(); lfb = (unsigned char *)fbp->getFrameBufferPointer();
lbb = (unsigned char *)fbp->getBackBufferPointer();
tuxtxt_cache.vtxtpid = pid; tuxtxt_cache.vtxtpid = pid;
@@ -1637,8 +1676,7 @@ int tuxtx_main(int _rc, int pid, int page, int source)
else else
printf("[tuxtxt] using PID %x page %d\n", tuxtxt_cache.vtxtpid, tuxtxt_cache.page); printf("[tuxtxt] using PID %x page %d\n", tuxtxt_cache.vtxtpid, tuxtxt_cache.page);
fcntl(rc, F_SETFL, fcntl(rc, F_GETFL) | O_EXCL | O_NONBLOCK); #if 0 /* just get it from the framebuffer class */
/* get fixed screeninfo */ /* get fixed screeninfo */
if (ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) if (ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1)
{ {
@@ -1652,7 +1690,12 @@ int tuxtx_main(int _rc, int pid, int page, int source)
perror("TuxTxt <FBIOGET_VSCREENINFO>"); perror("TuxTxt <FBIOGET_VSCREENINFO>");
return 0; return 0;
} }
#else
struct fb_var_screeninfo *var;
var = fbp->getScreenInfo();
memcpy(&var_screeninfo, var, sizeof(struct fb_var_screeninfo));
fix_screeninfo.line_length = var_screeninfo.xres * sizeof(fb_pixel_t);
#endif
/* set variable screeninfo for double buffering */ /* set variable screeninfo for double buffering */
var_screeninfo.yoffset = 0; var_screeninfo.yoffset = 0;
#if 0 #if 0
@@ -1661,10 +1704,15 @@ int tuxtx_main(int _rc, int pid, int page, int source)
ex = x + w - 10; ex = x + w - 10;
ey = y + h - 10; ey = y + h - 10;
#endif #endif
int x = CFrameBuffer::getInstance()->getScreenX(); screen_x = fbp->getScreenX();
int y = CFrameBuffer::getInstance()->getScreenY(); screen_y = fbp->getScreenY();
int w = CFrameBuffer::getInstance()->getScreenWidth(); screen_w = fbp->getScreenWidth();
int h = CFrameBuffer::getInstance()->getScreenHeight(); screen_h = fbp->getScreenHeight();
int x = screen_x;
int y = screen_y;
int w = screen_w;
int h = screen_h;
int tx = 0; int tx = 0;
if (!screen_mode1) if (!screen_mode1)
@@ -1725,6 +1773,7 @@ int tuxtx_main(int _rc, int pid, int page, int source)
SwitchTranspMode(); SwitchTranspMode();
break; /* and evaluate key */ break; /* and evaluate key */
case RC_TTTV:
case RC_MUTE: /* regular toggle to transparent */ case RC_MUTE: /* regular toggle to transparent */
case RC_TEXT: case RC_TEXT:
break; break;
@@ -1797,20 +1846,25 @@ int tuxtx_main(int _rc, int pid, int page, int source)
case RC_7: case RC_7:
case RC_8: case RC_8:
case RC_9: case RC_9:
PageInput(RCCode - RC_0); PageInput(CRCInput::getNumericValue(RCCode));
break; break;
case RC_RED: ColorKey(prev_100); break; case RC_RED: ColorKey(prev_100); break;
case RC_GREEN: ColorKey(prev_10); break; case RC_GREEN: ColorKey(prev_10); break;
case RC_YELLOW: ColorKey(next_10); break; case RC_YELLOW: ColorKey(next_10); break;
case RC_BLUE: ColorKey(next_100); break; case RC_BLUE: ColorKey(next_100); break;
case RC_TTZOOM:
case RC_PLUS: SwitchZoomMode(); break; case RC_PLUS: SwitchZoomMode(); break;
case RC_SPLIT:
case RC_MINUS: SwitchScreenMode(-1);prevscreenmode = screenmode; break; case RC_MINUS: SwitchScreenMode(-1);prevscreenmode = screenmode; break;
case RC_TTTV:
case RC_MUTE: SwitchTranspMode(); break; case RC_MUTE: SwitchTranspMode(); break;
case RC_TEXT: case RC_TEXT:
if(transpmode == 1) if(transpmode == 1)
RCCode = RC_HOME; RCCode = RC_HOME;
SwitchTranspMode(); SwitchTranspMode();
break; break;
case RC_TTREVEAL:
case RC_INFO:
case RC_HELP: SwitchHintMode(); break; case RC_HELP: SwitchHintMode(); break;
case RC_DBOX: ConfigMenu(0); break; case RC_DBOX: ConfigMenu(0); break;
case RC_HOME: case RC_HOME:
@@ -1827,6 +1881,7 @@ int tuxtx_main(int _rc, int pid, int page, int source)
/* exit */ /* exit */
CleanUp(); CleanUp();
if (fb >= 0)
close(fb); close(fb);
#if 1 #if 1
@@ -1863,10 +1918,10 @@ FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library plibrary, FT_Pointer /*r
******************************************************************************/ ******************************************************************************/
extern std::string ttx_font_file; extern std::string ttx_font_file;
static bool ft_init_done = false; static bool ft_init_done = false;
static int oldfontheight = 0;
int Init(int source) int Init(int source)
{ {
int error, i; int error, i;
unsigned char magazine;
static std::string font_file; static std::string font_file;
/* init data */ /* init data */
@@ -1874,12 +1929,13 @@ int Init(int source)
//page_atrb[32] = transp<<4 | transp; //page_atrb[32] = transp<<4 | transp;
inputcounter = 2; inputcounter = 2;
#if TUXTXT_CFG_STANDALONE
unsigned char magazine;
for (magazine = 1; magazine < 9; magazine++) for (magazine = 1; magazine < 9; magazine++)
{ {
tuxtxt_cache.current_page [magazine] = -1; tuxtxt_cache.current_page [magazine] = -1;
tuxtxt_cache.current_subpage [magazine] = -1; tuxtxt_cache.current_subpage [magazine] = -1;
} }
#if TUXTXT_CFG_STANDALONE
/* init data */ /* init data */
memset(&tuxtxt_cache.astCachetable, 0, sizeof(tuxtxt_cache.astCachetable)); memset(&tuxtxt_cache.astCachetable, 0, sizeof(tuxtxt_cache.astCachetable));
memset(&tuxtxt_cache.subpagetable, 0xFF, sizeof(tuxtxt_cache.subpagetable)); memset(&tuxtxt_cache.subpagetable, 0xFF, sizeof(tuxtxt_cache.subpagetable));
@@ -2029,7 +2085,7 @@ int Init(int source)
fontwidth_topmenumain = (TV43STARTX-sx) / 40; fontwidth_topmenumain = (TV43STARTX-sx) / 40;
fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS; fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS;
//fontwidth_small = (TV169FULLSTARTX-sx) / 40; //fontwidth_small = (TV169FULLSTARTX-sx) / 40;
fontwidth_small = (CFrameBuffer::getInstance()->getScreenWidth()/2) / 40; fontwidth_small = (screen_w / 2) / 40;
ymosaic[0] = 0; /* y-offsets for 2*3 mosaic */ ymosaic[0] = 0; /* y-offsets for 2*3 mosaic */
ymosaic[1] = (fontheight + 1) / 3; ymosaic[1] = (fontheight + 1) / 3;
ymosaic[2] = (fontheight * 2 + 1) / 3; ymosaic[2] = (fontheight * 2 + 1) / 3;
@@ -2071,7 +2127,7 @@ int Init(int source)
} }
} }
#endif #endif
if(!ft_init_done || font_file != ttx_font_file) { if(!ft_init_done || font_file != ttx_font_file || fontheight != oldfontheight) {
printf("TuxTxt: init fontlibrary\n"); printf("TuxTxt: init fontlibrary\n");
if(ft_init_done) { if(ft_init_done) {
FTC_Manager_Done(manager); FTC_Manager_Done(manager);
@@ -2121,6 +2177,7 @@ int Init(int source)
} }
font_file = ttx_font_file; font_file = ttx_font_file;
ft_init_done = true; ft_init_done = true;
oldfontheight = fontheight;
ascender = (usettf ? fontheight * face->ascender / face->units_per_EM : 16); ascender = (usettf ? fontheight * face->ascender / face->units_per_EM : 16);
} }
@@ -2193,7 +2250,6 @@ int Init(int source)
#else #else
tuxtxt_start(tuxtxt_cache.vtxtpid, source); tuxtxt_start(tuxtxt_cache.vtxtpid, source);
#endif #endif
fcntl(rc, F_SETFL, O_NONBLOCK);
gethotlist(); gethotlist();
if(use_gui) if(use_gui)
@@ -2787,7 +2843,7 @@ void Menu_Init(char *menu, int current_pid, int menuitem, int hotindex)
void ConfigMenu(int Init) void ConfigMenu(int Init)
{ {
int val, menuitem = M_Start; int menuitem = M_Start;
int current_pid = 0; int current_pid = 0;
int hotindex; int hotindex;
int oldscreenmode, oldtrans = 0; int oldscreenmode, oldtrans = 0;
@@ -2841,23 +2897,18 @@ void ConfigMenu(int Init)
clearbbcolor = black; clearbbcolor = black;
Menu_Init(menu, current_pid, menuitem, hotindex); Menu_Init(menu, current_pid, menuitem, hotindex);
/* set blocking mode */
val = fcntl(rc, F_GETFL);
fcntl(rc, F_SETFL, val &~ O_NONBLOCK);
/* loop */ /* loop */
do { do {
if (GetRCCode() == 1) if (GetRCCode() == 1)
{ {
int rc_num = -1;
if ( if (CRCInput::isNumeric(RCCode))
#if (RC_1 > 0) rc_num = CRCInput::getNumericValue(RCCode) -1; /* valid: 1 to M_MaxDirect */
RCCode >= RC_1 && /* generates a warning... */ if (rc_num >= 0 && rc_num <= M_MaxDirect) /* direct access */
#endif
RCCode <= RC_1+M_MaxDirect) /* direct access */
{ {
Menu_HighlightLine(menu, MenuLine[menuitem], 0); Menu_HighlightLine(menu, MenuLine[menuitem], 0);
menuitem = RCCode-RC_1; menuitem = rc_num;
Menu_HighlightLine(menu, MenuLine[menuitem], 1); Menu_HighlightLine(menu, MenuLine[menuitem], 1);
if (menuitem != M_PID) /* just select */ if (menuitem != M_PID) /* just select */
@@ -3318,7 +3369,6 @@ void ConfigMenu(int Init)
current_service = current_pid; current_service = current_pid;
// RenderMessage(ShowServiceName); // RenderMessage(ShowServiceName);
fcntl(rc, F_SETFL, O_NONBLOCK);
RCCode = -1; RCCode = -1;
if (oldscreenmode) if (oldscreenmode)
SwitchScreenMode(oldscreenmode); /* restore divided screen */ SwitchScreenMode(oldscreenmode); /* restore divided screen */
@@ -3379,8 +3429,6 @@ void ConfigMenu(int Init)
ClearBB(transp); ClearBB(transp);
CopyBB2FB(); CopyBB2FB();
/* reset to nonblocking mode */
fcntl(rc, F_SETFL, O_NONBLOCK);
tuxtxt_cache.pageupdate = 1; tuxtxt_cache.pageupdate = 1;
RCCode = -1; RCCode = -1;
if (oldscreenmode) if (oldscreenmode)
@@ -3595,7 +3643,7 @@ void ColorKey(int target)
void PageCatching() void PageCatching()
{ {
int val, byte; int byte;
int oldzoommode = zoommode; int oldzoommode = zoommode;
pagecatching = 1; pagecatching = 1;
@@ -3625,10 +3673,6 @@ void PageCatching()
return; return;
} }
/* set blocking mode */
val = fcntl(rc, F_GETFL);
fcntl(rc, F_SETFL, val &~ O_NONBLOCK);
/* loop */ /* loop */
do { do {
GetRCCode(); GetRCCode();
@@ -3667,7 +3711,6 @@ void PageCatching()
case RC_HOME: case RC_HOME:
case RC_HELP: case RC_HELP:
case RC_MUTE: case RC_MUTE:
fcntl(rc, F_SETFL, O_NONBLOCK);
tuxtxt_cache.pageupdate = 1; tuxtxt_cache.pageupdate = 1;
pagecatching = 0; pagecatching = 0;
RCCode = -1; RCCode = -1;
@@ -3691,9 +3734,6 @@ void PageCatching()
tuxtxt_cache.subpage = subp; tuxtxt_cache.subpage = subp;
else else
tuxtxt_cache.subpage = 0; tuxtxt_cache.subpage = 0;
/* reset to nonblocking mode */
fcntl(rc, F_SETFL, O_NONBLOCK);
} }
/****************************************************************************** /******************************************************************************
@@ -3925,9 +3965,9 @@ void SwitchScreenMode(int newscreenmode)
if (screenmode==1) /* split with topmenu */ if (screenmode==1) /* split with topmenu */
{ {
int x = CFrameBuffer::getInstance()->getScreenX(); int x = screen_x;
int w = CFrameBuffer::getInstance()->getScreenWidth(); int w = screen_w;
int h = CFrameBuffer::getInstance()->getScreenHeight(); int h = screen_h;
fw = fontwidth_topmenumain; fw = fontwidth_topmenumain;
tx = 0; /* split means we start at the left edge */ tx = 0; /* split means we start at the left edge */
@@ -3954,18 +3994,20 @@ void SwitchScreenMode(int newscreenmode)
} }
else /* 2: split with full height tv picture */ else /* 2: split with full height tv picture */
{ {
StartX = CFrameBuffer::getInstance()->getScreenX(); StartX = screen_x;
fw = fontwidth_small; fw = fontwidth_small;
tx = TV169FULLSTARTX; tx = TV169FULLSTARTX;
ty = TV169FULLSTARTY; ty = TV169FULLSTARTY;
tw = TV169FULLWIDTH; tw = TV169FULLWIDTH;
th = TV169FULLHEIGHT; th = TV169FULLHEIGHT;
displaywidth = CFrameBuffer::getInstance()->getScreenWidth()/2; displaywidth = screen_w / 2;
} }
setfontwidth(fw); setfontwidth(fw);
videoDecoder->Pig(tx, ty, tw, th, CFrameBuffer::getInstance()->getScreenWidth(true), CFrameBuffer::getInstance()->getScreenHeight(true)); CFrameBuffer *f = CFrameBuffer::getInstance();
videoDecoder->Pig(tx, ty, tw, th,
f->getScreenWidth(true), f->getScreenHeight(true));
#if 0 #if 0
int sm = 0; int sm = 0;
ioctl(pig, VIDIOC_OVERLAY, &sm); ioctl(pig, VIDIOC_OVERLAY, &sm);
@@ -3987,8 +4029,8 @@ void SwitchScreenMode(int newscreenmode)
#endif #endif
videoDecoder->Pig(-1, -1, -1, -1); videoDecoder->Pig(-1, -1, -1, -1);
int x = CFrameBuffer::getInstance()->getScreenX(); int x = screen_x;
int w = CFrameBuffer::getInstance()->getScreenWidth(); int w = screen_w;
//int h = CFrameBuffer::getInstance()->getScreenHeight(); //int h = CFrameBuffer::getInstance()->getScreenHeight();
int tx = 0; int tx = 0;
/* see comment above on the TTX window dimensions */ /* see comment above on the TTX window dimensions */
@@ -4131,7 +4173,9 @@ void RenderDRCS( //FIX ME
void DrawVLine(int x, int y, int l, int color) void DrawVLine(int x, int y, int l, int color)
{ {
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; unsigned char *p = getFBp(&y);
MARK_FB(x, y, 0, l);
p += x*4 + y * fix_screeninfo.line_length;
for ( ; l > 0 ; l--) for ( ; l > 0 ; l--)
{ {
@@ -4143,11 +4187,13 @@ void DrawVLine(int x, int y, int l, int color)
void DrawHLine(int x, int y, int l, int color) void DrawHLine(int x, int y, int l, int color)
{ {
int ltmp; int ltmp;
unsigned char *p = getFBp(&y);
MARK_FB(x, y, l, 0);
if (l > 0) if (l > 0)
{ {
for (ltmp=0; ltmp <= l; ltmp++) for (ltmp=0; ltmp <= l; ltmp++)
{ {
memmove(lfb + x*4 + ltmp*4 + y * fix_screeninfo.line_length, bgra[color], 4); memmove(p + x*4 + ltmp*4 + y * fix_screeninfo.line_length, bgra[color], 4);
} }
} }
} }
@@ -4163,7 +4209,10 @@ void FillRectMosaicSeparated(int x, int y, int w, int h, int fgcolor, int bgcolo
void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color) void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color)
{ {
unsigned char *p = lfb + x0*4 + y0 * fix_screeninfo.line_length; unsigned char *p = getFBp(&y0);
MARK_FB(x0, y0, l0, h);
p += x0 * 4 + y0 * fix_screeninfo.line_length;
int xoffset, l; int xoffset, l;
int yoffset; int yoffset;
int ltmp; int ltmp;
@@ -4185,7 +4234,10 @@ void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color)
void FlipHorz(int x, int y, int w, int h) void FlipHorz(int x, int y, int w, int h)
{ {
unsigned char *buf= new unsigned char[w*4]; unsigned char *buf= new unsigned char[w*4];
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; unsigned char *p = getFBp(&y);
MARK_FB(x, y, w, h);
p += x * 4 + y * fix_screeninfo.line_length;
int w1,h1; int w1,h1;
if(buf != NULL){ if(buf != NULL){
for (h1 = 0 ; h1 < h ; h1++) for (h1 = 0 ; h1 < h ; h1++)
@@ -4203,7 +4255,11 @@ void FlipHorz(int x, int y, int w, int h)
void FlipVert(int x, int y, int w, int h) void FlipVert(int x, int y, int w, int h)
{ {
unsigned char *buf= new unsigned char[w*4]; unsigned char *buf= new unsigned char[w*4];
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length, *p1, *p2; unsigned char *p1, *p2;
unsigned char *p = getFBp(&y);
MARK_FB(x, y, w, h);
p += x*4 + y * fix_screeninfo.line_length;
int h1; int h1;
if(buf != NULL){ if(buf != NULL){
for (h1 = 0 ; h1 < h/2 ; h1++) for (h1 = 0 ; h1 < h/2 ; h1++)
@@ -4464,7 +4520,11 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
else if (*aShapes[Char - 0x20] == S_ADT) else if (*aShapes[Char - 0x20] == S_ADT)
{ {
int x,y,f,c; int x,y,f,c;
unsigned char* p = lfb + PosX*4 + (PosY+yoffset)* fix_screeninfo.line_length; y = yoffset;
unsigned char *p = getFBp(&y);
MARK_FB(PosX, PosY, curfontwidth, fontheight);
p += PosX * 4 + PosY * fix_screeninfo.line_length;
for (y=0; y<fontheight;y++) for (y=0; y<fontheight;y++)
{ {
for (f=0; f<factor; f++) for (f=0; f<factor; f++)
@@ -4508,8 +4568,10 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
return; return;
} }
axdrcs[12] = curfontwidth; /* adjust last x-offset according to position, FIXME: double width */ axdrcs[12] = curfontwidth; /* adjust last x-offset according to position, FIXME: double width */
int y = yoffset;
unsigned char *q = getFBp(&y);
RenderDRCS(p, RenderDRCS(p,
lfb + PosX*4 + (yoffset + PosY) * fix_screeninfo.line_length, q + PosX * 4 + PosY * fix_screeninfo.line_length,
axdrcs, fgcolor, bgcolor); axdrcs, fgcolor, bgcolor);
} }
else else
@@ -4784,8 +4846,10 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
if (ascender - sbit->top + TTFShiftY + sbit->height > fontheight) if (ascender - sbit->top + TTFShiftY + sbit->height > fontheight)
sbit->height = fontheight - ascender + sbit->top - TTFShiftY; /* limit char height to defined/calculated fontheight */ sbit->height = fontheight - ascender + sbit->top - TTFShiftY; /* limit char height to defined/calculated fontheight */
int y = yoffset;
p = getFBp(&y);
p += PosX * 4 + (PosY + Row) * fix_screeninfo.line_length; /* running pointer into framebuffer */
p = lfb + PosX*4 + (yoffset + PosY + Row) * fix_screeninfo.line_length; /* running pointer into framebuffer */
for (Row = sbit->height; Row; Row--) /* row counts up, but down may be a little faster :) */ for (Row = sbit->height; Row; Row--) /* row counts up, but down may be a little faster :) */
{ {
int pixtodo = (usettf ? sbit->width : curfontwidth); int pixtodo = (usettf ? sbit->width : curfontwidth);
@@ -5117,8 +5181,8 @@ void DoFlashing(int startrow)
} }
PosY += fontheight*factor; PosY += fontheight*factor;
} }
} }
void RenderPage() void RenderPage()
{ {
int row, col, byte, startrow = 0;; int row, col, byte, startrow = 0;;
@@ -5189,7 +5253,7 @@ void RenderPage()
fontwidth_topmenumain = (TV43STARTX-sx) / (40-nofirst); fontwidth_topmenumain = (TV43STARTX-sx) / (40-nofirst);
fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS; fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS;
//fontwidth_small = (TV169FULLSTARTX-sx) / (40-nofirst); //fontwidth_small = (TV169FULLSTARTX-sx) / (40-nofirst);
fontwidth_small = (CFrameBuffer::getInstance()->getScreenWidth()/2) / (40-nofirst); fontwidth_small = (screen_w / 2) / (40 - nofirst);
switch(screenmode) switch(screenmode)
{ {
case 0: case 0:
@@ -5197,7 +5261,7 @@ void RenderPage()
displaywidth = ex - sx; displaywidth = ex - sx;
break; break;
case 2: setfontwidth(fontwidth_small); case 2: setfontwidth(fontwidth_small);
displaywidth = CFrameBuffer::getInstance()->getScreenWidth() / 2; displaywidth = screen_w / 2;
break; break;
} }
if (transpmode || (boxed && !screenmode)) if (transpmode || (boxed && !screenmode))
@@ -5440,7 +5504,7 @@ void CreateLine25()
showlink(3, next_100); showlink(3, next_100);
} }
if (//tuxtxt_cache.bttok && if (tuxtxt_cache.bttok &&
screenmode == 1) /* TOP-Info present, divided screen -> create TOP overview */ screenmode == 1) /* TOP-Info present, divided screen -> create TOP overview */
{ {
char line[TOPMENUCHARS]; char line[TOPMENUCHARS];
@@ -5550,6 +5614,9 @@ void CopyBB2FB()
{ {
unsigned char *src, *dst, *topsrc; unsigned char *src, *dst, *topsrc;
int fillcolor, i, screenwidth, swtmp; int fillcolor, i, screenwidth, swtmp;
#ifdef HAVE_SPARK_HARDWARE
CFrameBuffer *f = CFrameBuffer::getInstance();
#endif
/* line 25 */ /* line 25 */
if (!pagecatching && use_gui) if (!pagecatching && use_gui)
@@ -5570,12 +5637,16 @@ void CopyBB2FB()
if (ioctl(fb, FBIOPAN_DISPLAY, &var_screeninfo) == -1) if (ioctl(fb, FBIOPAN_DISPLAY, &var_screeninfo) == -1)
perror("TuxTxt <FBIOPAN_DISPLAY>"); perror("TuxTxt <FBIOPAN_DISPLAY>");
#else #else
memmove(lfb, lfb+fix_screeninfo.line_length * var_screeninfo.yres, fix_screeninfo.line_length*var_screeninfo.yres); #ifdef HAVE_SPARK_HARDWARE
f->blit2FB(lbb, var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, 0, true);
#else
memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres);
#endif
#endif #endif
/* adapt background of backbuffer if changed */ /* adapt background of backbuffer if changed */
if (StartX > 0 && *lfb != *(lfb + fix_screeninfo.line_length * var_screeninfo.yres)) { if (StartX > 0 && *lfb != *lbb) {
FillBorder(*(lfb + fix_screeninfo.line_length * var_screeninfo.yoffset)); FillBorder(*lbb);
// ClearBB(*(lfb + var_screeninfo.xres * var_screeninfo.yoffset)); // ClearBB(*(lfb + var_screeninfo.xres * var_screeninfo.yoffset));
} }
@@ -5587,8 +5658,11 @@ void CopyBB2FB()
return; return;
} }
src = dst = topsrc = lfb + StartY*fix_screeninfo.line_length; src = topsrc = lbb + StartY * fix_screeninfo.line_length;
dst = lfb + StartY * fix_screeninfo.line_length;
#ifdef USE_FBPAN
#error USE_FBPAN code is not working right now.
if (var_screeninfo.yoffset) if (var_screeninfo.yoffset)
dst += fix_screeninfo.line_length * var_screeninfo.yres; dst += fix_screeninfo.line_length * var_screeninfo.yres;
else else
@@ -5596,6 +5670,7 @@ void CopyBB2FB()
src += fix_screeninfo.line_length * var_screeninfo.yres; src += fix_screeninfo.line_length * var_screeninfo.yres;
topsrc += fix_screeninfo.line_length * var_screeninfo.yres; topsrc += fix_screeninfo.line_length * var_screeninfo.yres;
} }
#endif
/* copy line25 in normal height */ /* copy line25 in normal height */
if (!pagecatching ) if (!pagecatching )
memmove(dst+(24*fontheight)*fix_screeninfo.line_length, src + (24*fontheight)*fix_screeninfo.line_length, fix_screeninfo.line_length*fontheight); memmove(dst+(24*fontheight)*fix_screeninfo.line_length, src + (24*fontheight)*fix_screeninfo.line_length, fix_screeninfo.line_length*fontheight);
@@ -5611,9 +5686,15 @@ void CopyBB2FB()
/* copy topmenu in normal height (since PIG also keeps dimensions) */ /* copy topmenu in normal height (since PIG also keeps dimensions) */
if (screenmode == 1) if (screenmode == 1)
{ {
unsigned char *topdst = dst;
screenwidth = ( TV43STARTX ) * 4; screenwidth = ( TV43STARTX ) * 4;
#ifdef HAVE_SPARK_HARDWARE
int cx = var_screeninfo.xres - TV43STARTX; /* x start */
int cw = TV43STARTX; /* width */
int cy = StartY;
int ch = 24*fontheight;
f->blit2FB(lbb, cw, ch, cx, cy, cx, cy, true);
#else
unsigned char *topdst = dst;
size_t width = ex * sizeof(fb_pixel_t) - screenwidth; size_t width = ex * sizeof(fb_pixel_t) - screenwidth;
topsrc += screenwidth; topsrc += screenwidth;
@@ -5624,6 +5705,7 @@ void CopyBB2FB()
topdst += fix_screeninfo.line_length; topdst += fix_screeninfo.line_length;
topsrc += fix_screeninfo.line_length; topsrc += fix_screeninfo.line_length;
} }
#endif
} }
else if (screenmode == 2) else if (screenmode == 2)
screenwidth = ( TV169FULLSTARTX ) * 4; screenwidth = ( TV169FULLSTARTX ) * 4;
@@ -5654,6 +5736,9 @@ void CopyBB2FB()
memmove(dst + fix_screeninfo.line_length*(fontheight+i)+swtmp*4, bgra[fillcolor], 4); memmove(dst + fix_screeninfo.line_length*(fontheight+i)+swtmp*4, bgra[fillcolor], 4);
} }
} }
#ifdef HAVE_SPARK_HARDWARE
f->mark(0, 0, var_screeninfo.xres, var_screeninfo.yres);
#endif
} }
/****************************************************************************** /******************************************************************************
@@ -6343,6 +6428,21 @@ void DecodePage()
/****************************************************************************** /******************************************************************************
* GetRCCode * * GetRCCode *
******************************************************************************/ ******************************************************************************/
int GetRCCode()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
g_RCInput->getMsg_ms(&msg, &data, 40);
RCCode = -1;
if (msg <= CRCInput::RC_MaxRC) {
RCCode = msg;
return 1;
}
return 0;
}
#if 0
#if 1 #if 1
int GetRCCode() int GetRCCode()
{ {
@@ -6416,7 +6516,7 @@ printf("[tuxtxt] new key, code %X\n", RCCode);
} }
RCCode = -1; RCCode = -1;
usleep(1000000/100); usleep(1000000/25);
return 0; return 0;
} }
@@ -6481,6 +6581,7 @@ int GetRCCode()
return 1; return 1;
} }
#endif #endif
#endif
/* Local Variables: */ /* Local Variables: */
/* indent-tabs-mode:t */ /* indent-tabs-mode:t */
/* tab-width:3 */ /* tab-width:3 */

View File

@@ -12,6 +12,8 @@
* ported 2006 to Dreambox 7025 / 32Bit framebuffer * * ported 2006 to Dreambox 7025 / 32Bit framebuffer *
* by Seddi <seddi@i-have-a-dreambox.com> * * by Seddi <seddi@i-have-a-dreambox.com> *
* * * *
* *
* ported to Tripledragon, SPARK and AZbox 2010-2013 Stefan Seyfried *
******************************************************************************/ ******************************************************************************/
#define TUXTXT_CFG_STANDALONE 0 // 1:plugin only 0:use library #define TUXTXT_CFG_STANDALONE 0 // 1:plugin only 0:use library
@@ -42,6 +44,8 @@
#include FT_CACHE_H #include FT_CACHE_H
#include FT_CACHE_SMALL_BITMAPS_H #include FT_CACHE_SMALL_BITMAPS_H
#include <driver/rcinput.h>
/* devices */ /* devices */
#if TUXTXT_CFG_STANDALONE #if TUXTXT_CFG_STANDALONE
@@ -82,20 +86,19 @@ int tv_pip_y;
#define fontwidth_small_lcd 8 #define fontwidth_small_lcd 8
#define TV43STARTX (ex) #define TV43STARTX (ex)
#define TVENDX (CFrameBuffer::getInstance()->getScreenX() + CFrameBuffer::getInstance()->getScreenWidth()) //ex #define TVENDX (screen_x + screen_w) //ex
// #define TVENDY (StartY + 25*fontheight) // #define TVENDY (StartY + 25*fontheight)
// #define TV43WIDTH (TVENDX - TV43STARTX) // #define TV43WIDTH (TVENDX - TV43STARTX)
// #define TV43HEIGHT (TV43WIDTH *9/16) // #define TV43HEIGHT (TV43WIDTH *9/16)
// #define TV43STARTY (TVENDY - TV43HEIGHT) // #define TV43STARTY (TVENDY - TV43HEIGHT)
//#define TV169FULLSTARTX (sx+ 8*40) //(sx +(ex +1 - sx)/2) //#define TV169FULLSTARTX (sx+ 8*40) //(sx +(ex +1 - sx)/2)
#define TV169FULLSTARTX (CFrameBuffer::getInstance()->getScreenX() + CFrameBuffer::getInstance()->getScreenWidth()/2) #define TV169FULLSTARTX (screen_x + screen_w / 2)
#define TV169FULLSTARTY sy #define TV169FULLSTARTY sy
//#define TV169FULLWIDTH (ex - sx)/2 //#define TV169FULLWIDTH (ex - sx)/2
#define TV169FULLWIDTH (CFrameBuffer::getInstance()->getScreenWidth()/2) #define TV169FULLWIDTH (screen_w / 2)
#define TV169FULLHEIGHT (ey - sy) #define TV169FULLHEIGHT (ey - sy)
#define TOPMENUSTARTX (TV43STARTX+2)
#define TOPMENUSTARTX TV43STARTX+2
//#define TOPMENUENDX TVENDX //#define TOPMENUENDX TVENDX
#define TOPMENUSTARTY StartY #define TOPMENUSTARTY StartY
#define TOPMENUENDY TV43STARTY #define TOPMENUENDY TV43STARTY
@@ -105,7 +108,7 @@ int tv_pip_y;
#define TOPMENUINDENTGRP 1 #define TOPMENUINDENTGRP 1
#define TOPMENUINDENTDEF 2 #define TOPMENUINDENTDEF 2
#define TOPMENUSPC 0 #define TOPMENUSPC 0
#define TOPMENUCHARS (TOPMENUINDENTDEF+12+TOPMENUSPC+4) #define TOPMENUCHARS (TOPMENUINDENTDEF+12+TOPMENUSPC+3)
#define FLOFSIZE 4 #define FLOFSIZE 4
@@ -143,6 +146,7 @@ int tv_pip_y;
#define hold_mosaic 0x1E #define hold_mosaic 0x1E
#define release_mosaic 0x1F #define release_mosaic 0x1F
#if 0
/* rc codes */ /* rc codes */
#define RC_0 0x00 #define RC_0 0x00
#define RC_1 0x01 #define RC_1 0x01
@@ -171,6 +175,48 @@ int tv_pip_y;
#define RC_DBOX 0x18 #define RC_DBOX 0x18
#define RC_TEXT 0x19 #define RC_TEXT 0x19
#define RC_HOME 0x1F #define RC_HOME 0x1F
#else
#define RC_0 CRCInput::RC_0
#define RC_1 CRCInput::RC_1
#define RC_2 CRCInput::RC_2
#define RC_3 CRCInput::RC_3
#define RC_4 CRCInput::RC_4
#define RC_5 CRCInput::RC_5
#define RC_6 CRCInput::RC_6
#define RC_7 CRCInput::RC_7
#define RC_8 CRCInput::RC_8
#define RC_9 CRCInput::RC_9
#define RC_RIGHT CRCInput::RC_right
#define RC_LEFT CRCInput::RC_left
#define RC_UP CRCInput::RC_up
#define RC_DOWN CRCInput::RC_down
#define RC_OK CRCInput::RC_ok
#define RC_MUTE CRCInput::RC_spkr
#define RC_STANDBY CRCInput::RC_standby
#define RC_GREEN CRCInput::RC_green
#define RC_YELLOW CRCInput::RC_yellow
#define RC_RED CRCInput::RC_red
#define RC_BLUE CRCInput::RC_blue
#define RC_PLUS CRCInput::RC_plus
#define RC_MINUS CRCInput::RC_minus
#define RC_HELP CRCInput::RC_help
#define RC_INFO CRCInput::RC_info
#define RC_DBOX CRCInput::RC_setup
#define RC_HOME CRCInput::RC_home
#define RC_TTTV CRCInput::RC_tttv
#define RC_TTZOOM CRCInput::RC_ttzoom
#define RC_TTREVEAL CRCInput::RC_ttreveal
#if HAVE_TRIPLEDRAGON
/* td has more keys so use ttx key for switching split mode... */
#define RC_SPLIT CRCInput::RC_text
/* rc_text is now unused */
#define RC_TEXT (CRCInput::RC_MaxRC + 1)
#else
/* ...while other receivers use the vol- key for that, so rc_split is unused */
#define RC_SPLIT (CRCInput::RC_MaxRC + 1)
#define RC_TEXT CRCInput::RC_text
#endif
#endif
typedef enum /* object type */ typedef enum /* object type */
{ {
@@ -202,6 +248,7 @@ const char *ObjectType[] =
/* framebuffer stuff */ /* framebuffer stuff */
static unsigned char *lfb = 0; static unsigned char *lfb = 0;
static unsigned char *lbb = 0;
struct fb_var_screeninfo var_screeninfo; struct fb_var_screeninfo var_screeninfo;
struct fb_fix_screeninfo fix_screeninfo; struct fb_fix_screeninfo fix_screeninfo;
@@ -545,7 +592,7 @@ char versioninfo[16];
int hotlist[10]; int hotlist[10];
int maxhotlist; int maxhotlist;
int pig, rc, fb, lcd; int pig, fb, lcd;
int sx, ex, sy, ey; int sx, ex, sy, ey;
int PosX, PosY, StartX, StartY; int PosX, PosY, StartX, StartY;
int lastpage; int lastpage;
@@ -577,7 +624,7 @@ int subtitledelay, delaystarted;
FILE *conf; FILE *conf;
unsigned short RCCode; neutrino_msg_t RCCode;
struct _pid_table struct _pid_table
{ {
@@ -702,11 +749,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Bildschirmformat <20><>" "<EFBFBD> Bildschirmformat <20><>"
"<EFBFBD>3 Standard-Modus 16:9 <20><>" "<EFBFBD>3 Standard-Modus 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Helligkeit <20><>" "<EFBFBD>4 Helligkeit <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparenz <20><>" "<EFBFBD>5 Transparenz <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 nationaler Zeichensatz <20><>" "<EFBFBD>6 nationaler Zeichensatz <20><>"
"<EFBFBD>automatische Erkennung <20><>" "<EFBFBD>automatische Erkennung <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/Language deutsch <20><><EFBFBD>" "<EFBFBD><EFBFBD> Sprache/Language deutsch <20><><EFBFBD>"
@@ -729,11 +776,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Screen format <20><>" "<EFBFBD> Screen format <20><>"
"<EFBFBD>3 Standard mode 16:9 <20><>" "<EFBFBD>3 Standard mode 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Brightness <20><>" "<EFBFBD>4 Brightness <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparency <20><>" "<EFBFBD>5 Transparency <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 national characterset <20><>" "<EFBFBD>6 national characterset <20><>"
"<EFBFBD> automatic recognition <20><>" "<EFBFBD> automatic recognition <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/language english <20><><EFBFBD>" "<EFBFBD><EFBFBD> Sprache/language english <20><><EFBFBD>"
@@ -756,11 +803,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Format de l'#cran <20><>" "<EFBFBD> Format de l'#cran <20><>"
"<EFBFBD>3 Mode standard 16:9 <20><>" "<EFBFBD>3 Mode standard 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Clarte <20><>" "<EFBFBD>4 Clarte <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparence <20><>" "<EFBFBD>5 Transparence <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 police nationale <20><>" "<EFBFBD>6 police nationale <20><>"
"<EFBFBD>reconn. automatique <20><>" "<EFBFBD>reconn. automatique <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/language francais<69><73><EFBFBD>" "<EFBFBD><EFBFBD> Sprache/language francais<69><73><EFBFBD>"
@@ -783,11 +830,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Beeldschermformaat <20><>" "<EFBFBD> Beeldschermformaat <20><>"
"<EFBFBD>3 Standaardmode 16:9 <20><>" "<EFBFBD>3 Standaardmode 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Helderheid <20><>" "<EFBFBD>4 Helderheid <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparantie <20><>" "<EFBFBD>5 Transparantie <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 nationale tekenset <20><>" "<EFBFBD>6 nationale tekenset <20><>"
"<EFBFBD>automatische herkenning <20><>" "<EFBFBD>automatische herkenning <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/Language nederl. <20><><EFBFBD>" "<EFBFBD><EFBFBD> Sprache/Language nederl. <20><><EFBFBD>"
@@ -810,11 +857,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Loqv^ oh|mgr <20><>" "<EFBFBD> Loqv^ oh|mgr <20><>"
"<EFBFBD>3 Tq|por pq|tupor 16:9 <20><>" "<EFBFBD>3 Tq|por pq|tupor 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Kalpq|tgta <20><>" "<EFBFBD>4 Kalpq|tgta <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Diav\\meia <20><>" "<EFBFBD>5 Diav\\meia <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Ehmij^ tuposeiq\\ <20><>" "<EFBFBD>6 Ehmij^ tuposeiq\\ <20><>"
"<EFBFBD>aut|latg amacm~qisg <20><>" "<EFBFBD>aut|latg amacm~qisg <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Ck~ssa/Language ekkgmij\\ <20><><EFBFBD>" "<EFBFBD><EFBFBD> Ck~ssa/Language ekkgmij\\ <20><><EFBFBD>"
@@ -837,11 +884,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Formato schermo <20><>" "<EFBFBD> Formato schermo <20><>"
"<EFBFBD>3 Modo standard 16:9 <20><>" "<EFBFBD>3 Modo standard 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Luminosit{ <20><>" "<EFBFBD>4 Luminosit{ <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Trasparenza <20><>" "<EFBFBD>5 Trasparenza <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 nazionalita'caratteri <20><>" "<EFBFBD>6 nazionalita'caratteri <20><>"
"<EFBFBD> riconoscimento automatico <20><>" "<EFBFBD> riconoscimento automatico <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Lingua/Language Italiana <20><><EFBFBD>" "<EFBFBD><EFBFBD> Lingua/Language Italiana <20><><EFBFBD>"
@@ -864,11 +911,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Format obrazu <20><>" "<EFBFBD> Format obrazu <20><>"
"<EFBFBD>3 Tryb standard 16:9 <20><>" "<EFBFBD>3 Tryb standard 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Jasno|^ <20><>" "<EFBFBD>4 Jasno|^ <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Prze~roczysto|^ <20><>" "<EFBFBD>5 Prze~roczysto|^ <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Znaki charakterystyczne <20><>" "<EFBFBD>6 Znaki charakterystyczne <20><>"
"<EFBFBD> automatyczne rozpozn. <20><>" "<EFBFBD> automatyczne rozpozn. <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> J`zyk/Language polski <20><><EFBFBD>" "<EFBFBD><EFBFBD> J`zyk/Language polski <20><><EFBFBD>"
@@ -891,11 +938,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> TV- format <20><>" "<EFBFBD> TV- format <20><>"
"<EFBFBD>3 Standard l{ge 16:9 <20><>" "<EFBFBD>3 Standard l{ge 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Ljusstyrka <20><>" "<EFBFBD>4 Ljusstyrka <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Genomskinlighet <20><>" "<EFBFBD>5 Genomskinlighet <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7nationell teckenupps{ttning<6E><67>" "<EFBFBD>6nationell teckenupps{ttning<6E><67>"
"<EFBFBD> automatisk igenk{nning <20><>" "<EFBFBD> automatisk igenk{nning <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/language svenska <20><><EFBFBD>" "<EFBFBD><EFBFBD> Sprache/language svenska <20><><EFBFBD>"
@@ -918,11 +965,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> N{ytt|tila <20><>" "<EFBFBD> N{ytt|tila <20><>"
"<EFBFBD>3 Vakiotila 16:9 <20><>" "<EFBFBD>3 Vakiotila 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Kirkkaus <20><>" "<EFBFBD>4 Kirkkaus <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 L{pin{kyvyys <20><>" "<EFBFBD>5 L{pin{kyvyys <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 kansallinen merkist| <20><>" "<EFBFBD>6 kansallinen merkist| <20><>"
"<EFBFBD> automaattinen tunnistus <20><>" "<EFBFBD> automaattinen tunnistus <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Kieli suomi <20><><EFBFBD>" "<EFBFBD><EFBFBD> Kieli suomi <20><><EFBFBD>"
@@ -945,11 +992,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> formato ecran <20><>" "<EFBFBD> formato ecran <20><>"
"<EFBFBD>3 Standard mode 16:9 <20><>" "<EFBFBD>3 Standard mode 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Brilho <20><>" "<EFBFBD>4 Brilho <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparencia <20><>" "<EFBFBD>5 Transparencia <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Caracteres nacionaist <20><>" "<EFBFBD>6 Caracteres nacionaist <20><>"
"<EFBFBD>reconhecimento utomatico <20><>" "<EFBFBD>reconhecimento utomatico <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Lingua Portuguesa <20><><EFBFBD>" "<EFBFBD><EFBFBD> Lingua Portuguesa <20><><EFBFBD>"
@@ -972,11 +1019,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Format kartinki <20><>" "<EFBFBD> Format kartinki <20><>"
"<EFBFBD>3 Stand. revim 16:9 <20><>" "<EFBFBD>3 Stand. revim 16:9 <20><>"
"<EFBFBD> <20><>" "<EFBFBD> <20><>"
"<EFBFBD>5 Qrkostx <20><>" "<EFBFBD>4 Qrkostx <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Prozra~nostx <20><>" "<EFBFBD>5 Prozra~nostx <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Ispolxzuem&j alfawit <20><>" "<EFBFBD>6 Ispolxzuem&j alfawit <20><>"
"<EFBFBD> awtoopredelenie <20><>" "<EFBFBD> awtoopredelenie <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>" "<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Qz&k: Russkij <20><><EFBFBD>" "<EFBFBD><EFBFBD> Qz&k: Russkij <20><><EFBFBD>"

View File

@@ -1,4 +1,6 @@
/* tuxtxt_common.h
* for license info see the other tuxtxt files
*/
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <fcntl.h> #include <fcntl.h>
#include <pthread.h> #include <pthread.h>
@@ -16,6 +18,7 @@
tuxtxt_cache_struct tuxtxt_cache; tuxtxt_cache_struct tuxtxt_cache;
static pthread_mutex_t tuxtxt_cache_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t tuxtxt_cache_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t tuxtxt_cache_biglock = PTHREAD_MUTEX_INITIALIZER;
int tuxtxt_get_zipsize(int p,int sp) int tuxtxt_get_zipsize(int p,int sp)
{ {
tstCachedPage* pg = tuxtxt_cache.astCachetable[p][sp]; tstCachedPage* pg = tuxtxt_cache.astCachetable[p][sp];
@@ -351,6 +354,7 @@ int tuxtxt_GetSubPage(int page, int subpage, int offset)
void tuxtxt_clear_cache(void) void tuxtxt_clear_cache(void)
{ {
pthread_mutex_lock(&tuxtxt_cache_biglock);
pthread_mutex_lock(&tuxtxt_cache_lock); pthread_mutex_lock(&tuxtxt_cache_lock);
int clear_page, clear_subpage, d26; int clear_page, clear_subpage, d26;
tuxtxt_cache.maxadippg = -1; tuxtxt_cache.maxadippg = -1;
@@ -414,6 +418,7 @@ void tuxtxt_clear_cache(void)
printf("TuxTxt cache cleared\n"); printf("TuxTxt cache cleared\n");
#endif #endif
pthread_mutex_unlock(&tuxtxt_cache_lock); pthread_mutex_unlock(&tuxtxt_cache_lock);
pthread_mutex_unlock(&tuxtxt_cache_biglock);
} }
/****************************************************************************** /******************************************************************************
* init_demuxer * * init_demuxer *
@@ -541,6 +546,7 @@ void tuxtxt_allocate_cache(int magazine)
// Lock here as we have a possible race here with // Lock here as we have a possible race here with
// tuxtxt_clear_cache(). We should not be allocating and // tuxtxt_clear_cache(). We should not be allocating and
// freeing at the same time. // freeing at the same time.
// *** this is probably worked around by tuxtxt_cacehe_biglock now *** --seife
pthread_mutex_lock(&tuxtxt_cache_lock); pthread_mutex_lock(&tuxtxt_cache_lock);
/* check cachetable and allocate memory if needed */ /* check cachetable and allocate memory if needed */
@@ -614,6 +620,13 @@ void *tuxtxt_CacheThread(void * /*arg*/)
continue; continue;
} }
/* this "big hammer lock" is a hack: it avoids a crash if
* tuxtxt_clear_cache() is called while the cache thread is in the
* middle of the following loop, leading to tuxtxt_cache.current_page[]
* etc. being set to -1 and tuxtxt_cache.astCachetable[] etc. being set
* to NULL
* it probably also avoids the possible race in tuxtxt_allocate_cache() */
pthread_mutex_lock(&tuxtxt_cache_biglock);
/* analyze it */ /* analyze it */
for (line = 0; line < readcnt/0x2e /*4*/; line++) for (line = 0; line < readcnt/0x2e /*4*/; line++)
{ {
@@ -1055,6 +1068,7 @@ void *tuxtxt_CacheThread(void * /*arg*/)
printf("line %d row %X %X, continue\n", line, vtx_rowbyte[0], vtx_rowbyte[1]); printf("line %d row %X %X, continue\n", line, vtx_rowbyte[0], vtx_rowbyte[1]);
#endif #endif
} }
pthread_mutex_unlock(&tuxtxt_cache_biglock);
} }
pthread_exit(NULL); pthread_exit(NULL);