From f936db2ac64206b682de49b9d3bef853eec4e6b1 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 9 May 2009 10:11:16 +0200 Subject: [PATCH] Implemented cDevice::GetOsdSize(); fixed the way the OSD size is determined on full featured DVB cards --- CONTRIBUTORS | 1 + HISTORY | 9 +++++++++ PLUGINS.html | 4 ++-- device.c | 13 ++++++++++--- device.h | 15 +++++++++++++-- dvbdevice.c | 23 +++++++++++++++++++---- dvbdevice.h | 3 ++- osd.c | 10 +++++----- osd.h | 4 ++-- 9 files changed, 63 insertions(+), 19 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6d853b91..a5e3bcc3 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -672,6 +672,7 @@ Oliver Endriss VPID is 0 for reporting chirping sound disturbences at editing points in TS recordings for reporting broken index generation in TS recordings after a buffer overflow + for fixing the way the OSD size is determined on full featured DVB cards Reinhard Walter Buchner for adding some satellites to 'sources.conf' diff --git a/HISTORY b/HISTORY index d78d3455..2f2738b0 100644 --- a/HISTORY +++ b/HISTORY @@ -6078,3 +6078,12 @@ Video Disk Recorder Revision History 2009-05-08: Version 1.7.8 - Fixed a typo in aspect ratio 2.21:1 (reported by Reinhard Nissl). +- The name of the function cDevice::GetVideoSize() wasn't very well chosen + for its purpose of defining the optimum size of the OSD for the current + output device. Therefore a new function named cDevice::GetOsdSize() has + been introduced. Plugin authors should implement this function in + classes derived from cDevice, if they are able to replay video. + cDevice::GetVideoSize() still exists and should return the size of the + video material that is currently replayed. +- Fixed the way the OSD size is determined on full featured DVB cards (thanks + to Oliver Endriss). diff --git a/PLUGINS.html b/PLUGINS.html index 344015b1..e8fa16a7 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -1944,10 +1944,10 @@ In order to be able to determine the proper size of the OSD, the device should implement the function

-virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect);
+virtual void GetOsdSize(int &Width, int &Height, double &Aspect);
 

-By default, an OSD size of 480x324 with an aspect ratio of 4:3 is assumed. +By default, an OSD size of 720x480 with an aspect ratio of 1.0 is assumed.

