From 1f798b0f8e4735fb1c444379f2cfa968e85ccd3a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 6 Jun 2009 11:20:52 +0200 Subject: Using different names for the Aspect parameter --- CONTRIBUTORS | 3 ++- HISTORY | 9 +++++---- device.c | 10 +++++----- device.h | 30 ++++++++++++++++-------------- dvbdevice.c | 22 +++++++++++----------- dvbdevice.h | 6 +++--- 6 files changed, 42 insertions(+), 38 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9a1e86eb..3d883c88 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1216,7 +1216,6 @@ Reinhard Nissl for making sure vdr-xine no longer needs cDvbPlayer::Action() to call DeviceFlush() for fixing the 'VideoOnly' condition in the PlayPes() and PlayTs() calls in cDvbPlayer::Action() - for reporting a typo in aspect ratio 2.21:1 for reporting a problem in case the PIDs change during recording for reporting a memory leak when reaching the end of a recording during replay for reporting a call to close(-1) in cUnbufferedFile::Close() @@ -1224,6 +1223,8 @@ Reinhard Nissl 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' + for suggesting to use different names for the Aspect parameter in GetVideoSize() + and GetOsdSize() Richard Robson for reporting freezing replay if a timer starts while in Transfer Mode from the diff --git a/HISTORY b/HISTORY index 4236241b..609f78a7 100644 --- a/HISTORY +++ b/HISTORY @@ -6077,7 +6077,6 @@ Video Disk Recorder Revision History 2009-06-01: 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 @@ -6086,9 +6085,11 @@ Video Disk Recorder Revision History to replay video. cDevice::GetVideoSize() still exists and should return the 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(). + of the Aspect parameter of GetVideoSize() has been changed to 'double', + and the Aspect parameter in both functions is named differently, because + it returns different values (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 84da76e5..94b0c2f8 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.21 2009/06/01 15:07:03 kls Exp $ + * $Id: device.c 2.22 2009/06/06 11:17:05 kls Exp $ */ #include "device.h" @@ -384,18 +384,18 @@ eVideoSystem cDevice::GetVideoSystem(void) return vsPAL; } -void cDevice::GetVideoSize(int &Width, int &Height, double &Aspect) +void cDevice::GetVideoSize(int &Width, int &Height, double &VideoAspect) { Width = 0; Height = 0; - Aspect = 1.0; + VideoAspect = 1.0; } -void cDevice::GetOsdSize(int &Width, int &Height, double &Aspect) +void cDevice::GetOsdSize(int &Width, int &Height, double &PixelAspect) { Width = 720; Height = 480; - Aspect = 1.0; + PixelAspect = 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); } diff --git a/device.h b/device.h index cb3bfe02..8ac85946 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.14 2009/06/01 15:07:10 kls Exp $ + * $Id: device.h 2.15 2009/06/06 11:15:49 kls Exp $ */ #ifndef __DEVICE_H @@ -377,23 +377,25 @@ public: virtual eVideoSystem GetVideoSystem(void); ///< Returns the video system of the currently displayed material ///< (default is PAL). - 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 + virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect); + ///< Returns the With, Height and VideoAspect ratio of the currently + ///< displayed video material. The data returned by this function is ///< 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. + ///< Height are given in pixel (e.g. 720x576) and VideoAspect is + ///< e.g. 1.33333 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 + ///< and 1.0 for VideoAspect. + virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect); + ///< Returns the With, Height and PixelAspect ratio the OSD should use + ///< to best fit the resolution of the output device. If PixelAspect + ///< is not 1.0, the OSD may take this as a hint to scale its ///< 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. + ///< Values greater than 1.0 mean to stretch the graphics in the + ///< vertical direction (or shrink it in the horizontal direction, + ///< depending on which dimension shall be fixed). Values less than + ///< 1.0 work the other way round. Note that the OSD is not guaranteed + ///< to actually use this hint. // Track facilities diff --git a/dvbdevice.c b/dvbdevice.c index 4f37117e..dd425c8a 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.20 2009/06/01 14:44:54 kls Exp $ + * $Id: dvbdevice.c 2.21 2009/06/06 11:17:20 kls Exp $ */ #include "dvbdevice.h" @@ -748,7 +748,7 @@ eVideoSystem cDvbDevice::GetVideoSystem(void) return VideoSystem; } -void cDvbDevice::GetVideoSize(int &Width, int &Height, double &Aspect) +void cDvbDevice::GetVideoSize(int &Width, int &Height, double &VideoAspect) { if (fd_video >= 0) { video_size_t vs; @@ -757,19 +757,19 @@ void cDvbDevice::GetVideoSize(int &Width, int &Height, double &Aspect) Height = vs.h; 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; + case VIDEO_FORMAT_4_3: VideoAspect = 4.0 / 3.0; break; + case VIDEO_FORMAT_16_9: VideoAspect = 16.0 / 9.0; break; + case VIDEO_FORMAT_221_1: VideoAspect = 2.21; break; } return; } else LOG_ERROR; } - cDevice::GetVideoSize(Width, Height, Aspect); + cDevice::GetVideoSize(Width, Height, VideoAspect); } -void cDvbDevice::GetOsdSize(int &Width, int &Height, double &Aspect) +void cDvbDevice::GetOsdSize(int &Width, int &Height, double &PixelAspect) { if (fd_video >= 0) { video_size_t vs; @@ -781,17 +781,17 @@ void cDvbDevice::GetOsdSize(int &Width, int &Height, double &Aspect) Height = 480; // NTSC 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_4_3: PixelAspect = 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; + case VIDEO_FORMAT_16_9: PixelAspect = 16.0 / 9.0; break; } - Aspect /= double(Width) / Height; + PixelAspect /= double(Width) / Height; return; } else LOG_ERROR; } - cDevice::GetOsdSize(Width, Height, Aspect); + cDevice::GetOsdSize(Width, Height, PixelAspect); } bool cDvbDevice::SetAudioBypass(bool On) diff --git a/dvbdevice.h b/dvbdevice.h index 7a255535..e3e28d02 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.7 2009/06/01 14:09:05 kls Exp $ + * $Id: dvbdevice.h 2.8 2009/06/06 11:16:47 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -108,8 +108,8 @@ public: virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat); virtual void SetVideoFormat(bool VideoFormat16_9); virtual eVideoSystem GetVideoSystem(void); - virtual void GetVideoSize(int &Width, int &Height, double &Aspect); - virtual void GetOsdSize(int &Width, int &Height, double &Aspect); + virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect); + virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect); // Track facilities -- cgit v1.2.3