summaryrefslogtreecommitdiff
path: root/osd.c
diff options
context:
space:
mode:
authorAndreas Regel <andreas.regel@powarman.de>2005-05-15 12:48:00 +0200
committerAndreas Regel <andreas.regel@powarman.de>2005-05-15 12:48:00 +0200
commit4df61fcc16983f71ca5ab1d539840f7d04b9d48f (patch)
tree9768dc226dc0205f9f833e9ce6c6bf5eff4600cc /osd.c
parentf4460a2d3b0123c25b398b3c0168604bae2d15ba (diff)
downloadvdr-plugin-osdpip-4df61fcc16983f71ca5ab1d539840f7d04b9d48f.tar.gz
vdr-plugin-osdpip-4df61fcc16983f71ca5ab1d539840f7d04b9d48f.tar.bz2
Release version 0.0.8v0.0.8
- Added Navigation through channel in a way like with ordinary VDR. Use the Left/Right keys to select channel groups, OK to choose one or the number keys to directly enter a channel number. All this only works with enabled info window. - Extended the info window to contain more information. The amount of information shown can be chosen through the setup menu. This directly affects the height of the info window. - Using the info window to show vdr messages if they occur. - Changed the manner the moving of the PiP window works. Now move mode is enabled or disabled by pressing the green button. In move mode, the cursor keys can be used to move the PiP window. - Added some more predefined PiP window sizes. You have to reset your size in setup menu. - Added support for ffmpeg 0.4.9 (should work with 0.4.8, too) - Updated finnish translations (thanks to Rolf Ahrenberg) - Cleaned up, dropped support for vdr versions older than 1.3.8
Diffstat (limited to 'osd.c')
-rw-r--r--osd.c491
1 files changed, 127 insertions, 364 deletions
diff --git a/osd.c b/osd.c
index e7e2ca0..2b0822f 100644
--- a/osd.c
+++ b/osd.c
@@ -12,6 +12,9 @@
#include <vdr/ringbuffer.h>
#include <vdr/remux.h>
+#include <vdr/thread.h>
+
+cMutex Mutex;
cOsdPipObject::cOsdPipObject(cDevice *Device, const cChannel *Channel)
: cOsdObject(true)
@@ -22,14 +25,11 @@ cOsdPipObject::cOsdPipObject(cDevice *Device, const cChannel *Channel)
m_Active = false;
m_Ready = false;
-#if VDRVERSNUM >= 10307
m_Reset = true;
-#endif
+ m_MoveMode = false;
m_Width = m_Height = -1;
m_Bitmap = NULL;
- m_BitmapInfo = NULL;
- m_ShowTime = 0;
- m_ShowInfo = false;
+ m_InfoWindow = NULL;
m_AlphaBase = 0xFF000000;
for (int i = 0; i < 256; i++)
@@ -49,8 +49,7 @@ cOsdPipObject::~cOsdPipObject()
delete m_ESBuffer;
if (m_Bitmap != NULL)
delete m_Bitmap;
- if (m_BitmapInfo != NULL)
- delete m_BitmapInfo;
+ delete m_InfoWindow;
if (m_Osd != NULL)
delete m_Osd;
}
@@ -129,54 +128,62 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length)
if (!m_Ready)
{
-#if VDRVERSNUM >= 10307
if (m_Bitmap != NULL)
delete m_Bitmap;
- if (m_BitmapInfo != NULL)
- delete m_BitmapInfo;
-#endif
+ m_Bitmap = NULL;
+ if (m_InfoWindow != NULL)
+ delete m_InfoWindow;
+ m_InfoWindow = NULL;
switch (OsdPipSetup.Size)
{
- case 0: m_Width = 120; m_Height = 96; break;
- case 1: m_Width = 160; m_Height = 128; break;
- case 2: m_Width = 200; m_Height = 160; break;
- case 3: m_Width = 240; m_Height = 192; break;
- case 4: m_Width = 280; m_Height = 224; break;
- case 5: m_Width = 320; m_Height = 256; break;
+ case 0: m_Width = 100; m_Height = 80; break;
+ case 1: m_Width = 120; m_Height = 96; break;
+ case 2: m_Width = 140; m_Height = 112; break;
+ case 3: m_Width = 160; m_Height = 128; break;
+ case 4: m_Width = 180; m_Height = 144; break;
+ case 5: m_Width = 200; m_Height = 160; break;
+ case 6: m_Width = 220; m_Height = 176; break;
+ case 7: m_Width = 240; m_Height = 192; break;
+ case 8: m_Width = 260; m_Height = 208; break;
+ case 9: m_Width = 280; m_Height = 224; break;
+ case 10: m_Width = 300; m_Height = 240; break;
}
-#if VDRVERSNUM >= 10307
- if (OsdPipSetup.ShowInfo)
+ if (OsdPipSetup.ShowInfo > 0)
{
+ int infoX = 0;
+ int infoY = 0;
+ int infoH = OsdPipSetup.ShowInfo * 30;
+
switch (OsdPipSetup.InfoPosition)
{
case kInfoTopLeft:
- m_InfoX = Setup.OSDLeft;
- m_InfoY = Setup.OSDTop;
+ infoX = Setup.OSDLeft;
+ infoY = Setup.OSDTop;
break;
case kInfoTopRight:
- m_InfoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth;
- m_InfoY = Setup.OSDTop;
+ infoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth;
+ infoY = Setup.OSDTop;
break;
case kInfoBottomLeft:
- m_InfoX = Setup.OSDLeft;
- m_InfoY = Setup.OSDTop + Setup.OSDHeight - 60;
+ infoX = Setup.OSDLeft;
+ infoY = Setup.OSDTop + Setup.OSDHeight - infoH;
break;
case kInfoBottomRight:
- m_InfoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth;
- m_InfoY = Setup.OSDTop + Setup.OSDHeight - 60;
+ infoX = Setup.OSDLeft + Setup.OSDWidth - OsdPipSetup.InfoWidth;
+ infoY = Setup.OSDTop + Setup.OSDHeight - infoH;
break;
}
tArea areas[] =
{
{ OsdPipSetup.XPosition, OsdPipSetup.YPosition, OsdPipSetup.XPosition + m_Width - 1, OsdPipSetup.YPosition + m_Height - 1, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8 },
- { m_InfoX, m_InfoY, m_InfoX + OsdPipSetup.InfoWidth - 1, m_InfoY + 60 - 1, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8 }
+ { infoX, infoY, infoX + OsdPipSetup.InfoWidth - 1, infoY + infoH - 1, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8 }
};
if (m_Osd->CanHandleAreas(areas, 2) == oeOk)
m_Osd->SetAreas(areas, 2);
else
m_Osd->SetAreas(areas, 1);
m_Bitmap = new cBitmap(m_Width, m_Height, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8);
- m_BitmapInfo = new cBitmap(OsdPipSetup.InfoWidth, 60, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8);
+ m_InfoWindow = new cOsdInfoWindow(m_Osd, m_Palette, infoX, infoY);
}
else
{
@@ -188,6 +195,7 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length)
m_Bitmap = new cBitmap(m_Width, m_Height, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8);
}
+ Mutex.Lock();
if (OsdPipSetup.ColorDepth == kDepthGrey256)
{
for (int i = 0; i < 256; i++)
@@ -207,59 +215,7 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length)
m_Palette[0] = 0xFD000000;
m_Palette[255] = 0xFDFFFFFF;
}
-#else
- if (OsdPipSetup.ShowInfo)
- {
- int x = 0;
- int y = 0;
- switch (OsdPipSetup.InfoPosition)
- {
- case kInfoTopLeft:
- x = (720 - (Setup.OSDwidth * cOsd::CellWidth())) / 2;
- y = (576 - (Setup.OSDheight * cOsd::LineHeight())) / 2;
- break;
- case kInfoTopRight:
- x = (720 + (Setup.OSDwidth * cOsd::CellWidth())) / 2 - OsdPipSetup.InfoWidth;
- y = (576 - (Setup.OSDheight * cOsd::LineHeight())) / 2;
- break;
- case kInfoBottomLeft:
- x = (720 - (Setup.OSDwidth * cOsd::CellWidth())) / 2;
- y = (576 + (Setup.OSDheight * cOsd::LineHeight())) / 2 - 60;
- break;
- case kInfoBottomRight:
- x = (720 + (Setup.OSDwidth * cOsd::CellWidth())) / 2 - OsdPipSetup.InfoWidth;
- y = (576 + (Setup.OSDheight * cOsd::LineHeight())) / 2 - 60;
- break;
- }
- m_WindowInfo = m_Osd->Create(x, y, OsdPipSetup.InfoWidth, 60, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false, false);
- m_BitmapInfo = new cBitmap(OsdPipSetup.InfoWidth, 60, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false);
- }
- m_Window = m_Osd->Create(OsdPipSetup.XPosition, OsdPipSetup.YPosition,
- m_Width, m_Height, OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false);
- m_Bitmap = new cBitmap(m_Width, m_Height,
- OsdPipSetup.ColorDepth == kDepthGrey16 ? 4 : 8, false);
- if (OsdPipSetup.ColorDepth == kDepthGrey256 ||
- OsdPipSetup.ColorDepth == kDepthColor256fix)
- {
- for (int i = 0; i < 256; i++)
- {
- if (OsdPipSetup.ColorDepth == kDepthGrey256)
- m_Palette[i] = m_AlphaBase | (i << 16) | (i << 8) | i;
- else
- m_Palette[i] = m_AlphaBase | quantizer->OutputPalette()[i];
- }
- for (int i = 0; i < 256; i++)
- {
- m_Bitmap->SetColor(i, (eDvbColor) m_Palette[i]);
- m_BitmapInfo->SetColor(i, (eDvbColor) m_Palette[i]);
- }
- }
- if (OsdPipSetup.ColorDepth == kDepthColor128var)
- {
- m_Palette[0] = 0xFF000000;
- m_Palette[255] = 0xFFFFFFFF;
- }
-#endif
+ Mutex.Unlock();
}
if (decoder.AspectRatio() > 0.1)
@@ -274,14 +230,8 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length)
if (OsdPipSetup.ColorDepth == kDepthGrey16)
{
-#if VDRVERSNUM >= 10307
m_Bitmap->DrawRectangle(0, 0, m_Width - 1, (m_Height - height) / 2 - 1, m_Palette[0]);
m_Bitmap->DrawRectangle(0, (m_Height + height) / 2, m_Width - 1, m_Height - 1, m_Palette[0]);
-#else
- m_Bitmap->Clear();
- m_Bitmap->Fill(0, 0, m_Width - 1, (m_Height - height) / 2 - 1, clrBlack);
- m_Bitmap->Fill(0, (m_Height + height) / 2, m_Width - 1, m_Height - 1, clrBlack);
-#endif
outputImage = decoder.PicResample()->data[0];
for (int y = 0; y < height; y++)
{
@@ -289,36 +239,22 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length)
{
value = outputImage[y * m_Width + x];
value = value & 0xF0;
- //value = value / 16;
- //value = value * 16;
value = m_AlphaBase | (value << 16) | (value << 8) | value;
-#if VDRVERSNUM >= 10307
m_Bitmap->DrawPixel(x, y + (m_Height - height) / 2, value);
-#else
- m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) value);
-#endif
}
}
}
if (OsdPipSetup.ColorDepth == kDepthGrey256)
{
outputImage = decoder.PicResample()->data[0];
-#if VDRVERSNUM >= 10307
m_Bitmap->DrawRectangle(0, 0, m_Width - 1, m_Height - 1, m_Palette[0]);
for (int i = 0; i < 256; i++)
m_Bitmap->SetColor(i, m_Palette[i]);
-#else
- m_Bitmap->Fill(0, 0, m_Width - 1, m_Height - 1, (eDvbColor) m_Palette[0]);
-#endif
for (int y = 0; y < height; y++)
{
for (int x = 0; x < m_Width; x++)
{
-#if VDRVERSNUM >= 10307
m_Bitmap->SetIndex(x, y + (m_Height - height) / 2, outputImage[y * m_Width + x]);
-#else
- m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]);
-#endif
}
}
}
@@ -351,42 +287,30 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length)
outputImage = quantizer->OutputImage();
if (OsdPipSetup.ColorDepth == kDepthColor256fix)
{
-#if VDRVERSNUM >= 10307
m_Bitmap->DrawRectangle(0, 0, m_Width - 1, m_Height - 1, m_Palette[0]);
for (int i = 0; i < 256; i++)
m_Bitmap->SetColor(i, m_Palette[i]);
-#else
- m_Bitmap->Fill(0, 0, m_Width - 1, m_Height - 1, (eDvbColor) m_Palette[0]);
-#endif
for (int y = 0; y < height; y++)
{
for (int x = 0; x < m_Width; x++)
{
-#if VDRVERSNUM >= 10307
m_Bitmap->SetIndex(x, y + (m_Height - height) / 2, outputImage[y * m_Width + x] + 1);
-#else
- m_Bitmap->SetPixel(x, y + (m_Height - height) / 2, (eDvbColor) m_Palette[outputImage[y * m_Width + x]]);
-#endif
}
}
}
else
{
+ Mutex.Lock();
for (int i = 0; i < 127; i++)
{
m_Palette[m_PaletteStart + i] = outputPalette[i];
m_Palette[m_PaletteStart + i] |= m_AlphaBase;
}
+ Mutex.Unlock();
-#if VDRVERSNUM >= 10307
m_Bitmap->DrawRectangle(0, 0, m_Width - 1, m_Height - 1, m_Palette[0]);
for (int i = 0; i < 256; i++)
m_Bitmap->SetColor(i, m_Palette[i]);
-#else
- for (int i = 0; i < 256; i++)
- m_Bitmap->SetColor(i, (eDvbColor) m_Palette[i]);
- m_Bitmap->Fill(0, 0, m_Width - 1, m_Height - 1, (eDvbColor) m_Palette[0]);
-#endif
for (int y = 0; y < height; y++)
{
for (int x = 0; x < m_Width; x++)
@@ -398,33 +322,28 @@ void cOsdPipObject::ProcessImage(unsigned char * data, int length)
if (m_PaletteStart == 1)
{
m_PaletteStart = 128;
-#if VDRVERSNUM >= 10307
m_AlphaBase = 0xFE000000;
-#endif
}
else
{
m_PaletteStart = 1;
-#if VDRVERSNUM >= 10307
m_AlphaBase = 0xFF000000;
-#endif
}
}
}
if (!m_Ready)
{
if (OsdPipSetup.ShowInfo)
- ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel()));
+ {
+ m_InfoWindow->SetChannel(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel()));
+ m_InfoWindow->Show();
+ }
m_Ready = true;
}
-#if VDRVERSNUM >= 10307
+ Mutex.Lock();
m_Osd->DrawBitmap(OsdPipSetup.XPosition, OsdPipSetup.YPosition, *m_Bitmap);
-#else
- m_Osd->Clear();
- m_Osd->SetBitmap(OsdPipSetup.XPosition, OsdPipSetup.YPosition,
- *m_Bitmap);
-#endif
m_Osd->Flush();
+ Mutex.Unlock();
}
void cOsdPipObject::Action(void)
@@ -446,7 +365,6 @@ void cOsdPipObject::Action(void)
while (m_Active)
{
-#if VDRVERSNUM >= 10307
if (m_Reset)
{
if (m_Osd)
@@ -457,7 +375,6 @@ void cOsdPipObject::Action(void)
m_Ready = false;
m_Reset = false;
}
-#endif
if (m_FrameDrop == -1)
{
while ((frame = m_ESBuffer->Get()) != NULL)
@@ -499,34 +416,6 @@ void cOsdPipObject::Action(void)
}
}
}
- if (m_ShowTime != 0)
- {
- if (m_ShowInfo)
- {
-#if VDRVERSNUM >= 10307
- ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel()));
- m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_BitmapInfo);
-#else
- ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel()));
- m_Osd->SetBitmap(0, 0, *m_BitmapInfo, m_WindowInfo);
- m_Osd->Show(m_WindowInfo);
-#endif
- m_Osd->Flush();
- m_ShowInfo = false;
- }
- time_t currentTime;
- time(&currentTime);
- if (currentTime - m_ShowTime > 2) {
-#if VDRVERSNUM >= 10307
- ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel()), false);
- m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_BitmapInfo);
- m_Osd->Flush();
-#else
- m_Osd->Hide(m_WindowInfo);
-#endif
- m_ShowTime = 0;
- }
- }
}
if (OsdPipSetup.ColorDepth == kDepthColor128var ||
@@ -539,120 +428,86 @@ void cOsdPipObject::Action(void)
void cOsdPipObject::Show(void)
{
-#if VDRVERSNUM >= 10307
Start();
-#else
- m_Osd = cOsd::OpenRaw(0, 0);
- if (m_Osd)
- Start();
-#endif
}
eOSState cOsdPipObject::ProcessKey(eKeys Key)
{
eOSState state = cOsdObject::ProcessKey(Key);
- if (state == osUnknown) {
- switch (Key & ~k_Repeat) {
- case k0: Channels.SwitchTo(m_Channel->Number());
- case kBack: return osEnd;
-
- case kRed: SwapChannels();
+ if (state == osUnknown)
+ {
+ if (m_MoveMode)
+ {
+ switch (Key & ~k_Repeat)
+ {
+ case k0:
+ Channels.SwitchTo(m_Channel->Number());
+ case kBack:
+ return osEnd;
+ case kGreen:
+ m_MoveMode = false;
+ if (m_Ready && m_InfoWindow)
+ {
+ m_InfoWindow->SetMessage(tr("Normal mode"));
+ m_InfoWindow->Show();
+ }
+ break;
+ case kUp:
+ if (OsdPipSetup.YPosition >= 10)
+ OsdPipSetup.YPosition -= 10;
+ m_Reset = true;
+ break;
+ case kLeft:
+ if (OsdPipSetup.XPosition >= 10)
+ OsdPipSetup.XPosition -= 10;
+ m_Reset = true;
+ break;
+ case kRight:
+ if (OsdPipSetup.XPosition + m_Width <= 720 - 10)
+ OsdPipSetup.XPosition += 10;
+ m_Reset = true;
+ break;
+ case kDown:
+ if (OsdPipSetup.YPosition + m_Height <= 576 - 10)
+ OsdPipSetup.YPosition += 10;
+ m_Reset = true;
+ break;
+ }
+ state = osContinue;
+ }
+ else
+ {
+ if (m_Ready && m_InfoWindow)
+ state = m_InfoWindow->ProcessKey(Key);
+ }
+ }
+ if (state == osUnknown)
+ {
+ switch (Key & ~k_Repeat)
+ {
+ case k0:
+ Channels.SwitchTo(m_Channel->Number());
+ case kBack:
+ return osEnd;
+ case kRed:
+ SwapChannels();
break;
-
- case k1...k9:
-#if VDRVERSNUM >= 10307
- switch (Key & ~k_Repeat) {
- case k1:
- if (OsdPipSetup.XPosition >= Setup.OSDLeft + 10) OsdPipSetup.XPosition -= 10;
- if (OsdPipSetup.YPosition >= Setup.OSDTop + 10) OsdPipSetup.YPosition -= 10;
- break;
- case k2:
- if (OsdPipSetup.YPosition >= Setup.OSDTop + 10) OsdPipSetup.YPosition -= 10;
- break;
- case k3:
- if (OsdPipSetup.XPosition + m_Width <= Setup.OSDLeft + Setup.OSDWidth - 10)
- OsdPipSetup.XPosition += 10;
- if (OsdPipSetup.YPosition >= Setup.OSDTop + 10) OsdPipSetup.YPosition -= 10;
- break;
- case k4:
- if (OsdPipSetup.XPosition >= Setup.OSDLeft + 10) OsdPipSetup.XPosition -= 10;
- break;
- case k6:
- if (OsdPipSetup.XPosition + m_Width <= Setup.OSDLeft + Setup.OSDWidth - 10)
- OsdPipSetup.XPosition += 10;
- break;
- case k7:
- if (OsdPipSetup.XPosition >= Setup.OSDLeft + 10) OsdPipSetup.XPosition -= 10;
- if (OsdPipSetup.YPosition + m_Height <= Setup.OSDTop + Setup.OSDHeight - 10)
- OsdPipSetup.YPosition += 10;
- break;
- case k8:
- if (OsdPipSetup.YPosition + m_Height <= Setup.OSDTop + Setup.OSDHeight - 10)
- OsdPipSetup.YPosition += 10;
- break;
- case k9:
- if (OsdPipSetup.XPosition + m_Width <= Setup.OSDLeft + Setup.OSDWidth - 10)
- OsdPipSetup.XPosition += 10;
- if (OsdPipSetup.YPosition + m_Height <= Setup.OSDTop + Setup.OSDHeight - 10)
- OsdPipSetup.YPosition += 10;
- break;
- }
- m_Reset = true;
-#else
- switch (Key & ~k_Repeat) {
- case k1:
- if (OsdPipSetup.XPosition > 9) OsdPipSetup.XPosition -= 10;
- if (OsdPipSetup.YPosition > 9) OsdPipSetup.YPosition -= 10;
- break;
- case k2:
- if (OsdPipSetup.YPosition > 9) OsdPipSetup.YPosition -= 10;
- break;
- case k3:
- if (OsdPipSetup.XPosition < Setup.OSDwidth * cOsd::CellWidth())
- OsdPipSetup.XPosition += 10;
- if (OsdPipSetup.YPosition > 9) OsdPipSetup.YPosition -= 10;
- break;
- case k4:
- if (OsdPipSetup.XPosition > 9) OsdPipSetup.XPosition -= 10;
- break;
- case k6:
- if (OsdPipSetup.XPosition < Setup.OSDwidth * cOsd::CellWidth())
- OsdPipSetup.XPosition += 10;
- break;
- case k7:
- if (OsdPipSetup.XPosition > 9) OsdPipSetup.XPosition -= 10;
- if (OsdPipSetup.YPosition < Setup.OSDheight * cOsd::LineHeight())
- OsdPipSetup.YPosition += 10;
- break;
- case k8:
- if (OsdPipSetup.YPosition < Setup.OSDheight * cOsd::LineHeight())
- OsdPipSetup.YPosition += 10;
- break;
- case k9:
- if (OsdPipSetup.XPosition < Setup.OSDwidth * cOsd::CellWidth())
- OsdPipSetup.XPosition += 10;
- if (OsdPipSetup.YPosition < Setup.OSDheight * cOsd::LineHeight())
- OsdPipSetup.YPosition += 10;
- break;
+ case kGreen:
+ m_MoveMode = true;
+ if (m_Ready && m_InfoWindow)
+ {
+ m_InfoWindow->SetMessage(tr("Move mode"));
+ m_InfoWindow->Show();
}
- m_Osd->Relocate(m_Window, OsdPipSetup.XPosition, OsdPipSetup.YPosition);
-#endif
break;
-
case kUp:
case kDown:
cDevice::SwitchChannel(NORMALKEY(Key) == kUp ? 1 : -1);
break;
-
case kOk:
- if (OsdPipSetup.ShowInfo) {
- if (m_ShowTime != 0) {
- m_ShowTime -= 2;
- } else {
- //ShowChannelInfo(Channels.GetByNumber(cDevice::ActualDevice()->CurrentChannel()));
- time(&m_ShowTime);
- m_ShowInfo = true;
- }
+ if (OsdPipSetup.ShowInfo)
+ {
+ m_InfoWindow->Show();
}
break;
default:
@@ -669,122 +524,30 @@ void cOsdPipObject::ChannelSwitch(const cDevice * device, int channelNumber)
return;
if (channelNumber == 0)
return;
+ if (channelNumber != cDevice::CurrentChannel())
+ return;
if (!m_Ready)
return;
if (OsdPipSetup.ShowInfo)
{
- //ShowChannelInfo(Channels.GetByNumber(device->CurrentChannel()));
- time(&m_ShowTime);
- m_ShowInfo = true;
+ m_InfoWindow->SetChannel(Channels.GetByNumber(channelNumber));
+ m_InfoWindow->Show();
}
}
-void cOsdPipObject::ShowChannelInfo(const cChannel * channel, bool show)
+void cOsdPipObject::OsdClear(void)
{
- char line1[100] = "";
- char line2[100] = "";
-
- sprintf(line1, "%d %s", channel->Number(), channel->Name());
-
-#if VDRVERSNUM >= 10300
- const cEvent * present = NULL;
- cSchedulesLock schedulesLock;
- const cSchedules * schedules = cSchedules::Schedules(schedulesLock);
- if (schedules) {
- const cSchedule * schedule = schedules->GetSchedule(channel->GetChannelID());
- if (schedule) {
- const char * presentTitle = NULL;
- if ((present = schedule->GetPresentEvent()) != NULL) {
- presentTitle = present->Title();
- if (!isempty(presentTitle)) {
- sprintf(line2, "%s %s", (const char*)present->GetTimeString(), presentTitle);
-#if VDRVERSNUM < 10307
- while (m_Osd->Width(line2) > OsdPipSetup.InfoWidth - 10) {
- line2[strlen(line2) - 1] = 0;
- }
-#endif
- }
- }
- }
- }
-#else
- const cEventInfo * present = NULL;
- cMutexLock mutexLock;
- const cSchedules * schedules = cSIProcessor::Schedules(mutexLock);
- if (schedules) {
- const cSchedule * schedule = schedules->GetSchedule(channel->GetChannelID());
- if (schedule) {
- const char * presentTitle = NULL;
- if ((present = schedule->GetPresentEvent()) != NULL) {
- presentTitle = present->GetTitle();
- if (!isempty(presentTitle)) {
- sprintf(line2, "%s %s", present->GetTimeString(), presentTitle);
- while (m_Osd->Width(line2) > OsdPipSetup.InfoWidth - 10) {
- line2[strlen(line2) - 1] = 0;
- }
- }
- }
- }
- }
-#endif
-#if VDRVERSNUM >= 10307
- if (OsdPipSetup.ColorDepth == kDepthGrey16)
- {
- if (show)
- {
- m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, clrBlack);
- const cFont *font = cFont::GetFont(fontOsd);
- m_BitmapInfo->DrawText(0, 0, line1, clrWhite, clrBlack, font, OsdPipSetup.InfoWidth, 30);
- m_BitmapInfo->DrawText(0, 30, line2, clrWhite, clrBlack, font, OsdPipSetup.InfoWidth, 30);
- time(&m_ShowTime);
- m_ShowInfo = true;
- }
- else
- {
- m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, clrTransparent);
- }
- }
- else
+ //printf("OsdClear\n");
+}
+
+void cOsdPipObject::OsdStatusMessage(const char * message)
+{
+ if (!m_Ready)
+ return;
+ if (OsdPipSetup.ShowInfo)
{
- if (show)
- {
- m_Palette[0] = 0xFD000000;
- m_Palette[255] = 0x00FFFFFF;
- m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[0]);
- for (int i = 0; i < 256; i++)
- m_BitmapInfo->SetColor(i, m_Palette[i]);
- m_Osd->DrawBitmap(m_InfoX, m_InfoY, *m_BitmapInfo);
- m_Osd->Flush();
- m_Palette[255] = 0xFDFFFFFF;
- m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[0]);
- for (int i = 0; i < 256; i++)
- m_BitmapInfo->SetColor(i, m_Palette[i]);
- const cFont *font = cFont::GetFont(fontOsd);
- m_BitmapInfo->DrawText(0, 0, line1, m_Palette[255], m_Palette[0], font, OsdPipSetup.InfoWidth, 30);
- m_BitmapInfo->DrawText(0, 30, line2, m_Palette[255], m_Palette[0], font, OsdPipSetup.InfoWidth, 30);
- time(&m_ShowTime);
- m_ShowInfo = true;
- }
- else
- {
- m_Palette[0] = 0xFD000000;
- m_Palette[255] = 0x00FFFFFF;
- m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[0]);
- for (int i = 0; i < 256; i++)
- m_BitmapInfo->SetColor(i, m_Palette[i]);
- m_BitmapInfo->DrawRectangle(0, 0, OsdPipSetup.InfoWidth - 1, 30 - 1, m_Palette[255]);
- m_BitmapInfo->DrawRectangle(0, 30, OsdPipSetup.InfoWidth - 1, 60 - 1, m_Palette[255]);
- }
+ m_InfoWindow->SetMessage(message);
+ m_InfoWindow->Show();
}
-#else
- if (OsdPipSetup.ColorDepth != kDepthGrey16)
- for (int i = 0; i < 256; i++)
- m_BitmapInfo->SetColor(i, (eDvbColor) m_Palette[i]);
- m_BitmapInfo->Fill(0, 0, OsdPipSetup.InfoWidth, 60, (eDvbColor) 0xFF000000);
- m_BitmapInfo->Text(0, 0, line1, (eDvbColor) 0xFFFFFFFF, (eDvbColor) 0xFF000000);
- m_BitmapInfo->Text(0, 30, line2, (eDvbColor) 0xFFFFFFFF, (eDvbColor) 0xFF000000);
- time(&m_ShowTime);
- m_ShowInfo = true;
-#endif
}