Merge branch 'master' into pu/fb-setmode

Origin commit data
------------------
Branch: ni/coolstream
Commit: aa5f8e9a65
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:40:47 +01:00
8 changed files with 359 additions and 228 deletions

View File

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

View File

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

View File

@@ -11,6 +11,8 @@
* *
* ported 2009 to HD1 by Coolstream LTD *
* *
* TD, SPARK and AZbox port (C) 2010-2013 Stefan Seyfried *
* *
******************************************************************************/
#include "teletext.h"
@@ -19,6 +21,7 @@
#include <dmx.h>
#include <video.h>
#include <sys/stat.h>
#include <global.h>
#include <system/set_threadname.h>
/* same as in rcinput.h... */
@@ -26,6 +29,12 @@
#define KEY_TTZOOM KEY_FN_2
#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;
static pthread_t ttx_sub_thread;
@@ -36,25 +45,34 @@ static int sub_pid, sub_page;
static bool use_gui;
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
fb_pixel_t *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)
{
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length;
#if !HAVE_TRIPLEDRAGON
unsigned int col = bgra[color][3] << 24 | bgra[color][2] << 16 | bgra[color][1] << 8 | bgra[color][0];
#else
unsigned int col = *((unsigned int*)bgra[color]);
#endif
fb_pixel_t *p = getFBp(&y);
MARK_FB(x, y, w, h);
p += x + y * stride;
if (w > 0)
for (int count = 0; count < h; count++) {
unsigned int * dest0 = (unsigned int *)p;
fb_pixel_t *dest0 = p;
for (int i = 0; i < w; i++)
*(dest0++) = col;
p += fix_screeninfo.line_length;
*(dest0++) = bgra[color];
p += stride;
}
}
void FillBorder(int color)
{
int ys = (var_screeninfo.yres-var_screeninfo.yoffset);
@@ -180,6 +198,9 @@ int toptext_getnext(int startpage, int up, int findgroup)
nextgrp = nextblk = 0;
current = startpage;
if (startpage == 0)
return 0;
do {
if (up)
tuxtxt_next_dec(&current);
@@ -220,6 +241,13 @@ void RenderClearMenuLineBB(char *p, tstPageAttr *attrcol, tstPageAttr *attr)
#if 0
RenderCharBB(' ', attr); /* separator */
#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++)
{
RenderCharBB(*p++, attr);
@@ -242,7 +270,8 @@ void ClearFB(int /*color*/)
//never used
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
int GetCurFontWidth()
@@ -250,6 +279,7 @@ int GetCurFontWidth()
int mx = (displaywidth)%(40-nofirst); // # of unused 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
return fontwidth+(((PosX+fontwidth+1-sx) <= displaywidth && nx <= fontwidth+1) ? 1 : 0);
}
@@ -284,25 +314,14 @@ void setfontwidth(int newwidth)
}
}
#if HAVE_TRIPLEDRAGON
#define _A 0
#define _R 1
#define _G 2
#define _B 3
#else
#define _A 3
#define _R 2
#define _G 1
#define _B 0
#endif
void setcolors(unsigned short *pcolormap, int offset, int number)
{
int i,trans_tmp;
int i,trans_tmp,tr;
int j = offset; /* index in global color table */
trans_tmp=25-trans_mode;
bgra[transp2][_A]=((trans_tmp+7)<<11 | 0x7FF)>>8;
int R = var_screeninfo.red.offset;
int G = var_screeninfo.green.offset;
int B = var_screeninfo.blue.offset;
int A = var_screeninfo.transp.offset;
for (i = 0; i < number; i++)
{
@@ -313,13 +332,17 @@ void setcolors(unsigned short *pcolormap, int offset, int number)
r = (r * (0x3f+(color_mode<<3))) >> 8;
g = (g * (0x3f+(color_mode<<3))) >> 8;
b = (b * (0x3f+(color_mode<<3))) >> 8;
bgra[j][_R]=r;
bgra[j][_G]=g;
bgra[j][_B]=b;
bgra[j] = (r << R) | (g << G) | (b << B) | (0xff << A);
j++;
}
trans_tmp=25-trans_mode;
tr = ((trans_tmp+7)<<11 | 0x7FF)>>8;
bgra[transp2] &= ~(0xff << A); /* clear alpha */
bgra[transp2] |= tr << A;
bgra[menu3] &= ~(0xff << A);
bgra[menu3] |= 0xc0 << A;
bgra[transp] &= ~(0xff << A);
bgra[transp] |= 0;
}
/* hexdump of page contents to stdout for debugging */
@@ -1535,7 +1558,7 @@ static void* reader_thread(void * /*arg*/)
void tuxtx_pause_subtitle(bool 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;
if(!reader_running && sub_pid && sub_page)
tuxtx_main(0, sub_pid, sub_page);
@@ -1572,8 +1595,8 @@ void tuxtx_set_pid(int pid, int page, const char * cc)
sub_page = page;
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
printf("TuxTxt subtitle set pid %d page %d lang %s (%d)\n", sub_pid, sub_page, cc, cfg_national_subset);
ttx_paused = 1;
if(sub_pid && sub_page)
tuxtx_main(0, sub_pid, sub_page);
@@ -1597,7 +1620,7 @@ int tuxtx_subtitle_running(int *pid, int *page, int *running)
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 $";
@@ -1621,14 +1644,18 @@ int tuxtx_main(int _rc, int pid, int page, int source)
printf("TuxTxt %s\n", versioninfo);
printf("for 32bpp framebuffer\n");
fb = -1;
#ifdef USE_FBPAN
if ((fb=open("/dev/fb/0", O_RDWR)) == -1)
{
perror("TuxTxt <open /dev/fb/0>");
return 0;
}
#endif
rc = _rc;
lfb = (unsigned char *) CFrameBuffer::getInstance()->getFrameBufferPointer();
CFrameBuffer *fbp = CFrameBuffer::getInstance();
lfb = fbp->getFrameBufferPointer();
lbb = fbp->getBackBufferPointer();
tuxtxt_cache.vtxtpid = pid;
@@ -1637,8 +1664,7 @@ int tuxtx_main(int _rc, int pid, int page, int source)
else
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 */
if (ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1)
{
@@ -1652,7 +1678,14 @@ int tuxtx_main(int _rc, int pid, int page, int source)
perror("TuxTxt <FBIOGET_VSCREENINFO>");
return 0;
}
#else
struct fb_var_screeninfo *var;
var = fbp->getScreenInfo();
/* this is actually the length of the screen in pixels */
stride = fbp->getStride() / sizeof(fb_pixel_t);
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 */
var_screeninfo.yoffset = 0;
#if 0
@@ -1661,10 +1694,15 @@ int tuxtx_main(int _rc, int pid, int page, int source)
ex = x + w - 10;
ey = y + h - 10;
#endif
int x = CFrameBuffer::getInstance()->getScreenX();
int y = CFrameBuffer::getInstance()->getScreenY();
int w = CFrameBuffer::getInstance()->getScreenWidth();
int h = CFrameBuffer::getInstance()->getScreenHeight();
screen_x = fbp->getScreenX();
screen_y = fbp->getScreenY();
screen_w = fbp->getScreenWidth();
screen_h = fbp->getScreenHeight();
int x = screen_x;
int y = screen_y;
int w = screen_w;
int h = screen_h;
int tx = 0;
if (!screen_mode1)
@@ -1725,6 +1763,7 @@ int tuxtx_main(int _rc, int pid, int page, int source)
SwitchTranspMode();
break; /* and evaluate key */
case RC_TTTV:
case RC_MUTE: /* regular toggle to transparent */
case RC_TEXT:
break;
@@ -1797,20 +1836,25 @@ int tuxtx_main(int _rc, int pid, int page, int source)
case RC_7:
case RC_8:
case RC_9:
PageInput(RCCode - RC_0);
PageInput(CRCInput::getNumericValue(RCCode));
break;
case RC_RED: ColorKey(prev_100); break;
case RC_GREEN: ColorKey(prev_10); break;
case RC_YELLOW: ColorKey(next_10); break;
case RC_BLUE: ColorKey(next_100); break;
case RC_TTZOOM:
case RC_PLUS: SwitchZoomMode(); break;
case RC_SPLIT:
case RC_MINUS: SwitchScreenMode(-1);prevscreenmode = screenmode; break;
case RC_TTTV:
case RC_MUTE: SwitchTranspMode(); break;
case RC_TEXT:
if(transpmode == 1)
RCCode = RC_HOME;
SwitchTranspMode();
break;
case RC_TTREVEAL:
case RC_INFO:
case RC_HELP: SwitchHintMode(); break;
case RC_DBOX: ConfigMenu(0); break;
case RC_HOME:
@@ -1827,7 +1871,8 @@ int tuxtx_main(int _rc, int pid, int page, int source)
/* exit */
CleanUp();
close(fb);
if (fb >= 0)
close(fb);
#if 1
if ( initialized )
@@ -1863,10 +1908,10 @@ FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library plibrary, FT_Pointer /*r
******************************************************************************/
extern std::string ttx_font_file;
static bool ft_init_done = false;
static int oldfontheight = 0;
int Init(int source)
{
int error, i;
unsigned char magazine;
static std::string font_file;
/* init data */
@@ -1874,12 +1919,13 @@ int Init(int source)
//page_atrb[32] = transp<<4 | transp;
inputcounter = 2;
#if TUXTXT_CFG_STANDALONE
unsigned char magazine;
for (magazine = 1; magazine < 9; magazine++)
{
tuxtxt_cache.current_page [magazine] = -1;
tuxtxt_cache.current_subpage [magazine] = -1;
}
#if TUXTXT_CFG_STANDALONE
/* init data */
memset(&tuxtxt_cache.astCachetable, 0, sizeof(tuxtxt_cache.astCachetable));
memset(&tuxtxt_cache.subpagetable, 0xFF, sizeof(tuxtxt_cache.subpagetable));
@@ -2029,7 +2075,7 @@ int Init(int source)
fontwidth_topmenumain = (TV43STARTX-sx) / 40;
fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS;
//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[1] = (fontheight + 1) / 3;
ymosaic[2] = (fontheight * 2 + 1) / 3;
@@ -2071,7 +2117,7 @@ int Init(int source)
}
}
#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");
if(ft_init_done) {
FTC_Manager_Done(manager);
@@ -2121,6 +2167,7 @@ int Init(int source)
}
font_file = ttx_font_file;
ft_init_done = true;
oldfontheight = fontheight;
ascender = (usettf ? fontheight * face->ascender / face->units_per_EM : 16);
}
@@ -2193,7 +2240,6 @@ int Init(int source)
#else
tuxtxt_start(tuxtxt_cache.vtxtpid, source);
#endif
fcntl(rc, F_SETFL, O_NONBLOCK);
gethotlist();
if(use_gui)
@@ -2787,7 +2833,7 @@ void Menu_Init(char *menu, int current_pid, int menuitem, int hotindex)
void ConfigMenu(int Init)
{
int val, menuitem = M_Start;
int menuitem = M_Start;
int current_pid = 0;
int hotindex;
int oldscreenmode, oldtrans = 0;
@@ -2841,23 +2887,18 @@ void ConfigMenu(int Init)
clearbbcolor = black;
Menu_Init(menu, current_pid, menuitem, hotindex);
/* set blocking mode */
val = fcntl(rc, F_GETFL);
fcntl(rc, F_SETFL, val &~ O_NONBLOCK);
/* loop */
do {
if (GetRCCode() == 1)
{
int rc_num = -1;
if (
#if (RC_1 > 0)
RCCode >= RC_1 && /* generates a warning... */
#endif
RCCode <= RC_1+M_MaxDirect) /* direct access */
if (CRCInput::isNumeric(RCCode))
rc_num = CRCInput::getNumericValue(RCCode) -1; /* valid: 1 to M_MaxDirect */
if (rc_num >= 0 && rc_num <= M_MaxDirect) /* direct access */
{
Menu_HighlightLine(menu, MenuLine[menuitem], 0);
menuitem = RCCode-RC_1;
menuitem = rc_num;
Menu_HighlightLine(menu, MenuLine[menuitem], 1);
if (menuitem != M_PID) /* just select */
@@ -3318,7 +3359,6 @@ void ConfigMenu(int Init)
current_service = current_pid;
// RenderMessage(ShowServiceName);
fcntl(rc, F_SETFL, O_NONBLOCK);
RCCode = -1;
if (oldscreenmode)
SwitchScreenMode(oldscreenmode); /* restore divided screen */
@@ -3379,8 +3419,6 @@ void ConfigMenu(int Init)
ClearBB(transp);
CopyBB2FB();
/* reset to nonblocking mode */
fcntl(rc, F_SETFL, O_NONBLOCK);
tuxtxt_cache.pageupdate = 1;
RCCode = -1;
if (oldscreenmode)
@@ -3595,7 +3633,7 @@ void ColorKey(int target)
void PageCatching()
{
int val, byte;
int byte;
int oldzoommode = zoommode;
pagecatching = 1;
@@ -3625,10 +3663,6 @@ void PageCatching()
return;
}
/* set blocking mode */
val = fcntl(rc, F_GETFL);
fcntl(rc, F_SETFL, val &~ O_NONBLOCK);
/* loop */
do {
GetRCCode();
@@ -3667,7 +3701,6 @@ void PageCatching()
case RC_HOME:
case RC_HELP:
case RC_MUTE:
fcntl(rc, F_SETFL, O_NONBLOCK);
tuxtxt_cache.pageupdate = 1;
pagecatching = 0;
RCCode = -1;
@@ -3691,9 +3724,6 @@ void PageCatching()
tuxtxt_cache.subpage = subp;
else
tuxtxt_cache.subpage = 0;
/* reset to nonblocking mode */
fcntl(rc, F_SETFL, O_NONBLOCK);
}
/******************************************************************************
@@ -3925,9 +3955,9 @@ void SwitchScreenMode(int newscreenmode)
if (screenmode==1) /* split with topmenu */
{
int x = CFrameBuffer::getInstance()->getScreenX();
int w = CFrameBuffer::getInstance()->getScreenWidth();
int h = CFrameBuffer::getInstance()->getScreenHeight();
int x = screen_x;
int w = screen_w;
int h = screen_h;
fw = fontwidth_topmenumain;
tx = 0; /* split means we start at the left edge */
@@ -3954,18 +3984,20 @@ void SwitchScreenMode(int newscreenmode)
}
else /* 2: split with full height tv picture */
{
StartX = CFrameBuffer::getInstance()->getScreenX();
StartX = screen_x;
fw = fontwidth_small;
tx = TV169FULLSTARTX;
ty = TV169FULLSTARTY;
tw = TV169FULLWIDTH;
th = TV169FULLHEIGHT;
displaywidth = CFrameBuffer::getInstance()->getScreenWidth()/2;
displaywidth = screen_w / 2;
}
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
int sm = 0;
ioctl(pig, VIDIOC_OVERLAY, &sm);
@@ -3987,8 +4019,8 @@ void SwitchScreenMode(int newscreenmode)
#endif
videoDecoder->Pig(-1, -1, -1, -1);
int x = CFrameBuffer::getInstance()->getScreenX();
int w = CFrameBuffer::getInstance()->getScreenWidth();
int x = screen_x;
int w = screen_w;
//int h = CFrameBuffer::getInstance()->getScreenHeight();
int tx = 0;
/* see comment above on the TTX window dimensions */
@@ -4075,7 +4107,7 @@ void SwitchHintMode()
void RenderDRCS( //FIX ME
unsigned char *s, /* pointer to char data, parity undecoded */
unsigned char *d, /* pointer to frame buffer of top left pixel */
fb_pixel_t *d, /* pointer to frame buffer of top left pixel */
unsigned char *ax, /* array[0..12] of x-offsets, array[0..10] of y-offsets for each pixel */
unsigned char fgcolor, unsigned char bgcolor)
{
@@ -4107,48 +4139,45 @@ void RenderDRCS( //FIX ME
{
// memset(d + ax[x], f1, ax[x+1] - ax[x]);
for (ltmp=0 ; ltmp <= (ax[x+1]-ax[x]); ltmp++)
{
memmove(d + ax[x]*4 +ltmp*4,bgra[f1],4);
}
*(d + ax[x] + ltmp) = bgra[f1];
}
if (ax[x+7] > ax[x+6])
{
// memset(d + ax[x+6], f2, ax[x+7] - ax[x+6]); /* 2nd byte 6 pixels to the right */
for (ltmp=0 ; ltmp <= (ax[x+7]-ax[x+6]); ltmp++)
{
memmove(d + ax[x+6]*4 +ltmp*4,bgra[f2],4);
}
*(d + ax[x+6] + ltmp) = bgra[f2];
}
d += fix_screeninfo.line_length;
d += stride;
}
d -= h * fix_screeninfo.line_length;
d -= h * stride;
}
d += h * fix_screeninfo.line_length;
d += h * stride;
}
}
void DrawVLine(int x, int y, int l, int color)
{
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length;
fb_pixel_t *p = getFBp(&y);
MARK_FB(x, y, 0, l);
p += x + y * stride;
for ( ; l > 0 ; l--)
{
memmove(p,bgra[color],4);
p += fix_screeninfo.line_length;
*p = bgra[color];
p += stride;
}
}
void DrawHLine(int x, int y, int l, int color)
{
int ltmp;
fb_pixel_t *p = getFBp(&y);
MARK_FB(x, y, l, 0);
if (l > 0)
{
for (ltmp=0; ltmp <= l; ltmp++)
{
memmove(lfb + x*4 + ltmp*4 + y * fix_screeninfo.line_length, bgra[color], 4);
}
*(p + x + ltmp + y * stride) = bgra[color];
}
}
@@ -4163,7 +4192,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)
{
unsigned char *p = lfb + x0*4 + y0 * fix_screeninfo.line_length;
fb_pixel_t *p = getFBp(&y0);
MARK_FB(x0, y0, l0, h);
p += x0 + y0 * stride;
int xoffset, l;
int yoffset;
int ltmp;
@@ -4175,17 +4207,18 @@ void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color)
if (l > 0)
{
for (ltmp=0; ltmp <= l; ltmp++)
{
memmove(p + xoffset*4 +ltmp*4, bgra[color], 4);
}
*(p + xoffset + ltmp) = bgra[color];
}
p += fix_screeninfo.line_length;
p += stride;
}
}
void FlipHorz(int x, int y, int w, int h)
{
unsigned char *buf= new unsigned char[w*4];
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length;
fb_pixel_t *p = getFBp(&y);
MARK_FB(x, y, w, h);
p += x + y * stride;
int w1,h1;
if(buf != NULL){
for (h1 = 0 ; h1 < h ; h1++)
@@ -4193,9 +4226,9 @@ void FlipHorz(int x, int y, int w, int h)
memmove(buf,p,w*4);
for (w1 = 0 ; w1 < w ; w1++)
{
memmove(p+w1*4,buf+((w-w1)*4)-4,4);
memmove(p + w1,buf+((w-w1)*4)-4,4);
}
p += fix_screeninfo.line_length;
p += stride;
}
delete [] buf;
}
@@ -4203,13 +4236,17 @@ void FlipHorz(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 *p = lfb + x*4 + y * fix_screeninfo.line_length, *p1, *p2;
fb_pixel_t *p1, *p2;
fb_pixel_t *p = getFBp(&y);
MARK_FB(x, y, w, h);
p += x + y * stride;
int h1;
if(buf != NULL){
for (h1 = 0 ; h1 < h/2 ; h1++)
{
p1 = (p+(h1*fix_screeninfo.line_length));
p2 = (p+(h-(h1+1))*fix_screeninfo.line_length);
p1 = (p + (h1 * stride));
p2 = (p + (h - (h1 + 1)) * stride);
memmove(buf,p1,w*4);
memmove(p1,p2,w*4);
memmove(p2,buf,w*4);
@@ -4464,7 +4501,11 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
else if (*aShapes[Char - 0x20] == S_ADT)
{
int x,y,f,c;
unsigned char* p = lfb + PosX*4 + (PosY+yoffset)* fix_screeninfo.line_length;
y = yoffset;
fb_pixel_t *p = getFBp(&y);
MARK_FB(PosX, PosY, curfontwidth, fontheight);
p += PosX + PosY * stride;
for (y=0; y<fontheight;y++)
{
for (f=0; f<factor; f++)
@@ -4472,9 +4513,9 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
for (x=0; x<curfontwidth*xfactor;x++)
{
c = (y&4 ? (x/3)&1 :((x+3)/3)&1);
memmove((p+x*4),bgra[(c ? fgcolor : bgcolor)],4);
*(p + x) = bgra[(c ? fgcolor : bgcolor)];
}
p += fix_screeninfo.line_length;
p += stride;
}
}
PosX += curfontwidth;
@@ -4508,8 +4549,10 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
return;
}
axdrcs[12] = curfontwidth; /* adjust last x-offset according to position, FIXME: double width */
int y = yoffset;
fb_pixel_t *q = getFBp(&y);
RenderDRCS(p,
lfb + PosX*4 + (yoffset + PosY) * fix_screeninfo.line_length,
q + PosX + PosY * stride,
axdrcs, fgcolor, bgcolor);
}
else
@@ -4775,7 +4818,7 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
}
}
unsigned char *p;
fb_pixel_t *p;
int f; /* running counter for zoom factor */
Row = factor * (ascender - sbit->top + TTFShiftY);
@@ -4784,18 +4827,20 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
if (ascender - sbit->top + TTFShiftY + sbit->height > fontheight)
sbit->height = fontheight - ascender + sbit->top - TTFShiftY; /* limit char height to defined/calculated fontheight */
int y = yoffset;
p = getFBp(&y);
p += PosX + (PosY + Row) * stride; /* 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 :) */
{
int pixtodo = (usettf ? sbit->width : curfontwidth);
char *pstart = (char*) p;
fb_pixel_t *pstart = p;
for (Bit = xfactor * (sbit->left + TTFShiftX); Bit > 0; Bit--) /* fill left margin */
{
for (f = factor-1; f >= 0; f--)
memmove((p + f*fix_screeninfo.line_length),bgra[bgcolor],4);/*bgcolor*/
p+=4;
*(p + f * stride) = bgra[bgcolor];
p++;
if (!usettf)
pixtodo--;
}
@@ -4815,14 +4860,14 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
color = bgcolor;
for (f = factor-1; f >= 0; f--)
memmove((p + f*fix_screeninfo.line_length),bgra[color],4);
p+=4;
*(p + f * stride) = bgra[color];
p++;
if (xfactor > 1) /* double width */
{
for (f = factor-1; f >= 0; f--)
memmove((p + f*fix_screeninfo.line_length),bgra[color],4);
p+=4;
*(p + f * stride) = bgra[color];
p++;
if (!usettf)
pixtodo--;
@@ -4834,11 +4879,11 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset)
Bit > 0; Bit--) /* fill rest of char width */
{
for (f = factor-1; f >= 0; f--)
memmove((p + f*fix_screeninfo.line_length),bgra[bgcolor],4);
p+=4;
*(p + f * stride) = bgra[bgcolor];
p++;
}
p = (unsigned char*) pstart + factor*fix_screeninfo.line_length;
p = pstart + factor * stride;
}
Row = ascender - sbit->top + sbit->height + TTFShiftY;
@@ -5117,8 +5162,8 @@ void DoFlashing(int startrow)
}
PosY += fontheight*factor;
}
}
void RenderPage()
{
int row, col, byte, startrow = 0;;
@@ -5189,7 +5234,7 @@ void RenderPage()
fontwidth_topmenumain = (TV43STARTX-sx) / (40-nofirst);
fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS;
//fontwidth_small = (TV169FULLSTARTX-sx) / (40-nofirst);
fontwidth_small = (CFrameBuffer::getInstance()->getScreenWidth()/2) / (40-nofirst);
fontwidth_small = (screen_w / 2) / (40 - nofirst);
switch(screenmode)
{
case 0:
@@ -5197,7 +5242,7 @@ void RenderPage()
displaywidth = ex - sx;
break;
case 2: setfontwidth(fontwidth_small);
displaywidth = CFrameBuffer::getInstance()->getScreenWidth() / 2;
displaywidth = screen_w / 2;
break;
}
if (transpmode || (boxed && !screenmode))
@@ -5440,7 +5485,7 @@ void CreateLine25()
showlink(3, next_100);
}
if (//tuxtxt_cache.bttok &&
if (tuxtxt_cache.bttok &&
screenmode == 1) /* TOP-Info present, divided screen -> create TOP overview */
{
char line[TOPMENUCHARS];
@@ -5548,8 +5593,11 @@ void CreateLine25()
void CopyBB2FB()
{
unsigned char *src, *dst, *topsrc;
fb_pixel_t *src, *dst, *topsrc;
int fillcolor, i, screenwidth, swtmp;
#ifdef HAVE_SPARK_HARDWARE
CFrameBuffer *f = CFrameBuffer::getInstance();
#endif
/* line 25 */
if (!pagecatching && use_gui)
@@ -5570,12 +5618,16 @@ void CopyBB2FB()
if (ioctl(fb, FBIOPAN_DISPLAY, &var_screeninfo) == -1)
perror("TuxTxt <FBIOPAN_DISPLAY>");
#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
/* adapt background of backbuffer if changed */
if (StartX > 0 && *lfb != *(lfb + fix_screeninfo.line_length * var_screeninfo.yres)) {
FillBorder(*(lfb + fix_screeninfo.line_length * var_screeninfo.yoffset));
if (StartX > 0 && *lfb != *lbb) {
FillBorder(*lbb);
// ClearBB(*(lfb + var_screeninfo.xres * var_screeninfo.yoffset));
}
@@ -5587,8 +5639,11 @@ void CopyBB2FB()
return;
}
src = dst = topsrc = lfb + StartY*fix_screeninfo.line_length;
src = topsrc = lbb + StartY * stride;
dst = lfb + StartY * stride;
#ifdef USE_FBPAN
#error USE_FBPAN code is not working right now.
if (var_screeninfo.yoffset)
dst += fix_screeninfo.line_length * var_screeninfo.yres;
else
@@ -5596,9 +5651,10 @@ void CopyBB2FB()
src += fix_screeninfo.line_length * var_screeninfo.yres;
topsrc += fix_screeninfo.line_length * var_screeninfo.yres;
}
#endif
/* copy line25 in normal height */
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) * stride, src + (24 * fontheight) * stride, stride * fontheight);
if (transpmode)
fillcolor = transp;
@@ -5606,54 +5662,60 @@ void CopyBB2FB()
fillcolor = FullScrColor;
if (zoommode == 2)
src += 12*fontheight*fix_screeninfo.line_length;
src += 12 * fontheight * stride;
/* copy topmenu in normal height (since PIG also keeps dimensions) */
if (screenmode == 1)
{
unsigned char *topdst = dst;
screenwidth = ( TV43STARTX ) * 4;
size_t width = ex * sizeof(fb_pixel_t) - screenwidth;
screenwidth = ( TV43STARTX );
#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
fb_pixel_t *topdst = dst;
size_t width = (ex - screenwidth) * sizeof(fb_pixel_t);
topsrc += screenwidth;
topdst += screenwidth;
for (i=0; i < 24*fontheight; i++)
{
memmove(topdst, topsrc, width);
topdst += fix_screeninfo.line_length;
topsrc += fix_screeninfo.line_length;
topdst += stride;
topsrc += stride;
}
#endif
}
else if (screenmode == 2)
screenwidth = ( TV169FULLSTARTX ) * 4;
screenwidth = ( TV169FULLSTARTX );
else
screenwidth = fix_screeninfo.line_length;//var_screeninfo.xres;
screenwidth = stride;
for (i = StartY; i>0;i--)
{
for (swtmp=0; swtmp<=screenwidth; swtmp++)
{
memmove(dst - i*fix_screeninfo.line_length+swtmp*4, bgra[fillcolor], 4);
}
*(dst - i * stride + swtmp) = bgra[fillcolor];
}
for (i = 12*fontheight; i; i--)
{
memmove(dst, src, screenwidth);
dst += fix_screeninfo.line_length;
memmove(dst, src, screenwidth);
dst += fix_screeninfo.line_length;
src += fix_screeninfo.line_length;
memmove(dst, src, screenwidth * sizeof(fb_pixel_t));
dst += stride;
memmove(dst, src, screenwidth * sizeof(fb_pixel_t));
dst += stride;
src += stride;
}
for (i = var_screeninfo.yres - StartY - 25*fontheight; i >= 0;i--)
{
for (swtmp=0; swtmp<= screenwidth;swtmp++)
{
memmove(dst + fix_screeninfo.line_length*(fontheight+i)+swtmp*4, bgra[fillcolor], 4);
}
*(dst + stride * (fontheight + i) + swtmp) = bgra[fillcolor];
}
#ifdef HAVE_SPARK_HARDWARE
f->mark(0, 0, var_screeninfo.xres, var_screeninfo.yres);
#endif
}
/******************************************************************************
@@ -5971,8 +6033,8 @@ void DecodePage()
RenderDRCS(
page_char + 20 * (DRCSCOLS * row + col + 2),
lfb
+ (StartY + fontheight + DRCSYSPC * row + var_screeninfo.yres - var_screeninfo.yoffset) * fix_screeninfo.line_length
+ (StartX + DRCSXSPC * col)*4,
+ (StartY + fontheight + DRCSYSPC * row + var_screeninfo.yres - var_screeninfo.yoffset) * stride
+ (StartX + DRCSXSPC * col),
ax, white, black);
memset(page_char + 40, 0xff, 24*40); /* don't render any char below row 0 */
@@ -6343,6 +6405,21 @@ void DecodePage()
/******************************************************************************
* 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
int GetRCCode()
{
@@ -6416,7 +6493,7 @@ printf("[tuxtxt] new key, code %X\n", RCCode);
}
RCCode = -1;
usleep(1000000/100);
usleep(1000000/25);
return 0;
}
@@ -6481,6 +6558,7 @@ int GetRCCode()
return 1;
}
#endif
#endif
/* Local Variables: */
/* indent-tabs-mode:t */
/* tab-width:3 */

