summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-06-12 13:30:11 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2004-06-12 13:30:11 +0200
commit8108d4587faf7c9e6d05c5ce2dd42e3a866b2dd0 (patch)
treee8541a80ded13b9dd263123d4adf1e941f902ce8
parentc3144c9ab81a02469f65bded3285d643a3111ebc (diff)
downloadvdr-8108d4587faf7c9e6d05c5ce2dd42e3a866b2dd0.tar.gz
vdr-8108d4587faf7c9e6d05c5ce2dd42e3a866b2dd0.tar.bz2
Some improvements in cOsd creation
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY1
-rw-r--r--dvbosd.c16
-rw-r--r--dvbosd.h16
-rw-r--r--osd.c6
-rw-r--r--osd.h6
6 files changed, 29 insertions, 19 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index de4ede68..a104c177 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1026,3 +1026,6 @@ Jürgen Schmitz <j.schmitz@web.de>
Philip Lawatsch <philip@lawatsch.at>
for debugging a buffer overflow in eit.c
+
+Jouni Karvo <kex@netlab.hut.fi>
+ for suggesting to make the cOsd constructor 'protected'
diff --git a/HISTORY b/HISTORY
index a5f24577..7c2a0e87 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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
UTF-8 before starting VDR.
- Some changes to the SPU decoder interface (thanks to Sven Goethel).
+- Some improvements in cOsd creation (thanks to some suggestions by Jouni Karvo).
diff --git a/dvbosd.c b/dvbosd.c
index d21bcefb..8056499f 100644
--- a/dvbosd.c
+++ b/dvbosd.c
@@ -4,13 +4,15 @@
* See the main source file 'vdr.c' for copyright information and
* 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 <linux/dvb/osd.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/unistd.h>
+#include "dvbdevice.h"
#include "tools.h"
// --- cDvbOsd ---------------------------------------------------------------
@@ -18,6 +20,18 @@
#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)
+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)
:cOsd(Left, Top)
{
diff --git a/dvbosd.h b/dvbosd.h
index bac43f51..752b9fa1 100644
--- a/dvbosd.h
+++ b/dvbosd.h
@@ -4,28 +4,14 @@
* See the main source file 'vdr.c' for copyright information and
* 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
#define __DVBOSD_H
-#include <linux/dvb/osd.h>
-#include "dvbdevice.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 {
private:
int osdDev;
diff --git a/osd.c b/osd.c
index ac950ff6..6bfa1e5b 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -713,6 +713,10 @@ cOsdProvider::~cOsdProvider()
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)
return osdProvider->CreateOsd(Left, Top);
esyslog("ERROR: no OSD provider available - using dummy OSD!");
diff --git a/osd.h b/osd.h
index 947e076f..172c4757 100644
--- a/osd.h
+++ b/osd.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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
@@ -208,13 +208,14 @@ struct tArea {
#define MAXOSDAREAS 16
class cOsd {
+ friend class cOsdProvider;
private:
static bool isOpen;
cBitmap *savedRegion;
cBitmap *bitmaps[MAXOSDAREAS];
int numBitmaps;
int left, top, width, height;
-public:
+protected:
cOsd(int Left, int Top);
///< Initializes the OSD with the given coordinates.
///< 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
///< because a derived cOsd class may or may not be able to handle more
///< than one area.
+public:
virtual ~cOsd();
///< Shuts down the OSD.
static bool IsOpen(void) { return isOpen; }