1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added support for setting the video display mode

This commit is contained in:
Klaus Schmidinger 2005-02-20 12:01:05 +01:00
parent f038aaefc8
commit 51f41252cf
8 changed files with 72 additions and 9 deletions

View File

@ -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 <j.schmitz@web.de>
for reporting a bug in displaying the current channel when switching via the SVDRP

View File

@ -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).

View File

@ -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();
}
}

View File

@ -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).

View File

@ -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)

View File

@ -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);

View File

@ -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,

3
spu.h
View File

@ -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
@ -25,6 +25,7 @@ class 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,