From 26ffdd1c8361f714fff78fd746f209f386e6b997 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 15 Aug 2003 13:05:50 +0200 Subject: [PATCH] Fixed scaling SPU bitmaps in Letterbox mode when playing NTSC material --- HISTORY | 2 ++ device.c | 7 ++++++- device.h | 9 ++++++++- dvbdevice.c | 15 ++++++++++++++- dvbdevice.h | 3 ++- dvbspu.c | 8 +++++--- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index f6236110..8a207787 100644 --- a/HISTORY +++ b/HISTORY @@ -2291,3 +2291,5 @@ Video Disk Recorder Revision History the "Channels" menu (thanks to Mirko Günther for reporting this one). - Made the plugin library directory configurable via Make.config (thanks to Ludwig Nussel). +- Fixed scaling SPU bitmaps in Letterbox mode when playing NTSC material. + In order to do this, the cDevice was given a new member function GetVideoSystem(). diff --git a/device.c b/device.c index 242f59c9..b409ac0e 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 1.46 2003/08/02 11:44:28 kls Exp $ + * $Id: device.c 1.47 2003/08/15 12:34:36 kls Exp $ */ #include "device.h" @@ -216,6 +216,11 @@ void cDevice::SetVideoFormat(bool VideoFormat16_9) { } +eVideoSystem cDevice::GetVideoSystem(void) +{ + return vsPAL; +} + //#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 a41312a2..144adfb6 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 1.33 2003/05/11 08:50:04 kls Exp $ + * $Id: device.h 1.34 2003/08/15 13:05:50 kls Exp $ */ #ifndef __DEVICE_H @@ -45,6 +45,10 @@ enum ePlayMode { pmNone, // audio/video from decoder // KNOWN TO YOUR PLAYER. }; +enum eVideoSystem { vsPAL, + vsNTSC + }; + class cOsdBase; class cChannel; class cPlayer; @@ -248,6 +252,9 @@ public: virtual void SetVideoFormat(bool VideoFormat16_9); ///< Sets the output video format to either 16:9 or 4:3 (only useful ///< if this device has an MPEG decoder). + virtual eVideoSystem GetVideoSystem(void); + ///< Returns the video system of the currently displayed material + ///< (default is PAL). // Audio facilities diff --git a/dvbdevice.c b/dvbdevice.c index 7fc50a71..34d55829 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 1.60 2003/05/24 13:23:51 kls Exp $ + * $Id: dvbdevice.c 1.61 2003/08/15 13:03:41 kls Exp $ */ #include "dvbdevice.h" @@ -525,6 +525,19 @@ void cDvbDevice::SetVideoFormat(bool VideoFormat16_9) CHECK(ioctl(fd_video, VIDEO_SET_FORMAT, VideoFormat16_9 ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3)); } +eVideoSystem cDvbDevice::GetVideoSystem(void) +{ + eVideoSystem VideoSytem = vsPAL; + video_size_t vs; + if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { + if (vs.h == 480 || vs.h == 240) + VideoSytem = vsNTSC; + } + else + LOG_ERROR; + return VideoSytem; +} + // ptAudio ptVideo ptPcr ptTeletext ptDolby ptOther dmx_pes_type_t PesTypes[] = { DMX_PES_AUDIO, DMX_PES_VIDEO, DMX_PES_PCR, DMX_PES_TELETEXT, DMX_PES_OTHER, DMX_PES_OTHER }; diff --git a/dvbdevice.h b/dvbdevice.h index 6bcbc724..aab20fdd 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 1.21 2003/05/02 12:21:51 kls Exp $ + * $Id: dvbdevice.h 1.22 2003/08/15 12:34:55 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -80,6 +80,7 @@ public: public: virtual void SetVideoFormat(bool VideoFormat16_9); + virtual eVideoSystem GetVideoSystem(void); // Audio facilities diff --git a/dvbspu.c b/dvbspu.c index 4b31401a..27e0bed5 100644 --- a/dvbspu.c +++ b/dvbspu.c @@ -8,7 +8,7 @@ * * parts of this file are derived from the OMS program. * - * $Id: dvbspu.c 1.3 2002/10/26 10:46:49 kls Exp $ + * $Id: dvbspu.c 1.4 2003/08/15 13:04:39 kls Exp $ */ #include @@ -301,8 +301,10 @@ void cDvbSpuDecoder::clearHighlight(void) int cDvbSpuDecoder::ScaleYcoord(int value) { - if (scaleMode == eSpuLetterBox) - return lround((value * 3.0) / 4.0 + 72.0); + if (scaleMode == eSpuLetterBox) { + int offset = cDevice::PrimaryDevice()->GetVideoSystem() == vsPAL ? 72 : 60; + return lround((value * 3.0) / 4.0) + offset; + } else return value; }