Checking fd_video in cDvbDevice::GetVideoSize() to avoid error messages on systems with no real primary replay device

This commit is contained in:
Klaus Schmidinger 2009-05-10 13:18:20 +02:00
parent 74646c0487
commit ac3db05853
3 changed files with 39 additions and 27 deletions

View File

@ -2450,3 +2450,7 @@ Marcel Unbehaun <frostworks@gmx.de>
Günter Niedermeier <linuxtv@ncs-online.de>
for reporting a problem with file I/O overhead during recording in TS format
Martin Neuditschko <yosuke.tomoe@gmx.net>
for reporting a problem with error messages from cDvbDevice::GetVideoSize()
on systems with no real primary replay device

View File

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

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