mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Osd work:
Use -DOSD_DEBUG to debug OSD. Fix bug #909: Subtitles destroy menu. Fix bug #1003: Subtitles overlapping.
This commit is contained in:
parent
9ec077ec8a
commit
a920da652b
2
Makefile
2
Makefile
@ -18,7 +18,7 @@ GIT_REV = $(shell git describe --always 2>/dev/null)
|
|||||||
|
|
||||||
### Configuration (edit this for your needs)
|
### Configuration (edit this for your needs)
|
||||||
|
|
||||||
CONFIG := #-DDEBUG
|
CONFIG := #-DDEBUG #-DOSD_DEBUG
|
||||||
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # debug a/v sync
|
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # debug a/v sync
|
||||||
#CONFIG += -DHAVE_PTHREAD_NAME # supports new pthread_setname_np
|
#CONFIG += -DHAVE_PTHREAD_NAME # supports new pthread_setname_np
|
||||||
#CONFIG += -DNO_TS_AUDIO # disable ts audio parser
|
#CONFIG += -DNO_TS_AUDIO # disable ts audio parser
|
||||||
|
@ -222,9 +222,10 @@ class cSoftOsd:public cOsd
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static volatile char Dirty; ///< flag force redraw everything
|
static volatile char Dirty; ///< flag force redraw everything
|
||||||
|
int OsdLevel; ///< current osd level
|
||||||
|
|
||||||
cSoftOsd(int, int, uint); ///< constructor
|
cSoftOsd(int, int, uint); ///< osd constructor
|
||||||
virtual ~ cSoftOsd(void); ///< destructor
|
virtual ~ cSoftOsd(void); ///< osd destructor
|
||||||
virtual void Flush(void); ///< commits all data to the hardware
|
virtual void Flush(void); ///< commits all data to the hardware
|
||||||
virtual void SetActive(bool); ///< sets OSD to be the active one
|
virtual void SetActive(bool); ///< sets OSD to be the active one
|
||||||
};
|
};
|
||||||
@ -241,14 +242,26 @@ volatile char cSoftOsd::Dirty; ///< flag force redraw everything
|
|||||||
*/
|
*/
|
||||||
void cSoftOsd::SetActive(bool on)
|
void cSoftOsd::SetActive(bool on)
|
||||||
{
|
{
|
||||||
//dsyslog("[softhddev]%s: %d\n", __FUNCTION__, on);
|
#ifdef OSD_DEBUG
|
||||||
|
dsyslog("[softhddev]%s: %d level %d\n", __FUNCTION__, on, OsdLevel);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Active() == on) {
|
if (Active() == on) {
|
||||||
return; // already active, no action
|
return; // already active, no action
|
||||||
}
|
}
|
||||||
cOsd::SetActive(on);
|
cOsd::SetActive(on);
|
||||||
|
|
||||||
|
// ignore sub-title if menu is open
|
||||||
|
if (OsdLevel >= OSD_LEVEL_SUBTITLES && IsOpen()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (on) {
|
if (on) {
|
||||||
Dirty = 1;
|
Dirty = 1;
|
||||||
|
// only flush here if there are already bitmaps
|
||||||
|
if (GetBitmap(0)) {
|
||||||
|
Flush();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
OsdClose();
|
OsdClose();
|
||||||
}
|
}
|
||||||
@ -266,11 +279,14 @@ void cSoftOsd::SetActive(bool on)
|
|||||||
cSoftOsd::cSoftOsd(int left, int top, uint level)
|
cSoftOsd::cSoftOsd(int left, int top, uint level)
|
||||||
:cOsd(left, top, level)
|
:cOsd(left, top, level)
|
||||||
{
|
{
|
||||||
|
#ifdef OSD_DEBUG
|
||||||
/* FIXME: OsdWidth/OsdHeight not correct!
|
/* FIXME: OsdWidth/OsdHeight not correct!
|
||||||
dsyslog("[softhddev]%s: %dx%d+%d+%d, %d\n", __FUNCTION__, OsdWidth(),
|
|
||||||
OsdHeight(), left, top, level);
|
|
||||||
*/
|
*/
|
||||||
|
dsyslog("[softhddev]%s: %dx%d+%d+%d, %d\n", __FUNCTION__, OsdWidth(),
|
||||||
|
OsdHeight(), left, top, level);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
OsdLevel = level;
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +297,10 @@ cSoftOsd::cSoftOsd(int left, int top, uint level)
|
|||||||
*/
|
*/
|
||||||
cSoftOsd::~cSoftOsd(void)
|
cSoftOsd::~cSoftOsd(void)
|
||||||
{
|
{
|
||||||
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
#ifdef OSD_DEBUG
|
||||||
|
dsyslog("[softhddev]%s: level %d\n", __FUNCTION__, OsdLevel);
|
||||||
|
#endif
|
||||||
|
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
// done by SetActive: OsdClose();
|
// done by SetActive: OsdClose();
|
||||||
|
|
||||||
@ -306,14 +325,25 @@ void cSoftOsd::Flush(void)
|
|||||||
{
|
{
|
||||||
cPixmapMemory *pm;
|
cPixmapMemory *pm;
|
||||||
|
|
||||||
if (!Active()) {
|
#ifdef OSD_DEBUG
|
||||||
|
dsyslog("[softhddev]%s: level %d active %d\n", __FUNCTION__, OsdLevel,
|
||||||
|
Active());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!Active()) { // this osd is not active
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// don't draw sub-title if menu is active
|
||||||
|
if (OsdLevel >= OSD_LEVEL_SUBTITLES && IsOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef USE_YAEPG
|
#ifdef USE_YAEPG
|
||||||
// support yaepghd, video window
|
// support yaepghd, video window
|
||||||
if (vidWin.bpp) {
|
if (vidWin.bpp) {
|
||||||
|
#ifdef OSD_DEBUG
|
||||||
dsyslog("[softhddev]%s: %dx%d+%d+%d\n", __FUNCTION__, vidWin.Width(),
|
dsyslog("[softhddev]%s: %dx%d+%d+%d\n", __FUNCTION__, vidWin.Width(),
|
||||||
vidWin.Height(), vidWin.x1, vidWin.y2);
|
vidWin.Height(), vidWin.x1, vidWin.y2);
|
||||||
|
#endif
|
||||||
|
|
||||||
// FIXME: vidWin is OSD relative not video window.
|
// FIXME: vidWin is OSD relative not video window.
|
||||||
VideoSetOutputPosition(Left() + vidWin.x1, Top() + vidWin.y1,
|
VideoSetOutputPosition(Left() + vidWin.x1, Top() + vidWin.y1,
|
||||||
@ -321,16 +351,27 @@ void cSoftOsd::Flush(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// VDR draws subtitle without clearing the old
|
||||||
|
//
|
||||||
|
if (OsdLevel >= OSD_LEVEL_SUBTITLES) {
|
||||||
|
VideoOsdClear();
|
||||||
|
cSoftOsd::Dirty = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsTrueColor()) {
|
if (!IsTrueColor()) {
|
||||||
static char warned;
|
|
||||||
cBitmap *bitmap;
|
cBitmap *bitmap;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef OSD_DEBUG
|
||||||
|
static char warned;
|
||||||
|
|
||||||
if (!warned) {
|
if (!warned) {
|
||||||
dsyslog("[softhddev]%s: FIXME: should be truecolor\n",
|
dsyslog("[softhddev]%s: FIXME: should be truecolor\n",
|
||||||
__FUNCTION__);
|
__FUNCTION__);
|
||||||
warned = 1;
|
warned = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// draw all bitmaps
|
// draw all bitmaps
|
||||||
for (i = 0; (bitmap = GetBitmap(i)); ++i) {
|
for (i = 0; (bitmap = GetBitmap(i)); ++i) {
|
||||||
uint8_t *argb;
|
uint8_t *argb;
|
||||||
@ -383,6 +424,10 @@ void cSoftOsd::Flush(void)
|
|||||||
bitmap->GetColor(x, y);
|
bitmap->GetColor(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef OSD_DEBUG
|
||||||
|
dsyslog("[softhddev]%s: draw %dx%d+%d+%d bm\n", __FUNCTION__, w, h,
|
||||||
|
Left() + bitmap->X0() + x1, Top() + bitmap->Y0() + y1);
|
||||||
|
#endif
|
||||||
OsdDrawARGB(Left() + bitmap->X0() + x1, Top() + bitmap->Y0() + y1,
|
OsdDrawARGB(Left() + bitmap->X0() + x1, Top() + bitmap->Y0() + y1,
|
||||||
w, h, argb);
|
w, h, argb);
|
||||||
|
|
||||||
@ -406,15 +451,15 @@ void cSoftOsd::Flush(void)
|
|||||||
w = pm->ViewPort().Width();
|
w = pm->ViewPort().Width();
|
||||||
h = pm->ViewPort().Height();
|
h = pm->ViewPort().Height();
|
||||||
|
|
||||||
/*
|
#ifdef OSD_DEBUG
|
||||||
dsyslog("[softhddev]%s: draw %dx%d+%d+%d %p\n", __FUNCTION__, w, h,
|
dsyslog("[softhddev]%s: draw %dx%d+%d+%d %p\n", __FUNCTION__, w, h, x,
|
||||||
x, y, pm->Data());
|
y, pm->Data());
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
OsdDrawARGB(x, y, w, h, pm->Data());
|
OsdDrawARGB(x, y, w, h, pm->Data());
|
||||||
|
|
||||||
delete pm;
|
delete pm;
|
||||||
}
|
}
|
||||||
|
cSoftOsd::Dirty = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -427,11 +472,12 @@ void cSoftOsd::Flush(void)
|
|||||||
class cSoftOsdProvider:public cOsdProvider
|
class cSoftOsdProvider:public cOsdProvider
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static cOsd *Osd;
|
static cOsd *Osd; ///< single OSD
|
||||||
public:
|
public:
|
||||||
virtual cOsd * CreateOsd(int, int, uint);
|
virtual cOsd * CreateOsd(int, int, uint);
|
||||||
virtual bool ProvidesTrueColor(void);
|
virtual bool ProvidesTrueColor(void);
|
||||||
cSoftOsdProvider(void);
|
cSoftOsdProvider(void); ///< OSD provider constructor
|
||||||
|
//virtual ~cSoftOsdProvider(); ///< OSD provider destructor
|
||||||
};
|
};
|
||||||
|
|
||||||
cOsd *cSoftOsdProvider::Osd; ///< single osd
|
cOsd *cSoftOsdProvider::Osd; ///< single osd
|
||||||
@ -445,7 +491,9 @@ cOsd *cSoftOsdProvider::Osd; ///< single osd
|
|||||||
*/
|
*/
|
||||||
cOsd *cSoftOsdProvider::CreateOsd(int left, int top, uint level)
|
cOsd *cSoftOsdProvider::CreateOsd(int left, int top, uint level)
|
||||||
{
|
{
|
||||||
//dsyslog("[softhddev]%s: %d, %d, %d\n", __FUNCTION__, left, top, level);
|
#ifdef OSD_DEBUG
|
||||||
|
dsyslog("[softhddev]%s: %d, %d, %d\n", __FUNCTION__, left, top, level);
|
||||||
|
#endif
|
||||||
|
|
||||||
return Osd = new cSoftOsd(left, top, level);
|
return Osd = new cSoftOsd(left, top, level);
|
||||||
}
|
}
|
||||||
@ -466,9 +514,19 @@ bool cSoftOsdProvider::ProvidesTrueColor(void)
|
|||||||
cSoftOsdProvider::cSoftOsdProvider(void)
|
cSoftOsdProvider::cSoftOsdProvider(void)
|
||||||
: cOsdProvider()
|
: cOsdProvider()
|
||||||
{
|
{
|
||||||
//dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
#ifdef OSD_DEBUG
|
||||||
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
** Destroy cOsdProvider class.
|
||||||
|
cSoftOsdProvider::~cSoftOsdProvider()
|
||||||
|
{
|
||||||
|
dsyslog("[softhddev]%s:\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// cMenuSetupPage
|
// cMenuSetupPage
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user