summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2009-06-01 14:56:28 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2009-06-01 14:56:28 +0200
commite639e3a76ad6c8d721ab3f827bd7b3847e351c05 (patch)
tree38ea5b358c89084d581071a189692b8b26c3283f
parent78d2fd3d0e2a69c27581afe710f5598862a750be (diff)
downloadvdr-e639e3a76ad6c8d721ab3f827bd7b3847e351c05.tar.gz
vdr-e639e3a76ad6c8d721ab3f827bd7b3847e351c05.tar.bz2
Improved cDvbDevice::GetOsdSize()
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY6
-rw-r--r--device.c6
-rw-r--r--device.h20
-rw-r--r--dvbdevice.c19
-rw-r--r--dvbdevice.h4
6 files changed, 37 insertions, 21 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 6483964b..9a1e86eb 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -673,6 +673,7 @@ Oliver Endriss <o.endriss@gmx.de>
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
+ for his input on calculating the Aspect factor in GetOsdSize()
Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf'
@@ -1221,6 +1222,8 @@ Reinhard Nissl <rnissl@gmx.de>
for reporting a call to close(-1) in cUnbufferedFile::Close()
for reporting a possible problem in handling the length of DiSEqC command sequences
for fixing cOsdMenu::Display() in case the menu size has changed
+ for suggesting to change the type of the Aspect parameter of GetVideoSize()
+ to 'double'
Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the
diff --git a/HISTORY b/HISTORY
index 0add2d5b..4236241b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6084,7 +6084,11 @@ Video Disk Recorder Revision History
been introduced (suggested by Rolf Ahrenberg). 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
- actual size of the video material that is currently replayed.
+ actual size of the video material that is currently replayed. Note that
+ because of the many possible aspect ratios for video material, the type
+ of the Aspect parameter of GetVideoSize() has been changed to 'double'
+ (suggested by Reinhard Nissl). Thanks to Oliver Endriss for his input on
+ calculating the Aspect factor in GetOsdSize().
- Fixed the way the OSD size is determined on full featured DVB cards (thanks
to Oliver Endriss).
- Increased MAXOSDHEIGHT to 1200 (suggested by Nicolas Huillard).
diff --git a/device.c b/device.c
index 50a63d54..1cd30a87 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.19 2009/05/09 10:02:58 kls Exp $
+ * $Id: device.c 2.20 2009/06/01 14:08:45 kls Exp $
*/
#include "device.h"
@@ -389,11 +389,11 @@ eVideoSystem cDevice::GetVideoSystem(void)
return vsPAL;
}
-void cDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect)
+void cDevice::GetVideoSize(int &Width, int &Height, double &Aspect)
{
Width = 0;
Height = 0;
- Aspect = va4_3;
+ Aspect = 1.0;
}
void cDevice::GetOsdSize(int &Width, int &Height, double &Aspect)
diff --git a/device.h b/device.h
index 05a936aa..807e6b88 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.12 2009/05/08 13:39:08 kls Exp $
+ * $Id: device.h 2.13 2009/06/01 14:07:55 kls Exp $
*/
#ifndef __DEVICE_H
@@ -56,11 +56,6 @@ enum eVideoSystem { vsPAL,
vsNTSC
};
-enum eVideoAspect { va4_3,
- va16_9,
- va221_1
- };
-
extern const char *VideoAspectString[];
enum eVideoDisplayFormat { vdfPanAndScan,
@@ -384,17 +379,20 @@ public:
virtual eVideoSystem GetVideoSystem(void);
///< Returns the video system of the currently displayed material
///< (default is PAL).
- virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect);
+ virtual void GetVideoSize(int &Width, int &Height, double &Aspect);
///< Returns the With, Height and Aspect ratio of the currently
///< 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.
+ ///< only used for informational purposes (if any). Width and
+ ///< Height are given in pixel (e.g. 720x576) and Aspect is
+ ///< e.g. 1.3333x33 for a 4:3 broadcast, or 1.77778 for 16:9.
+ ///< The default implementation returns 0 for Width and Height
+ ///< and 1.0 for Aspect.
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.
+ ///< graphics in a way that, e.g., a circle will actually
+ ///< show up as a circle on the screen, and not as an ellipse.
///< 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.
diff --git a/dvbdevice.c b/dvbdevice.c
index a57693e4..4f37117e 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.19 2009/06/01 11:42:06 kls Exp $
+ * $Id: dvbdevice.c 2.20 2009/06/01 14:44:54 kls Exp $
*/
#include "dvbdevice.h"
@@ -748,14 +748,19 @@ eVideoSystem cDvbDevice::GetVideoSystem(void)
return VideoSystem;
}
-void cDvbDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect)
+void cDvbDevice::GetVideoSize(int &Width, int &Height, double &Aspect)
{
if (fd_video >= 0) {
video_size_t vs;
if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) {
Width = vs.w;
Height = vs.h;
- Aspect = eVideoAspect(vs.aspect_ratio);
+ switch (vs.aspect_ratio) {
+ default:
+ case VIDEO_FORMAT_4_3: Aspect = 4.0 / 3.0; break;
+ case VIDEO_FORMAT_16_9: Aspect = 16.0 / 9.0; break;
+ case VIDEO_FORMAT_221_1: Aspect = 2.21; break;
+ }
return;
}
else
@@ -774,7 +779,13 @@ void cDvbDevice::GetOsdSize(int &Width, int &Height, double &Aspect)
Height = 576; // PAL
else
Height = 480; // NTSC
- Aspect = 1.0;
+ switch (Setup.VideoFormat ? vs.aspect_ratio : VIDEO_FORMAT_4_3) {
+ default:
+ case VIDEO_FORMAT_4_3: Aspect = 4.0 / 3.0; break;
+ case VIDEO_FORMAT_221_1: // FF DVB cards only distinguish between 4:3 and 16:9
+ case VIDEO_FORMAT_16_9: Aspect = 16.0 / 9.0; break;
+ }
+ Aspect /= double(Width) / Height;
return;
}
else
diff --git a/dvbdevice.h b/dvbdevice.h
index 58e4450c..7a255535 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.6 2009/06/01 11:20:32 kls Exp $
+ * $Id: dvbdevice.h 2.7 2009/06/01 14:09:05 kls Exp $
*/
#ifndef __DVBDEVICE_H
@@ -108,7 +108,7 @@ public:
virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat);
virtual void SetVideoFormat(bool VideoFormat16_9);
virtual eVideoSystem GetVideoSystem(void);
- virtual void GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect);
+ virtual void GetVideoSize(int &Width, int &Height, double &Aspect);
virtual void GetOsdSize(int &Width, int &Height, double &Aspect);
// Track facilities