summaryrefslogtreecommitdiff
path: root/osd.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-06-16 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-06-16 18:00:00 +0200
commitf06d2c27fca449148d9d8fac19d81c668744f170 (patch)
tree8f21a604339719672bf7ab8b6e9d69bfa1817ac5 /osd.c
parentd07e3829f7c44d713b2677ef73f864af80b3dea3 (diff)
downloadvdr-patch-lnbsharing-f06d2c27fca449148d9d8fac19d81c668744f170.tar.gz
vdr-patch-lnbsharing-f06d2c27fca449148d9d8fac19d81c668744f170.tar.bz2
Version 1.1.3vdr-1.1.3
- Improved the VDR Makefile to avoid a warning if the '.dependencies' file does not exist, and also using $(MAKE) to call recursive makes. - Changed the name of the 'package' target in the plugin Makefiles to 'dist' (following the suggestions in the "GNU Make" manual). If you already have started a plugin project, you may want to change this in your Makefile accordingly. - Improved the plugin Makefile to avoid a warning if the '.dependencies' file does not exist, and also using $(shell...) to get the version numbers. If you already have started a plugin project, you may want to change this in your Makefile accordingly. - Fixed some function headers to make them compile with gcc 3.x (thanks to Gregoire Favre). - Fixed the cutting mechanism to make it re-sync in case a frame is larger than the buffer (thanks to Sven Grothklags). - Added an error message if the directory specified in the '-L' option can't be accessed (suggested by Stefan Huelswitt). - Rearranged OSD class names to make 'cOsd' available for the main OSD interface. - Completely moved OSD handling out of the cDvbApi class, into the new cOsd. - Implemented cStatus to allow plugins to set up a status monitor. See PLUGINS.html for details. - Moved the cEITScanner out of dvbapi.h/.c, into the new eitscan.h/.c. - Added Swedish language texts (thanks to Tomas Prybil). - Fixed parsing 'E' records in epg2html.pl (thanks to Matthias Fechner for pointing out this one). - Removed compiler option '-m486' to make it work on non-Intel platforms. If you have already started a plugin project, you may want to make sure you remove this option from your existing Makefile. - Completely rearranged the recording and replay functions to make them available to plugins. - Replay is now done in a single thread (no more syncing between input and output thread necessary). - It is now possible to record several channels on the same transponder with "budget cards". VDR automatically attaches a recording timer to a card that already records on the appropriate transponder. How many parallel recordings can actually be done depends on the computer's performance. Currently any number of recordings gets attached to a card, so you should carefully plan your timers to not exceed the limit. On a K6-II/450 it was possible to record three channels from transponder 12480 with a single WinTV NOVA-S. - Timers that record two successive shows on the same channel may now overlap and will use the same DVB card. During the time where both timers record the data is simply saved to both files. - The following limitations apply to this version: + Transfer mode doesn't work yet. + The '-a' option (for Dolby Digital audio) doesn't work yet. + Switching between different language tracks doesn't work yet. + Cutting doesn't work yet.
Diffstat (limited to 'osd.c')
-rw-r--r--osd.c243
1 files changed, 240 insertions, 3 deletions
diff --git a/osd.c b/osd.c
index 6feeaa8..1092187 100644
--- a/osd.c
+++ b/osd.c
@@ -4,12 +4,243 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 1.25 2002/05/12 11:38:39 kls Exp $
+ * $Id: osd.c 1.29 2002/06/16 13:24:00 kls Exp $
*/
#include "osd.h"
#include <string.h>
+#include "device.h"
#include "i18n.h"
+#include "status.h"
+
+// --- cOsd ------------------------------------------------------------------
+
+#ifdef DEBUG_OSD
+ WINDOW *cOsd::window = NULL;
+ int cOsd::colorPairs[MaxColorPairs] = { 0 };
+#else
+ cDvbOsd *cOsd::osd = NULL;
+#endif
+ int cOsd::cols = 0;
+ int cOsd::rows = 0;
+
+void cOsd::Initialize(void)
+{
+#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
+ initscr();
+ keypad(stdscr, true);
+ nonl();
+ cbreak();
+ noecho();
+ timeout(10);
+#endif
+#if defined(DEBUG_OSD)
+ start_color();
+ leaveok(stdscr, true);
+#endif
+}
+
+void cOsd::Shutdown(void)
+{
+ Close();
+#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
+ endwin();
+#endif
+}
+
+#ifdef DEBUG_OSD
+void cOsd::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 cOsd::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(cDevice::PrimaryDevice()->OsdDeviceHandle(), 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 cOsd::Close(void)
+{
+#ifdef DEBUG_OSD
+ if (window) {
+ delwin(window);
+ window = 0;
+ }
+#else
+ delete osd;
+ osd = NULL;
+#endif
+}
+
+void cOsd::Clear(void)
+{
+#ifdef DEBUG_OSD
+ SetColor(clrBackground, clrBackground);
+ Fill(0, 0, cols, rows, clrBackground);
+#else
+ osd->Clear();
+#endif
+}
+
+void cOsd::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 cOsd::SetBitmap(int x, int y, const cBitmap &Bitmap)
+{
+#ifndef DEBUG_OSD
+ osd->SetBitmap(x, y, Bitmap);
+#endif
+}
+
+void cOsd::ClrEol(int x, int y, eDvbColor color)
+{
+ Fill(x, y, cols - x, 1, color);
+}
+
+int cOsd::CellWidth(void)
+{
+#ifdef DEBUG_OSD
+ return 1;
+#else
+ return charWidth;
+#endif
+}
+
+int cOsd::LineHeight(void)
+{
+#ifdef DEBUG_OSD
+ return 1;
+#else
+ return lineHeight;
+#endif
+}
+
+int cOsd::Width(unsigned char c)
+{
+#ifdef DEBUG_OSD
+ return 1;
+#else
+ return osd->Width(c);
+#endif
+}
+
+int cOsd::WidthInCells(const char *s)
+{
+#ifdef DEBUG_OSD
+ return strlen(s);
+#else
+ return (osd->Width(s) + charWidth - 1) / charWidth;
+#endif
+}
+
+eDvbFont cOsd::SetFont(eDvbFont Font)
+{
+#ifdef DEBUG_OSD
+ return Font;
+#else
+ return osd->SetFont(Font);
+#endif
+}
+
+void cOsd::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 cOsd::Flush(void)
+{
+#ifdef DEBUG_OSD
+ refresh();
+#else
+ if (osd)
+ osd->Flush();
+#endif
+}
// --- cOsdItem --------------------------------------------------------------
@@ -200,8 +431,11 @@ void cOsdMenu::Display(void)
}
for (int i = first; i < count; i++) {
cOsdItem *item = Get(i);
- if (item)
+ if (item) {
item->Display(i - first, i == current ? clrBlack : clrWhite, i == current ? clrCyan : clrBackground);
+ if (i == current)
+ cStatus::MsgOsdCurrentItem(item->Text());
+ }
if (++n == MAXOSDITEMS) //TODO get this from Interface!!!
break;
}
@@ -225,8 +459,11 @@ void cOsdMenu::RefreshCurrent(void)
void cOsdMenu::DisplayCurrent(bool Current)
{
cOsdItem *item = Get(current);
- if (item)
+ if (item) {
item->Display(current - first, Current ? clrBlack : clrWhite, Current ? clrCyan : clrBackground);
+ if (Current)
+ cStatus::MsgOsdCurrentItem(item->Text());
+ }
}
void cOsdMenu::Clear(void)