View File

@@ -12,6 +12,8 @@
* ported 2006 to Dreambox 7025 / 32Bit framebuffer *
* 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
@@ -42,6 +44,8 @@
#include FT_CACHE_H
#include FT_CACHE_SMALL_BITMAPS_H
#include <driver/rcinput.h>
/* devices */
#if TUXTXT_CFG_STANDALONE
@@ -82,20 +86,19 @@ int tv_pip_y;
#define fontwidth_small_lcd 8
#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 TV43WIDTH (TVENDX - TV43STARTX)
// #define TV43HEIGHT (TV43WIDTH *9/16)
// #define TV43STARTY (TVENDY - TV43HEIGHT)
//#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 TV169FULLWIDTH (ex - sx)/2
#define TV169FULLWIDTH (CFrameBuffer::getInstance()->getScreenWidth()/2)
#define TV169FULLWIDTH (screen_w / 2)
#define TV169FULLHEIGHT (ey - sy)
#define TOPMENUSTARTX TV43STARTX+2
#define TOPMENUSTARTX (TV43STARTX+2)
//#define TOPMENUENDX TVENDX
#define TOPMENUSTARTY StartY
#define TOPMENUENDY TV43STARTY
@@ -105,7 +108,7 @@ int tv_pip_y;
#define TOPMENUINDENTGRP 1
#define TOPMENUINDENTDEF 2
#define TOPMENUSPC 0
#define TOPMENUCHARS (TOPMENUINDENTDEF+12+TOPMENUSPC+4)
#define TOPMENUCHARS (TOPMENUINDENTDEF+12+TOPMENUSPC+3)
#define FLOFSIZE 4
@@ -143,6 +146,7 @@ int tv_pip_y;
#define hold_mosaic 0x1E
#define release_mosaic 0x1F
#if 0
/* rc codes */
#define RC_0 0x00
#define RC_1 0x01
@@ -171,6 +175,48 @@ int tv_pip_y;
#define RC_DBOX 0x18
#define RC_TEXT 0x19
#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 */
{
@@ -201,9 +247,11 @@ const char *ObjectType[] =
#define NoServicesFound 3
/* framebuffer stuff */
static unsigned char *lfb = 0;
static fb_pixel_t *lfb = 0;
static fb_pixel_t *lbb = 0;
struct fb_var_screeninfo var_screeninfo;
struct fb_fix_screeninfo fix_screeninfo;
int stride;
/* freetype stuff */
FT_Library library;
@@ -545,7 +593,7 @@ char versioninfo[16];
int hotlist[10];
int maxhotlist;
int pig, rc, fb, lcd;
int pig, fb, lcd;
int sx, ex, sy, ey;
int PosX, PosY, StartX, StartY;
int lastpage;
@@ -577,7 +625,7 @@ int subtitledelay, delaystarted;
FILE *conf;
unsigned short RCCode;
neutrino_msg_t RCCode;
struct _pid_table
{
@@ -702,11 +750,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Bildschirmformat <20><>"
"<EFBFBD>3 Standard-Modus 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Helligkeit <20><>"
"<EFBFBD>4 Helligkeit <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparenz <20><>"
"<EFBFBD>5 Transparenz <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 nationaler Zeichensatz <20><>"
"<EFBFBD>6 nationaler Zeichensatz <20><>"
"<EFBFBD>automatische Erkennung <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/Language deutsch <20><><EFBFBD>"
@@ -729,11 +777,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Screen format <20><>"
"<EFBFBD>3 Standard mode 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Brightness <20><>"
"<EFBFBD>4 Brightness <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparency <20><>"
"<EFBFBD>5 Transparency <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 national characterset <20><>"
"<EFBFBD>6 national characterset <20><>"
"<EFBFBD> automatic recognition <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/language english <20><><EFBFBD>"
@@ -756,11 +804,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Format de l'#cran <20><>"
"<EFBFBD>3 Mode standard 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Clarte <20><>"
"<EFBFBD>4 Clarte <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparence <20><>"
"<EFBFBD>5 Transparence <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 police nationale <20><>"
"<EFBFBD>6 police nationale <20><>"
"<EFBFBD>reconn. automatique <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/language francais<69><73><EFBFBD>"
@@ -783,11 +831,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Beeldschermformaat <20><>"
"<EFBFBD>3 Standaardmode 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Helderheid <20><>"
"<EFBFBD>4 Helderheid <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparantie <20><>"
"<EFBFBD>5 Transparantie <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 nationale tekenset <20><>"
"<EFBFBD>6 nationale tekenset <20><>"
"<EFBFBD>automatische herkenning <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/Language nederl. <20><><EFBFBD>"
@@ -810,11 +858,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Loqv^ oh|mgr <20><>"
"<EFBFBD>3 Tq|por pq|tupor 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Kalpq|tgta <20><>"
"<EFBFBD>4 Kalpq|tgta <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Diav\\meia <20><>"
"<EFBFBD>5 Diav\\meia <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Ehmij^ tuposeiq\\ <20><>"
"<EFBFBD>6 Ehmij^ tuposeiq\\ <20><>"
"<EFBFBD>aut|latg amacm~qisg <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Ck~ssa/Language ekkgmij\\ <20><><EFBFBD>"
@@ -837,11 +885,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Formato schermo <20><>"
"<EFBFBD>3 Modo standard 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Luminosit{ <20><>"
"<EFBFBD>4 Luminosit{ <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Trasparenza <20><>"
"<EFBFBD>5 Trasparenza <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 nazionalita'caratteri <20><>"
"<EFBFBD>6 nazionalita'caratteri <20><>"
"<EFBFBD> riconoscimento automatico <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Lingua/Language Italiana <20><><EFBFBD>"
@@ -864,11 +912,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Format obrazu <20><>"
"<EFBFBD>3 Tryb standard 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Jasno|^ <20><>"
"<EFBFBD>4 Jasno|^ <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Prze~roczysto|^ <20><>"
"<EFBFBD>5 Prze~roczysto|^ <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Znaki charakterystyczne <20><>"
"<EFBFBD>6 Znaki charakterystyczne <20><>"
"<EFBFBD> automatyczne rozpozn. <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> J`zyk/Language polski <20><><EFBFBD>"
@@ -891,11 +939,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> TV- format <20><>"
"<EFBFBD>3 Standard l{ge 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Ljusstyrka <20><>"
"<EFBFBD>4 Ljusstyrka <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Genomskinlighet <20><>"
"<EFBFBD>5 Genomskinlighet <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7nationell teckenupps{ttning<6E><67>"
"<EFBFBD>6nationell teckenupps{ttning<6E><67>"
"<EFBFBD> automatisk igenk{nning <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Sprache/language svenska <20><><EFBFBD>"
@@ -918,11 +966,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> N{ytt|tila <20><>"
"<EFBFBD>3 Vakiotila 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Kirkkaus <20><>"
"<EFBFBD>4 Kirkkaus <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 L{pin{kyvyys <20><>"
"<EFBFBD>5 L{pin{kyvyys <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 kansallinen merkist| <20><>"
"<EFBFBD>6 kansallinen merkist| <20><>"
"<EFBFBD> automaattinen tunnistus <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Kieli suomi <20><><EFBFBD>"
@@ -945,11 +993,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> formato ecran <20><>"
"<EFBFBD>3 Standard mode 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Brilho <20><>"
"<EFBFBD>4 Brilho <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Transparencia <20><>"
"<EFBFBD>5 Transparencia <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Caracteres nacionaist <20><>"
"<EFBFBD>6 Caracteres nacionaist <20><>"
"<EFBFBD>reconhecimento utomatico <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Lingua Portuguesa <20><><EFBFBD>"
@@ -972,11 +1020,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] =
"<EFBFBD> Format kartinki <20><>"
"<EFBFBD>3 Stand. revim 16:9 <20><>"
"<EFBFBD> <20><>"
"<EFBFBD>5 Qrkostx <20><>"
"<EFBFBD>4 Qrkostx <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>6 Prozra~nostx <20><>"
"<EFBFBD>5 Prozra~nostx <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD>7 Ispolxzuem&j alfawit <20><>"
"<EFBFBD>6 Ispolxzuem&j alfawit <20><>"
"<EFBFBD> awtoopredelenie <20><>"
"<EFBFBD><EFBFBD> <20><><EFBFBD>"
"<EFBFBD><EFBFBD> Qz&k: Russkij <20><><EFBFBD>"
@@ -1201,33 +1249,8 @@ const unsigned short defaultcolors[] = /* 0x0bgr */
0x420, 0x210, 0x420, 0x000, 0x000
};
#if !HAVE_TRIPLEDRAGON
/* 32bit colortable */
unsigned char bgra[][5] = {
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xC0", "\0\0\0\x00",
"\0\0\0\x33" };
#else
/* actually "ARGB" */
unsigned char bgra[][5] = {
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0",
"\xFF\0\0\0", "\xFF\0\0\0", "\xC0\0\0\0", "\x00\0\0\0",
"\x33\0\0\0" };
#endif
/* filled in setcolors() */
fb_pixel_t bgra[SIZECOLTABLE];
/* old 8bit color table */
unsigned short rd0[] = {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0x00<<8, 0x00<<8, 0x00<<8, 0, 0 };

View File

@@ -1,4 +1,6 @@
/* tuxtxt_common.h
* for license info see the other tuxtxt files
*/
#include <sys/ioctl.h>
#include <fcntl.h>
#include <pthread.h>
@@ -16,6 +18,7 @@
tuxtxt_cache_struct tuxtxt_cache;
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)
{
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)
{
pthread_mutex_lock(&tuxtxt_cache_biglock);
pthread_mutex_lock(&tuxtxt_cache_lock);
int clear_page, clear_subpage, d26;
tuxtxt_cache.maxadippg = -1;
@@ -414,6 +418,7 @@ void tuxtxt_clear_cache(void)
printf("TuxTxt cache cleared\n");
#endif
pthread_mutex_unlock(&tuxtxt_cache_lock);
pthread_mutex_unlock(&tuxtxt_cache_biglock);
}
/******************************************************************************
* init_demuxer *
@@ -541,6 +546,7 @@ void tuxtxt_allocate_cache(int magazine)
// Lock here as we have a possible race here with
// tuxtxt_clear_cache(). We should not be allocating and
// freeing at the same time.
// *** this is probably worked around by tuxtxt_cacehe_biglock now *** --seife
pthread_mutex_lock(&tuxtxt_cache_lock);
/* check cachetable and allocate memory if needed */
@@ -614,6 +620,13 @@ void *tuxtxt_CacheThread(void * /*arg*/)
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 */
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]);
#endif
}
pthread_mutex_unlock(&tuxtxt_cache_biglock);
}
pthread_exit(NULL);

View File

@@ -126,6 +126,7 @@ class CFbAccelCSHD2
void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false);
void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff);
fb_pixel_t * getBackBufferPointer() const;
void setBlendMode(uint8_t);
void setBlendLevel(int);
int scaleFont(int size);
@@ -175,6 +176,7 @@ class CFbAccelTD
void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col);
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp);
void waitForIdle(const char *func = NULL);
fb_pixel_t * getBackBufferPointer() const;
void setBlendMode(uint8_t);
void setBlendLevel(int);
};

View File

@@ -267,6 +267,11 @@ max res 1920x1080
return 0; /* dont fail because of this */
}
fb_pixel_t * CFbAccelCSHD2::getBackBufferPointer() const
{
return backbuffer;
}
void CFbAccelCSHD2::setBlendMode(uint8_t mode)
{
if (ioctl(fd, FBIO_SETBLENDMODE, mode))

View File

@@ -202,3 +202,8 @@ void CFbAccelTD::setBlendLevel(int level)
if (level == 100) // sucks
usleep(20000);
}
fb_pixel_t *CFbAccelTD::getBackBufferPointer() const
{
return backbuffer;
}