diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2009-05-10 13:18:20 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2009-05-10 13:18:20 +0200 |
commit | ac3db05853d63614d7606228d2b47eec9a4fa473 (patch) | |
tree | c7bff119af9e16862fc8bc5808b890a1098044ed /dvbdevice.c | |
parent | 74646c048722be45ba4c5becec8765540fe940e8 (diff) | |
download | vdr-ac3db05853d63614d7606228d2b47eec9a4fa473.tar.gz vdr-ac3db05853d63614d7606228d2b47eec9a4fa473.tar.bz2 |
Checking fd_video in cDvbDevice::GetVideoSize() to avoid error messages on systems with no real primary replay device
Diffstat (limited to 'dvbdevice.c')
-rw-r--r-- | dvbdevice.c | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/dvbdevice.c b/dvbdevice.c index 43bc9d5b..7b5b5a01 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.16 2009/05/08 14:54:27 kls Exp $ + * $Id: dvbdevice.c 2.17 2009/05/10 13:13:04 kls Exp $ */ #include "dvbdevice.h" @@ -736,45 +736,51 @@ void cDvbDevice::SetVideoFormat(bool VideoFormat16_9) eVideoSystem cDvbDevice::GetVideoSystem(void) { eVideoSystem VideoSystem = vsPAL; - video_size_t vs; - if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { - if (vs.h == 480 || vs.h == 240) - VideoSystem = vsNTSC; + if (fd_video >= 0) { + video_size_t vs; + if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { + if (vs.h == 480 || vs.h == 240) + VideoSystem = vsNTSC; + } + else + LOG_ERROR; } - else - LOG_ERROR; return VideoSystem; } void cDvbDevice::GetVideoSize(int &Width, int &Height, eVideoAspect &Aspect) { - video_size_t vs; - if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { - Width = vs.w; - Height = vs.h; - Aspect = eVideoAspect(vs.aspect_ratio); - return; + if (fd_video >= 0) { + video_size_t vs; + if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { + Width = vs.w; + Height = vs.h; + Aspect = eVideoAspect(vs.aspect_ratio); + return; + } + else + LOG_ERROR; } - else - LOG_ERROR; cDevice::GetVideoSize(Width, Height, Aspect); } void cDvbDevice::GetOsdSize(int &Width, int &Height, double &Aspect) { - video_size_t vs; - if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { - Width = 720; - if (vs.h != 480 && vs.h != 240) - Height = 576; // PAL + if (fd_video >= 0) { + video_size_t vs; + if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) { + Width = 720; + if (vs.h != 480 && vs.h != 240) + Height = 576; // PAL + else + Height = 480; // NTSC + Aspect = 1.0; + if (Width >= MINOSDWIDTH && Width <= MAXOSDWIDTH && Height >= MINOSDHEIGHT && Height <= MAXOSDHEIGHT) + return; + } else - Height = 480; // NTSC - Aspect = 1.0; - if (Width >= MINOSDWIDTH && Width <= MAXOSDWIDTH && Height >= MINOSDHEIGHT && Height <= MAXOSDHEIGHT) - return; + LOG_ERROR; } - else - LOG_ERROR; cDevice::GetOsdSize(Width, Height, Aspect); } |