diff options
Diffstat (limited to 'dvbapi.c')
-rw-r--r-- | dvbapi.c | 223 |
1 files changed, 4 insertions, 219 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.176 2002/05/18 09:21:39 kls Exp $ + * $Id: dvbapi.c 1.177 2002/05/18 14:03:17 kls Exp $ */ #include "dvbapi.h" @@ -1759,24 +1759,7 @@ cDvbApi::cDvbApi(int n) } else esyslog("ERROR: can't open video device %d", n); - cols = rows = 0; - -#if defined(DEBUG_OSD) || defined(REMOTE_KBD) - initscr(); - keypad(stdscr, true); - nonl(); - cbreak(); - noecho(); - timeout(10); -#endif -#if defined(DEBUG_OSD) - memset(&colorPairs, 0, sizeof(colorPairs)); - start_color(); - leaveok(stdscr, true); - window = NULL; -#else - osd = NULL; -#endif + currentChannel = 1; mute = false; volume = Setup.CurrentVolume; @@ -1785,15 +1768,11 @@ cDvbApi::cDvbApi(int n) cDvbApi::~cDvbApi() { delete siProcessor; - Close(); StopReplay(); StopRecord(); StopTransfer(); // We're not explicitly closing any device files here, since this sometimes // caused segfaults. Besides, the program is about to terminate anyway... -#if defined(DEBUG_OSD) || defined(REMOTE_KBD) - endwin(); -#endif } void cDvbApi::SetUseDvbApi(int n) @@ -1923,7 +1902,7 @@ bool cDvbApi::Probe(const char *FileName) return false; } -bool cDvbApi::Init(void) +bool cDvbApi::Initialize(void) { NumDvbApis = 0; for (int i = 0; i < MAXDVBAPI; i++) { @@ -1943,7 +1922,7 @@ bool cDvbApi::Init(void) return NumDvbApis > 0; } -void cDvbApi::Cleanup(void) +void cDvbApi::Shutdown(void) { for (int i = 0; i < NumDvbApis; i++) { delete dvbApi[i]; @@ -2045,200 +2024,6 @@ bool cDvbApi::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, return false; } -#ifdef DEBUG_OSD -void cDvbApi::SetColor(eDvbColor colorFg, eDvbColor colorBg) -{ - int color = (colorBg << 16) | colorFg | 0x80000000; - for (int i = 0; i < MaxColorPairs; i++) { - if (!colorPairs[i]) { - colorPairs[i] = color; - init_pair(i + 1, colorFg, colorBg); - wattrset(window, COLOR_PAIR(i + 1)); - break; - } - else if (color == colorPairs[i]) { - wattrset(window, COLOR_PAIR(i + 1)); - break; - } - } -} -#endif - -void cDvbApi::Open(int w, int h) -{ - int d = (h < 0) ? Setup.OSDheight + h : 0; - h = abs(h); - cols = w; - rows = h; -#ifdef DEBUG_OSD - window = subwin(stdscr, h, w, d, (Setup.OSDwidth - w) / 2); - syncok(window, true); - #define B2C(b) (((b) * 1000) / 255) - #define SETCOLOR(n, r, g, b, o) init_color(n, B2C(r), B2C(g), B2C(b)) - //XXX - SETCOLOR(clrBackground, 0x00, 0x00, 0x00, 127); // background 50% gray - SETCOLOR(clrBlack, 0x00, 0x00, 0x00, 255); - SETCOLOR(clrRed, 0xFC, 0x14, 0x14, 255); - SETCOLOR(clrGreen, 0x24, 0xFC, 0x24, 255); - SETCOLOR(clrYellow, 0xFC, 0xC0, 0x24, 255); - SETCOLOR(clrBlue, 0x00, 0x00, 0xFC, 255); - SETCOLOR(clrCyan, 0x00, 0xFC, 0xFC, 255); - SETCOLOR(clrMagenta, 0xB0, 0x00, 0xFC, 255); - SETCOLOR(clrWhite, 0xFC, 0xFC, 0xFC, 255); -#else - w *= charWidth; - h *= lineHeight; - d *= lineHeight; - int x = (720 - w + charWidth) / 2; //TODO PAL vs. NTSC??? - int y = (576 - Setup.OSDheight * lineHeight) / 2 + d; - //XXX - osd = new cDvbOsd(fd_osd, x, y); - //XXX TODO this should be transferred to the places where the individual windows are requested (there's too much detailed knowledge here!) - if (h / lineHeight == 5) { //XXX channel display - osd->Create(0, 0, w, h, 4); - } - else if (h / lineHeight == 1) { //XXX info display - osd->Create(0, 0, w, h, 4); - } - else if (d == 0) { //XXX full menu - osd->Create(0, 0, w, lineHeight, 2); - osd->Create(0, lineHeight, w, (Setup.OSDheight - 3) * lineHeight, 2); - osd->AddColor(clrBackground); - osd->AddColor(clrCyan); - osd->AddColor(clrWhite); - osd->AddColor(clrBlack); - osd->Create(0, (Setup.OSDheight - 2) * lineHeight, w, 2 * lineHeight, 4); - } - else { //XXX progress display - /*XXX - osd->Create(0, 0, w, lineHeight, 1); - osd->Create(0, lineHeight, w, lineHeight, 2, false); - osd->Create(0, 2 * lineHeight, w, lineHeight, 1); - XXX*///XXX some pixels are not drawn correctly with lower bpp values - osd->Create(0, 0, w, 3*lineHeight, 4); - } -#endif -} - -void cDvbApi::Close(void) -{ -#ifdef DEBUG_OSD - if (window) { - delwin(window); - window = 0; - } -#else - delete osd; - osd = NULL; -#endif -} - -void cDvbApi::Clear(void) -{ -#ifdef DEBUG_OSD - SetColor(clrBackground, clrBackground); - Fill(0, 0, cols, rows, clrBackground); -#else - osd->Clear(); -#endif -} - -void cDvbApi::Fill(int x, int y, int w, int h, eDvbColor color) -{ - if (x < 0) x = cols + x; - if (y < 0) y = rows + y; -#ifdef DEBUG_OSD - SetColor(color, color); - for (int r = 0; r < h; r++) { - wmove(window, y + r, x); // ncurses wants 'y' before 'x'! - whline(window, ' ', w); - } - wsyncup(window); // shouldn't be necessary because of 'syncok()', but w/o it doesn't work -#else - osd->Fill(x * charWidth, y * lineHeight, (x + w) * charWidth - 1, (y + h) * lineHeight - 1, color); -#endif -} - -void cDvbApi::SetBitmap(int x, int y, const cBitmap &Bitmap) -{ -#ifndef DEBUG_OSD - osd->SetBitmap(x, y, Bitmap); -#endif -} - -void cDvbApi::ClrEol(int x, int y, eDvbColor color) -{ - Fill(x, y, cols - x, 1, color); -} - -int cDvbApi::CellWidth(void) -{ -#ifdef DEBUG_OSD - return 1; -#else - return charWidth; -#endif -} - -int cDvbApi::LineHeight(void) -{ -#ifdef DEBUG_OSD - return 1; -#else - return lineHeight; -#endif -} - -int cDvbApi::Width(unsigned char c) -{ -#ifdef DEBUG_OSD - return 1; -#else - return osd->Width(c); -#endif -} - -int cDvbApi::WidthInCells(const char *s) -{ -#ifdef DEBUG_OSD - return strlen(s); -#else - return (osd->Width(s) + charWidth - 1) / charWidth; -#endif -} - -eDvbFont cDvbApi::SetFont(eDvbFont Font) -{ -#ifdef DEBUG_OSD - return Font; -#else - return osd->SetFont(Font); -#endif -} - -void cDvbApi::Text(int x, int y, const char *s, eDvbColor colorFg, eDvbColor colorBg) -{ - if (x < 0) x = cols + x; - if (y < 0) y = rows + y; -#ifdef DEBUG_OSD - SetColor(colorFg, colorBg); - wmove(window, y, x); // ncurses wants 'y' before 'x'! - waddnstr(window, s, cols - x); -#else - osd->Text(x * charWidth, y * lineHeight, s, colorFg, colorBg); -#endif -} - -void cDvbApi::Flush(void) -{ -#ifdef DEBUG_OSD - refresh(); -#else - if (osd) - osd->Flush(); -#endif -} - int cDvbApi::Priority(void) { return (this == PrimaryDvbApi && !Recording()) ? Setup.PrimaryLimit - 1 : priority; |