mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
- Updated the Estonian OSD texts (thanks to Arthur Konovalov). - Some cable providers don't mark short channel names according to the standard, but rather go their own way and use "name>short name". VDR now splits at this character for cable channels (thanks to Gerhard Steiner for reporting this one). - Added a check for Setup.DiSEqC in cDvbDevice::ProvidesTransponder(), otherwise the EPG scan didn't work on systems that don't use DiSEqC (thanks to Michael Reinelt for reporting this one). - Made the Makefile patch friendlier (thanks to Ludwig Nussel). - Made cOsd::isOpen an integer counter to avoid problems with messages when a cOsdObject uses the raw OSD (thanks to Andreas Regel for reporting this one). - Updated the Danish OSD texts (thanks to Mogens Elneff). - The file 'summary.vdr' has been replaced with 'info.vdr' and now contains the information about a recording, in the same format as the events are stored in 'epg.data' (see man vdr(5) for details). Existing summary files can be converted to the new format by running the Perl script 'summary2info.pl', as in summary2info.pl /video (the parameter given has to be the video directory). If there is no 'info.vdr' file for a recording, an attempt is made to read a 'summary.vdr'. - The "Summary" button in the "Recordings" menu has been renamed to "Info", and the page it brings up now shows the recording's information, much like the EPG event page. Therefore it now no longer uses the skin's SetText() function, but rather the SetRecording() function. Skin plugins may need to adjust that function accordingly (see skinsttng.c, for instance). - The SVDRP command LSTR now lists the recording information in the same tagged format as the LSTE command lists the EPG data. - The audio track menu now contains track descriptions when replaying (provided such descriptions were available in the EPG data when the recording was made, and are stored in the info.vdr file). - Avoiding extra blanks at the end of names of instant recordings. - Removed converting byte order on big endian systems from cDvbOsd::Flush(), which, according to Johannes Stezenbach and Paavo Hartikainen, is wrong. - Added cPlayer::DeviceSetVideoDisplayFormat() (thanks to Marco Schlüßler). - No longer saving the setup in case of a fatal error, to keep the volume level from being set to a wrong value (thanks to Marco Schlüßler). - Fixed a possible hangup when ending a replay session while cIndexFile::CatchUp() is waiting (thanks to Marco Schlüßler). - The SVDRP command DELR no longer deletes recordings that are currently being written to by a timer (thanks to Sascha Volkenandt for pointing out this one). - Pressing the "Play" key in live viewing mode now resumes a previous replay session (thanks to Mirko Dölle). - Now dropping EPG events that have a zero start time or duration (thanks to Oliver Endriss). - No longer stopping Transfer Mode or replay immediately when the Power button is pressed (thanks to Rolf Ahrenberg). - Moved the NPTL and UTF-8 checks after the version and help output (thanks to Andreas Kool for pointing out that 'vdr --version' failed on an UTF-8 system). - Made tChannelID::operator==() inline for better performance (thanks to Georg Acher). - Introduced cListBase::count for better performance (thanks to Georg Acher). - cEvent no longer stores the channelID directly, but rather has a pointer to the schedule it is in. - Now using hash tables to speed up cSchedule::GetEvent() (partially based on a patch from Georg Acher). - Avoiding unnecessary calls to getLength() in libsi/si.c, and avoiding the '& 0xff' in CRC32::crc32() of libsi/util.c (thanks to Georg Acher). - Speeded up deleting duplicate channels. - Fixed listing recordings with empty episode names in the LSTR command (thanks to Stefan Huelswitt for pointing this out). - Added cThread::SetPriority() and using it in cSectionHandler::Action() to reduce the priority of the section handler threads (as suggested by Georg Acher).
185 lines
6.0 KiB
C
185 lines
6.0 KiB
C
/*
|
|
* dvbosd.c: Implementation of the DVB On Screen Display
|
|
*
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
* how to reach the author.
|
|
*
|
|
* $Id: dvbosd.c 1.27 2005/05/22 10:57:45 kls Exp $
|
|
*/
|
|
|
|
#include "dvbosd.h"
|
|
#include <linux/dvb/osd.h>
|
|
#include <signal.h>
|
|
#include <sys/ioctl.h>
|
|
#include <sys/unistd.h>
|
|
#include "dvbdevice.h"
|
|
#include "tools.h"
|
|
|
|
// --- cDvbOsd ---------------------------------------------------------------
|
|
|
|
#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7
|
|
#define MAXOSDMEMORY 92000 // number of bytes available to the OSD (for unmodified DVB cards)
|
|
|
|
class cDvbOsd : public cOsd {
|
|
private:
|
|
int osdDev;
|
|
int osdMem;
|
|
bool shown;
|
|
void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL);
|
|
public:
|
|
cDvbOsd(int Left, int Top, int OsdDev);
|
|
virtual ~cDvbOsd();
|
|
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
|
|
virtual void Flush(void);
|
|
};
|
|
|
|
cDvbOsd::cDvbOsd(int Left, int Top, int OsdDev)
|
|
:cOsd(Left, Top)
|
|
{
|
|
osdDev = OsdDev;
|
|
shown = false;
|
|
if (osdDev < 0)
|
|
esyslog("ERROR: illegal OSD device handle (%d)!", osdDev);
|
|
else {
|
|
osdMem = MAXOSDMEMORY;
|
|
#ifdef OSD_CAP_MEMSIZE
|
|
// modified DVB cards may have more OSD memory:
|
|
osd_cap_t cap;
|
|
cap.cmd = OSD_CAP_MEMSIZE;
|
|
if (ioctl(osdDev, OSD_GET_CAPABILITY, &cap) == 0)
|
|
osdMem = cap.val;
|
|
#define FW_NEEDS_BUFFER_RESERVE_FOR_AC3
|
|
#ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3
|
|
//XXX This is a very ugly hack to allow cDvbOsd to reduce the buffer
|
|
//XXX requirements in cTransfer if it detects a 4MB full featured DVB card.
|
|
extern bool DvbCardWith4MBofSDRAM;
|
|
DvbCardWith4MBofSDRAM = osdMem >= 1000000;
|
|
#endif
|
|
#endif
|
|
// must clear all windows here to avoid flashing effects - doesn't work if done
|
|
// in Flush() only for the windows that are actually used...
|
|
for (int i = 0; i < MAXNUMWINDOWS; i++) {
|
|
Cmd(OSD_SetWindow, 0, i + 1);
|
|
Cmd(OSD_Clear);
|
|
}
|
|
}
|
|
}
|
|
|
|
cDvbOsd::~cDvbOsd()
|
|
{
|
|
if (shown) {
|
|
cBitmap *Bitmap;
|
|
for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
|
|
Cmd(OSD_SetWindow, 0, i + 1);
|
|
Cmd(OSD_Close);
|
|
}
|
|
}
|
|
}
|
|
|
|
eOsdError cDvbOsd::CanHandleAreas(const tArea *Areas, int NumAreas)
|
|
{
|
|
eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
|
|
if (Result == oeOk) {
|
|
if (NumAreas > MAXNUMWINDOWS)
|
|
return oeTooManyAreas;
|
|
int TotalMemory = 0;
|
|
for (int i = 0; i < NumAreas; i++) {
|
|
if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
|
|
return oeBppNotSupported;
|
|
if ((Areas[i].Width() & (8 / Areas[i].bpp - 1)) != 0)
|
|
return oeWrongAlignment;
|
|
TotalMemory += Areas[i].Width() * Areas[i].Height() / (8 / Areas[i].bpp);
|
|
}
|
|
if (TotalMemory > osdMem)
|
|
return oeOutOfMemory;
|
|
}
|
|
return Result;
|
|
}
|
|
|
|
void cDvbOsd::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, const void *data)
|
|
{
|
|
if (osdDev >= 0) {
|
|
osd_cmd_t dc;
|
|
dc.cmd = cmd;
|
|
dc.color = color;
|
|
dc.x0 = x0;
|
|
dc.y0 = y0;
|
|
dc.x1 = x1;
|
|
dc.y1 = y1;
|
|
dc.data = (void *)data;
|
|
ioctl(osdDev, OSD_SEND_CMD, &dc);
|
|
}
|
|
}
|
|
|
|
void cDvbOsd::Flush(void)
|
|
{
|
|
cBitmap *Bitmap;
|
|
for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
|
|
Cmd(OSD_SetWindow, 0, i + 1);
|
|
if (!shown)
|
|
Cmd(OSD_Open, Bitmap->Bpp(), Left() + Bitmap->X0(), Top() + Bitmap->Y0(), Left() + Bitmap->X0() + Bitmap->Width() - 1, Top() + Bitmap->Y0() + Bitmap->Height() - 1, (void *)1); // initially hidden!
|
|
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
|
|
if (Bitmap->Dirty(x1, y1, x2, y2)) {
|
|
//TODO Workaround: apparently the bitmap sent to the driver always has to be a multiple
|
|
//TODO of 8 bits wide, and (dx * dy) also has to be a multiple of 8.
|
|
//TODO Fix driver (should be able to handle any size bitmaps!)
|
|
while ((x1 > 0 || x2 < Bitmap->Width() - 1) && ((x2 - x1) & 7) != 7) {
|
|
if (x2 < Bitmap->Width() - 1)
|
|
x2++;
|
|
else if (x1 > 0)
|
|
x1--;
|
|
}
|
|
//TODO "... / 2" <==> Bpp???
|
|
while ((y1 > 0 || y2 < Bitmap->Height() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) {
|
|
if (y2 < Bitmap->Height() - 1)
|
|
y2++;
|
|
else if (y1 > 0)
|
|
y1--;
|
|
}
|
|
while ((x1 > 0 || x2 < Bitmap->Width() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) {
|
|
if (x2 < Bitmap->Width() - 1)
|
|
x2++;
|
|
else if (x1 > 0)
|
|
x1--;
|
|
}
|
|
// commit colors:
|
|
int NumColors;
|
|
const tColor *Colors = Bitmap->Colors(NumColors);
|
|
if (Colors) {
|
|
//TODO this should be fixed in the driver!
|
|
tColor colors[NumColors];
|
|
for (int i = 0; i < NumColors; i++) {
|
|
// convert AARRGGBB to AABBGGRR (the driver expects the colors the wrong way):
|
|
colors[i] = (Colors[i] & 0xFF000000) | ((Colors[i] & 0x0000FF) << 16) | (Colors[i] & 0x00FF00) | ((Colors[i] & 0xFF0000) >> 16);
|
|
}
|
|
Colors = colors;
|
|
//TODO end of stuff that should be fixed in the driver
|
|
Cmd(OSD_SetPalette, 0, NumColors - 1, 0, 0, 0, Colors);
|
|
}
|
|
// commit modified data:
|
|
Cmd(OSD_SetBlock, Bitmap->Width(), x1, y1, x2, y2, Bitmap->Data(x1, y1));
|
|
}
|
|
Bitmap->Clean();
|
|
}
|
|
if (!shown) {
|
|
// Showing the windows in a separate loop to avoid seeing them come up one after another
|
|
for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) {
|
|
Cmd(OSD_SetWindow, 0, i + 1);
|
|
Cmd(OSD_MoveWindow, 0, Left() + Bitmap->X0(), Top() + Bitmap->Y0());
|
|
}
|
|
shown = true;
|
|
}
|
|
}
|
|
|
|
// --- cDvbOsdProvider -------------------------------------------------------
|
|
|
|
cDvbOsdProvider::cDvbOsdProvider(int OsdDev)
|
|
{
|
|
osdDev = OsdDev;
|
|
}
|
|
|
|
cOsd *cDvbOsdProvider::CreateOsd(int Left, int Top)
|
|
{
|
|
return new cDvbOsd(Left, Top, osdDev);
|
|
}
|