diff --git a/device.c b/device.c index 11f6f93f..50a63d54 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.18 2009/05/08 13:27:29 kls Exp $ + * $Id: device.c 2.19 2009/05/09 10:02:58 kls Exp $ */ #include "device.h" @@ -391,11 +391,18 @@ eVideoSystem cDevice::GetVideoSystem(void) void cDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect) { - Width = MINOSDWIDTH; - Height = MINOSDHEIGHT; + Width = 0; + Height = 0; Aspect = va4_3; } +void cDevice::GetOsdSize(int &Width, int &Height, double &Aspect) +{ + Width = 720; + Height = 480; + Aspect = 1.0; +} + //#define PRINTPIDS(s) { char b[500]; char *q = b; q += sprintf(q, "%d %s ", CardIndex(), s); for (int i = 0; i < MAXPIDHANDLES; i++) q += sprintf(q, " %s%4d %d", i == ptOther ? "* " : "", pidHandles[i].pid, pidHandles[i].used); dsyslog(b); } #define PRINTPIDS(s) diff --git a/device.h b/device.h index 4d96d312..05a936aa 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 2.11 2009/05/08 13:28:09 kls Exp $ + * $Id: device.h 2.12 2009/05/08 13:39:08 kls Exp $ */ #ifndef __DEVICE_H @@ -386,7 +386,18 @@ public: ///< (default is PAL). virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect); ///< Returns the With, Height and Aspect ratio of the currently - ///< displayed material. + ///< displayed material. The data returned by this function is + ///< only used for informational purposes (if any). + ///< The default implementation returns 0 for Width and Height. + virtual void GetOsdSize(int &Width, int &Height, double &Aspect); + ///< Returns the With, Height and Aspect ratio the OSD should use + ///< to best fit the resolution of the output device. If Aspect + ///< is not 1.0, the OSD may take this as a hint to stretch its + ///< graphics in a way that, e.g., a square area will actually + ///< show up as a square on the screen, and not as a rectangle. + ///< Values greater than 1.0 will stretch the graphics in the + ///< vertical direction. Note that the OSD is not guaranteed to + ///< actually use this hint. // Track facilities diff --git a/dvbdevice.c b/dvbdevice.c index 84f0e97c..43bc9d5b 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 2.15 2009/05/03 13:49:41 kls Exp $ + * $Id: dvbdevice.c 2.16 2009/05/08 14:54:27 kls Exp $ */ #include "dvbdevice.h" @@ -751,16 +751,31 @@ void cDvbDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect) video_size_t vs; if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { Width = vs.w; - if (Width < 720) // FIXME: some channels result in a With of, e.g. 544, but the final video *is* 720 wide - Width = 720; Height = vs.h; Aspect = eVideoAspect(vs.aspect_ratio); + return; + } + else + LOG_ERROR; + cDevice::GetVideoSize(Width, Height, Aspect); +} + +void cDvbDevice::GetOsdSize(int &Width, int &Height, double &Aspect) +{ + video_size_t vs; + if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { + Width = 720; + if (vs.h != 480 && vs.h != 240) + Height = 576; // PAL + else + Height = 480; // NTSC + Aspect = 1.0; if (Width >= MINOSDWIDTH && Width <= MAXOSDWIDTH && Height >= MINOSDHEIGHT && Height <= MAXOSDHEIGHT) return; } else LOG_ERROR; - cDevice::GetVideoSize(Width, Height, Aspect); + cDevice::GetOsdSize(Width, Height, Aspect); } bool cDvbDevice::SetAudioBypass(bool On) diff --git a/dvbdevice.h b/dvbdevice.h index 4e325ca2..e9aa9f8b 100644 --- a/dvbdevice.h +++ b/dvbdevice.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.h 2.4 2009/05/02 10:44:40 kls Exp $ + * $Id: dvbdevice.h 2.5 2009/05/08 13:33:46 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -108,6 +108,7 @@ public: virtual void SetVideoFormat(bool VideoFormat16_9); virtual eVideoSystem GetVideoSystem(void); virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect); + virtual void GetOsdSize(int &Width, int &Height, double &Aspect); // Track facilities diff --git a/osd.c b/osd.c index 2ed1acf7..77caa405 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 2.3 2009/05/03 13:52:47 kls Exp $ + * $Id: osd.c 2.4 2009/05/08 15:29:20 kls Exp $ */ #include "osd.h" @@ -883,7 +883,7 @@ void cOsd::Flush(void) cOsdProvider *cOsdProvider::osdProvider = NULL; int cOsdProvider::oldWidth = 0; int cOsdProvider::oldHeight = 0; -int cOsdProvider::oldAspect = va4_3; +double cOsdProvider::oldAspect = 1.0; cOsdProvider::cOsdProvider(void) { @@ -919,8 +919,8 @@ void cOsdProvider::UpdateOsdSize(bool Force) { int Width; int Height; - eVideoAspect Aspect; - cDevice::PrimaryDevice()->GetVideoSize(Width, Height, Aspect); + double Aspect; + cDevice::PrimaryDevice()->GetOsdSize(Width, Height, Aspect); if (Width != oldWidth || Height != oldHeight || Aspect != oldAspect || Force) { Setup.OSDLeft = int(round(Width * Setup.OSDLeftP)); Setup.OSDTop = int(round(Height * Setup.OSDTopP)); @@ -935,7 +935,7 @@ void cOsdProvider::UpdateOsdSize(bool Force) oldWidth = Width; oldHeight = Height; oldAspect = Aspect; - dsyslog("OSD size changed to %dx%d @ %s", Width, Height, VideoAspectString[Aspect]); + dsyslog("OSD size changed to %dx%d @ %g", Width, Height, Aspect); } } diff --git a/osd.h b/osd.h index ba79fdea..f10247ea 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 2.3 2009/05/03 13:52:10 kls Exp $ + * $Id: osd.h 2.4 2009/05/08 13:41:03 kls Exp $ */ #ifndef __OSD_H @@ -408,7 +408,7 @@ private: static cOsdProvider *osdProvider; static int oldWidth; static int oldHeight; - static int oldAspect; + static double oldAspect; protected: virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0; ///< Returns a pointer to a newly created cOsd object, which will be located