diff -bur vdr-1.3.20_orig/device.c vdr-1.3.20/device.c --- vdr-1.3.20_orig/device.c 2005-02-06 21:16:58.000000000 +0100 +++ vdr-1.3.20/device.c 2005-02-06 22:43:29.000000000 +0100 @@ -235,6 +235,7 @@ 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 @@ 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) { } @@ -833,6 +856,7 @@ player->device = NULL; player = NULL; SetPlayMode(pmNone); + SetVideoDisplayFormat(vdfLetterBox); Audios.ClearAudio(); } } diff -bur vdr-1.3.20_orig/device.h vdr-1.3.20/device.h --- vdr-1.3.20_orig/device.h 2005-02-06 21:16:58.000000000 +0100 +++ vdr-1.3.20/device.h 2005-02-06 22:43:47.000000000 +0100 @@ -17,6 +17,7 @@ #include "pat.h" #include "ringbuffer.h" #include "sdt.h" +#include "spu.h" #include "sections.h" #include "thread.h" #include "tools.h" @@ -56,6 +57,11 @@ vsNTSC }; +enum eVideoDisplayFormat { vdfPanAndScan, + vdfLetterBox, + vdfCenterCutOut + }; + enum eTrackType { ttNone, ttAudio, ttAudioFirst = ttAudio, @@ -83,7 +89,6 @@ 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,7 @@ // Video format facilities public: + virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat); 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 -bur vdr-1.3.20_orig/dvbdevice.c vdr-1.3.20/dvbdevice.c --- vdr-1.3.20_orig/dvbdevice.c 2005-02-06 21:16:58.000000000 +0100 +++ vdr-1.3.20/dvbdevice.c 2005-02-06 22:44:27.000000000 +0100 @@ -598,10 +598,35 @@ 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 -bur vdr-1.3.20_orig/dvbdevice.h vdr-1.3.20/dvbdevice.h --- vdr-1.3.20_orig/dvbdevice.h 2005-02-06 21:16:58.000000000 +0100 +++ vdr-1.3.20/dvbdevice.h 2005-02-06 21:21:06.000000000 +0100 @@ -87,6 +87,7 @@ // Video format facilities public: + virtual void SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat); virtual void SetVideoFormat(bool VideoFormat16_9); virtual eVideoSystem GetVideoSystem(void); diff -bur vdr-1.3.20_orig/dvbspu.h vdr-1.3.20/dvbspu.h --- vdr-1.3.20_orig/dvbspu.h 2005-02-06 21:16:58.000000000 +0100 +++ vdr-1.3.20/dvbspu.h 2005-02-06 21:29:51.000000000 +0100 @@ -139,6 +139,7 @@ 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 -bur vdr-1.3.20_orig/spu.h vdr-1.3.20/spu.h --- vdr-1.3.20_orig/spu.h 2005-02-06 21:16:58.000000000 +0100 +++ vdr-1.3.20/spu.h 2005-02-06 22:18:09.000000000 +0100 @@ -25,6 +25,7 @@ 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,