From afb2f1bdec2cef12fe363d1ef25034e993f5e63e Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 12 Jun 2001 21:50:40 +0200 Subject: [PATCH] Improved channel switching --- HISTORY | 3 ++- dvbapi.c | 40 +++++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/HISTORY b/HISTORY index 8c583fac..e1497977 100644 --- a/HISTORY +++ b/HISTORY @@ -491,7 +491,7 @@ Video Disk Recorder Revision History - Updated version of Matthias Schniedermeyer's 'schnitt' tools. - New 'master-timer' tool (thanks to Matthias Schniedermeyer). -2001-06-03: Version 0.81 +2001-06-12: Version 0.81 - Fixed handling the case where the driver reports EAGAIN during recording, but no data comes within 5 seconds. @@ -504,3 +504,4 @@ Video Disk Recorder Revision History - Now 'runvdr' checks if the driver is already loaded (thanks to Henning Holtschneider). - Fixed removing recordings with Lifetime = 99. +- Improved channel switching. diff --git a/dvbapi.c b/dvbapi.c index dc71a97f..b1464423 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.70 2001/06/09 10:32:09 kls Exp $ + * $Id: dvbapi.c 1.71 2001/06/12 21:48:48 kls Exp $ */ #include "dvbapi.h" @@ -2046,6 +2046,12 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER)); } + // Turn off current PIDs: + + CHECK(ioctl(fd_demuxv, DMX_STOP)); + CHECK(ioctl(fd_demuxa, DMX_STOP)); + CHECK(ioctl(fd_demuxt, DMX_STOP)); + bool ChannelSynced = false; if (fd_qpskfe >= 0 && fd_sec >= 0) { // DVB-S @@ -2095,14 +2101,16 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, // Wait for channel sync: - qpskEvent event; - int res = ioctl(fd_qpskfe, QPSK_GET_EVENT, &event); - if (res == -EBUFFEROVERFLOW) - res = ioctl(fd_qpskfe, QPSK_GET_EVENT, &event); - if (res >= 0) - ChannelSynced = event.type == FE_COMPLETION_EV; + if (cFile::FileReady(fd_qpskfe, 5000)) { + qpskEvent event; + int res = ioctl(fd_qpskfe, QPSK_GET_EVENT, &event); + if (res >= 0) + ChannelSynced = event.type == FE_COMPLETION_EV; + else + esyslog(LOG_ERR, "ERROR %d in qpsk get event", res); + } else - esyslog(LOG_ERR, "ERROR in qpsk get event"); + fprintf(stderr, "ERROR: timeout while tuning\n"); } else if (fd_qamfe >= 0) { // DVB-C @@ -2120,14 +2128,16 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, // Wait for channel sync: - qamEvent event; - int res = ioctl(fd_qamfe, QAM_GET_EVENT, &event); - if (res == -EBUFFEROVERFLOW) - res = ioctl(fd_qamfe, QAM_GET_EVENT, &event); - if (res >= 0) - ChannelSynced = event.type == FE_COMPLETION_EV; + if (cFile::FileReady(fd_qamfe, 5000)) { + qamEvent event; + int res = ioctl(fd_qamfe, QAM_GET_EVENT, &event); + if (res >= 0) + ChannelSynced = event.type == FE_COMPLETION_EV; + else + esyslog(LOG_ERR, "ERROR %d in qam get event", res); + } else - esyslog(LOG_ERR, "ERROR in qam get event"); + fprintf(stderr, "ERROR: timeout while tuning\n"); } else { esyslog(LOG_ERR, "ERROR: attempt to set channel without DVB-S or DVB-C device");