From ac3db05853d63614d7606228d2b47eec9a4fa473 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 10 May 2009 13:18:20 +0200 Subject: Checking fd_video in cDvbDevice::GetVideoSize() to avoid error messages on systems with no real primary replay device --- CONTRIBUTORS | 4 ++++ HISTORY | 4 +++- dvbdevice.c | 58 ++++++++++++++++++++++++++++++++-------------------------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 80b1d1d6..13309162 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2450,3 +2450,7 @@ Marcel Unbehaun Günter Niedermeier for reporting a problem with file I/O overhead during recording in TS format + +Martin Neuditschko + for reporting a problem with error messages from cDvbDevice::GetVideoSize() + on systems with no real primary replay device diff --git a/HISTORY b/HISTORY index e4434e65..fd502e07 100644 --- a/HISTORY +++ b/HISTORY @@ -6075,7 +6075,7 @@ Video Disk Recorder Revision History - cFrameDetector::Analyze() now syncs on the TS packet sync bytes (thanks to Oliver Endriss for reporting broken index generation after a buffer overflow). -2009-05-08: Version 1.7.8 +2009-05-10: Version 1.7.8 - Fixed a typo in aspect ratio 2.21:1 (reported by Reinhard Nissl). - The name of the function cDevice::GetVideoSize() wasn't very well chosen @@ -6089,3 +6089,5 @@ Video Disk Recorder Revision History to Oliver Endriss). - Increased MAXOSDHEIGHT to 1200 (suggested by Nicolas Huillard). - Removed limitation to PAL resolution from SPU handling. +- Checking fd_video in cDvbDevice::GetVideoSize() to avoid error messages on + systems with no real primary replay device (reported by Martin Neuditschko). 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); } -- cgit v1.2.3