1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Some improvements in cOsd creation

This commit is contained in:
Klaus Schmidinger 2004-06-12 13:30:11 +02:00
parent c3144c9ab8
commit 8108d4587f
6 changed files with 29 additions and 19 deletions

View File

@ -1026,3 +1026,6 @@ J
Philip Lawatsch <philip@lawatsch.at> Philip Lawatsch <philip@lawatsch.at>
for debugging a buffer overflow in eit.c for debugging a buffer overflow in eit.c
Jouni Karvo <kex@netlab.hut.fi>
for suggesting to make the cOsd constructor 'protected'

View File

@ -2905,3 +2905,4 @@ Video Disk Recorder Revision History
of UTF-8 at program start, and if it is, exists and tells the user to turn off of UTF-8 at program start, and if it is, exists and tells the user to turn off
UTF-8 before starting VDR. UTF-8 before starting VDR.
- Some changes to the SPU decoder interface (thanks to Sven Goethel). - Some changes to the SPU decoder interface (thanks to Sven Goethel).
- Some improvements in cOsd creation (thanks to some suggestions by Jouni Karvo).

View File

@ -4,13 +4,15 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: dvbosd.c 1.22 2004/05/01 15:10:44 kls Exp $ * $Id: dvbosd.c 1.23 2004/06/12 13:10:03 kls Exp $
*/ */
#include "dvbosd.h" #include "dvbosd.h"
#include <linux/dvb/osd.h>
#include <signal.h> #include <signal.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/unistd.h> #include <sys/unistd.h>
#include "dvbdevice.h"
#include "tools.h" #include "tools.h"
// --- cDvbOsd --------------------------------------------------------------- // --- cDvbOsd ---------------------------------------------------------------
@ -18,6 +20,18 @@
#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 #define MAXNUMWINDOWS 7 // OSD windows are counted 1...7
#define MAXOSDMEMORY 92000 // number of bytes available to the OSD (depends on firmware version, but there is no way of determining the actual value) #define MAXOSDMEMORY 92000 // number of bytes available to the OSD (depends on firmware version, but there is no way of determining the actual value)
class cDvbOsd : public cOsd {
private:
int osdDev;
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) cDvbOsd::cDvbOsd(int Left, int Top, int OsdDev)
:cOsd(Left, Top) :cOsd(Left, Top)
{ {

View File

@ -4,28 +4,14 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: dvbosd.h 1.17 2004/04/30 13:44:16 kls Exp $ * $Id: dvbosd.h 1.18 2004/06/12 13:09:52 kls Exp $
*/ */
#ifndef __DVBOSD_H #ifndef __DVBOSD_H
#define __DVBOSD_H #define __DVBOSD_H
#include <linux/dvb/osd.h>
#include "dvbdevice.h"
#include "osd.h" #include "osd.h"
class cDvbOsd : public cOsd {
private:
int osdDev;
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);
};
class cDvbOsdProvider : public cOsdProvider { class cDvbOsdProvider : public cOsdProvider {
private: private:
int osdDev; int osdDev;

6
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osd.c 1.52 2004/06/05 16:52:51 kls Exp $ * $Id: osd.c 1.53 2004/06/12 13:24:42 kls Exp $
*/ */
#include "osd.h" #include "osd.h"
@ -713,6 +713,10 @@ cOsdProvider::~cOsdProvider()
cOsd *cOsdProvider::NewOsd(int Left, int Top) cOsd *cOsdProvider::NewOsd(int Left, int Top)
{ {
if (cOsd::IsOpen()) {
esyslog("ERROR: attempt to open OSD while it is already open!");
return NULL;
}
if (osdProvider) if (osdProvider)
return osdProvider->CreateOsd(Left, Top); return osdProvider->CreateOsd(Left, Top);
esyslog("ERROR: no OSD provider available - using dummy OSD!"); esyslog("ERROR: no OSD provider available - using dummy OSD!");

6
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osd.h 1.45 2004/06/05 12:38:44 kls Exp $ * $Id: osd.h 1.46 2004/06/12 13:14:48 kls Exp $
*/ */
#ifndef __OSD_H #ifndef __OSD_H
@ -208,13 +208,14 @@ struct tArea {
#define MAXOSDAREAS 16 #define MAXOSDAREAS 16
class cOsd { class cOsd {
friend class cOsdProvider;
private: private:
static bool isOpen; static bool isOpen;
cBitmap *savedRegion; cBitmap *savedRegion;
cBitmap *bitmaps[MAXOSDAREAS]; cBitmap *bitmaps[MAXOSDAREAS];
int numBitmaps; int numBitmaps;
int left, top, width, height; int left, top, width, height;
public: protected:
cOsd(int Left, int Top); cOsd(int Left, int Top);
///< Initializes the OSD with the given coordinates. ///< Initializes the OSD with the given coordinates.
///< By default it is assumed that the full area will be able to display ///< By default it is assumed that the full area will be able to display
@ -231,6 +232,7 @@ public:
///< and should require only the minimum necessary color depth. This is ///< and should require only the minimum necessary color depth. This is
///< because a derived cOsd class may or may not be able to handle more ///< because a derived cOsd class may or may not be able to handle more
///< than one area. ///< than one area.
public:
virtual ~cOsd(); virtual ~cOsd();
///< Shuts down the OSD. ///< Shuts down the OSD.
static bool IsOpen(void) { return isOpen; } static bool IsOpen(void) { return isOpen; }