Implemented cDevice::GetOsdSize(); fixed the way the OSD size is determined on full featured DVB cards

This commit is contained in:
Klaus Schmidinger 2009-05-09 10:11:16 +02:00
parent 61c811ac70
commit f936db2ac6
9 changed files with 63 additions and 19 deletions

View File

@ -672,6 +672,7 @@ Oliver Endriss <o.endriss@gmx.de>
VPID is 0 VPID is 0
for reporting chirping sound disturbences at editing points in TS recordings for reporting chirping sound disturbences at editing points in TS recordings
for reporting broken index generation in TS recordings after a buffer overflow 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 <rw.buchner@freenet.de> Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf' for adding some satellites to 'sources.conf'

View File

@ -6078,3 +6078,12 @@ Video Disk Recorder Revision History
2009-05-08: Version 1.7.8 2009-05-08: Version 1.7.8
- Fixed a typo in aspect ratio 2.21:1 (reported by Reinhard Nissl). - 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).

View File

@ -1944,10 +1944,10 @@ In order to be able to determine the proper size of the OSD, the device
should implement the function should implement the function
<p><table><tr><td class="code"><pre> <p><table><tr><td class="code"><pre>
virtual void GetVideoSize(int &amp;Width, int &amp;Height, eVideoAspect &amp;Aspect); virtual void GetOsdSize(int &amp;Width, int &amp;Height, double &amp;Aspect);
</pre></td></tr></table><p> </pre></td></tr></table><p>
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.
</div modified> </div modified>
<p> <p>

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: 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" #include "device.h"
@ -391,11 +391,18 @@ eVideoSystem cDevice::GetVideoSystem(void)
void cDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect) void cDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect)
{ {
Width = MINOSDWIDTH; Width = 0;
Height = MINOSDHEIGHT; Height = 0;
Aspect = va4_3; 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) { 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) #define PRINTPIDS(s)

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: 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 #ifndef __DEVICE_H
@ -386,7 +386,18 @@ public:
///< (default is PAL). ///< (default is PAL).
virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect); virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect);
///< Returns the With, Height and Aspect ratio of the currently ///< 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 // Track facilities

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: 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" #include "dvbdevice.h"
@ -751,16 +751,31 @@ void cDvbDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect)
video_size_t vs; video_size_t vs;
if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) {
Width = vs.w; 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; Height = vs.h;
Aspect = eVideoAspect(vs.aspect_ratio); 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) if (Width >= MINOSDWIDTH && Width <= MAXOSDWIDTH && Height >= MINOSDHEIGHT && Height <= MAXOSDHEIGHT)
return; return;
} }
else else
LOG_ERROR; LOG_ERROR;
cDevice::GetVideoSize(Width, Height, Aspect); cDevice::GetOsdSize(Width, Height, Aspect);
} }
bool cDvbDevice::SetAudioBypass(bool On) bool cDvbDevice::SetAudioBypass(bool On)

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: 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 #ifndef __DVBDEVICE_H
@ -108,6 +108,7 @@ public:
virtual void SetVideoFormat(bool VideoFormat16_9); virtual void SetVideoFormat(bool VideoFormat16_9);
virtual eVideoSystem GetVideoSystem(void); virtual eVideoSystem GetVideoSystem(void);
virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect); virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect);
virtual void GetOsdSize(int &Width, int &Height, double &Aspect);
// Track facilities // Track facilities

10
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 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" #include "osd.h"
@ -883,7 +883,7 @@ void cOsd::Flush(void)
cOsdProvider *cOsdProvider::osdProvider = NULL; cOsdProvider *cOsdProvider::osdProvider = NULL;
int cOsdProvider::oldWidth = 0; int cOsdProvider::oldWidth = 0;
int cOsdProvider::oldHeight = 0; int cOsdProvider::oldHeight = 0;
int cOsdProvider::oldAspect = va4_3; double cOsdProvider::oldAspect = 1.0;
cOsdProvider::cOsdProvider(void) cOsdProvider::cOsdProvider(void)
{ {
@ -919,8 +919,8 @@ void cOsdProvider::UpdateOsdSize(bool Force)
{ {
int Width; int Width;
int Height; int Height;
eVideoAspect Aspect; double Aspect;
cDevice::PrimaryDevice()->GetVideoSize(Width, Height, Aspect); cDevice::PrimaryDevice()->GetOsdSize(Width, Height, Aspect);
if (Width != oldWidth || Height != oldHeight || Aspect != oldAspect || Force) { if (Width != oldWidth || Height != oldHeight || Aspect != oldAspect || Force) {
Setup.OSDLeft = int(round(Width * Setup.OSDLeftP)); Setup.OSDLeft = int(round(Width * Setup.OSDLeftP));
Setup.OSDTop = int(round(Height * Setup.OSDTopP)); Setup.OSDTop = int(round(Height * Setup.OSDTopP));
@ -935,7 +935,7 @@ void cOsdProvider::UpdateOsdSize(bool Force)
oldWidth = Width; oldWidth = Width;
oldHeight = Height; oldHeight = Height;
oldAspect = Aspect; 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);
} }
} }

4
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 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 #ifndef __OSD_H
@ -408,7 +408,7 @@ private:
static cOsdProvider *osdProvider; static cOsdProvider *osdProvider;
static int oldWidth; static int oldWidth;
static int oldHeight; static int oldHeight;
static int oldAspect; static double oldAspect;
protected: protected:
virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0; virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0;
///< Returns a pointer to a newly created cOsd object, which will be located ///< Returns a pointer to a newly created cOsd object, which will be located