diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 767a7957..cb809786 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1151,6 +1151,7 @@ Marco Schl for fixing calling cStatus::MsgChannelSwitch() in cDevice::SetChannel() for increasing POLLTIMEOUTS_BEFORE_DEVICECLEAR in transfer.c to 6 to avoid problems with the larger buffer reserve + for adding support for setting the video display mode Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index 1dd31404..a62f28c1 100644 --- a/HISTORY +++ b/HISTORY @@ -3429,3 +3429,4 @@ Video Disk Recorder Revision History - Increased POLLTIMEOUTS_BEFORE_DEVICECLEAR in transfer.c to 6 to avoid problems with the larger buffer reserve (thanks to Marco Schlüßler). - Fixed the call to SetVideoFormat() in cDvbDevice::cDvbDevice() (parameter is _bool_). +- Added support for setting the video display mode (thanks to Marco Schlüßler). diff --git a/device.c b/device.c index 8685e3c0..629ad8eb 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.93 2005/02/19 12:20:39 kls Exp $ + * $Id: device.c 1.94 2005/02/20 11:41:03 kls Exp $ */ #include "device.h" @@ -235,6 +235,7 @@ bool cDevice::SetPrimaryDevice(int n) primaryDevice->MakePrimaryDevice(false); primaryDevice = device[n]; primaryDevice->MakePrimaryDevice(true); + primaryDevice->SetVideoFormat(Setup.VideoFormat); return true; } esyslog("ERROR: invalid primary device number: %d", n + 1); @@ -327,6 +328,28 @@ bool cDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, return false; } +void cDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat) +{ + cSpuDecoder *spuDecoder = GetSpuDecoder(); + if (spuDecoder) { + if (Setup.VideoFormat) + spuDecoder->setScaleMode(cSpuDecoder::eSpuNormal); + else { + switch (VideoDisplayFormat) { + case vdfPanAndScan: + spuDecoder->setScaleMode(cSpuDecoder::eSpuPanAndScan); + break; + case vdfLetterBox: + spuDecoder->setScaleMode(cSpuDecoder::eSpuLetterBox); + break; + case vdfCenterCutOut: + spuDecoder->setScaleMode(cSpuDecoder::eSpuNormal); + break; + } + } + } +} + void cDevice::SetVideoFormat(bool VideoFormat16_9) { } @@ -836,6 +859,7 @@ void cDevice::Detach(cPlayer *Player) player->device = NULL; player = NULL; SetPlayMode(pmNone); + SetVideoDisplayFormat(vdfLetterBox); Audios.ClearAudio(); } } diff --git a/device.h b/device.h index 80587992..1e747028 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.55 2005/02/06 11:43:04 kls Exp $ + * $Id: device.h 1.56 2005/02/20 11:30:11 kls Exp $ */ #ifndef __DEVICE_H @@ -18,6 +18,7 @@ #include "ringbuffer.h" #include "sdt.h" #include "sections.h" +#include "spu.h" #include "thread.h" #include "tools.h" @@ -56,6 +57,11 @@ enum eVideoSystem { vsPAL, vsNTSC }; +enum eVideoDisplayFormat { vdfPanAndScan, + vdfLetterBox, + vdfCenterCutOut + }; + enum eTrackType { ttNone, ttAudio, ttAudioFirst = ttAudio, @@ -83,7 +89,6 @@ struct tTrackId { class cChannel; class cPlayer; class cReceiver; -class cSpuDecoder; class cPesAssembler; /// The cDevice class is the base from which actual devices can be derived. @@ -301,6 +306,10 @@ public: // Video format facilities public: + virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat); + ///< Sets the video display format to the given one (only useful + ///< if this device has an MPEG decoder). + ///< A derived class must first call the base class function! 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). diff --git a/dvbdevice.c b/dvbdevice.c index c937428e..ed12c543 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.122 2005/02/20 11:05:50 kls Exp $ + * $Id: dvbdevice.c 1.123 2005/02/20 11:31:39 kls Exp $ */ #include "dvbdevice.h" @@ -599,10 +599,35 @@ bool cDvbDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int Siz return false; } +void cDvbDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat) +{ + cDevice::SetVideoDisplayFormat(VideoDisplayFormat); + if (HasDecoder()) { + if (Setup.VideoFormat) { + CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_CENTER_CUT_OUT)); + } + else { + switch (VideoDisplayFormat) { + case vdfPanAndScan: + CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_PAN_SCAN)); + break; + case vdfLetterBox: + CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_LETTER_BOX)); + break; + case vdfCenterCutOut: + CHECK(ioctl(fd_video, VIDEO_SET_DISPLAY_FORMAT, VIDEO_CENTER_CUT_OUT)); + break; + } + } + } +} + void cDvbDevice::SetVideoFormat(bool VideoFormat16_9) { - if (HasDecoder()) + if (HasDecoder()) { CHECK(ioctl(fd_video, VIDEO_SET_FORMAT, VideoFormat16_9 ? VIDEO_FORMAT_16_9 : VIDEO_FORMAT_4_3)); + SetVideoDisplayFormat(vdfLetterBox); + } } eVideoSystem cDvbDevice::GetVideoSystem(void) diff --git a/dvbdevice.h b/dvbdevice.h index 99456e73..4a705367 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.33 2005/02/13 14:14:31 kls Exp $ + * $Id: dvbdevice.h 1.34 2005/02/20 11:17:07 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -87,6 +87,7 @@ public: // Video format facilities public: + virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat); virtual void SetVideoFormat(bool VideoFormat16_9); virtual eVideoSystem GetVideoSystem(void); diff --git a/dvbspu.h b/dvbspu.h index 88812347..c60567a3 100644 --- a/dvbspu.h +++ b/dvbspu.h @@ -8,7 +8,7 @@ * * parts of this file are derived from the OMS program. * - * $Id: dvbspu.h 1.7 2005/01/08 09:59:44 kls Exp $ + * $Id: dvbspu.h 1.8 2005/02/20 11:20:43 kls Exp $ */ #ifndef __DVBSPU_H @@ -139,6 +139,7 @@ class cDvbSpuDecoder:public cSpuDecoder { int setTime(uint32_t pts); + cSpuDecoder::eScaleMode getScaleMode(void) { return scaleMode; } void setScaleMode(cSpuDecoder::eScaleMode ScaleMode); void setPalette(uint32_t * pal); void setHighlight(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, diff --git a/spu.h b/spu.h index 9ab4da5b..0437a322 100644 --- a/spu.h +++ b/spu.h @@ -6,7 +6,7 @@ * This code is distributed under the terms and conditions of the * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details. * - * $Id: spu.h 1.3 2005/01/08 09:58:35 kls Exp $ + * $Id: spu.h 1.4 2005/02/20 11:21:31 kls Exp $ */ #ifndef __SPU_VDR_H @@ -21,10 +21,11 @@ class cSpuDecoder { typedef enum { eSpuNormal, eSpuLetterBox, eSpuPanAndScan } eScaleMode; public: // cSpuDecoder(); - virtual ~ cSpuDecoder(); + virtual ~cSpuDecoder(); virtual int setTime(uint32_t pts) = 0; + virtual cSpuDecoder::eScaleMode getScaleMode(void) = 0; virtual void setScaleMode(cSpuDecoder::eScaleMode ScaleMode) = 0; virtual void setPalette(uint32_t * pal) = 0; virtual void setHighlight(uint16_t sx, uint16_t sy,