From 6ef11b70be58246c9f77fe3e319a4d9bb8dbb83f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 15 Sep 2002 10:51:44 +0200 Subject: [PATCH] Starting Transfer Mode when recording current channel --- CONTRIBUTORS | 1 + HISTORY | 5 ++-- dvbdevice.c | 68 +++++++++++++++++++++++++++++++++------------------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 709177fd..1cf1e4b5 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -147,6 +147,7 @@ Stefan Huelswitt for improving cCondVar::Wait() and implementing cCondVar::TimedWait() for reporting a bug when entering an integer value outside the limit for adding play mode pmAudioOnlyBlack + for helping to fix starting a recording of the current channel with only one DVB card Ulrich Röder for pointing out that there are channels that have a symbol rate higher than diff --git a/HISTORY b/HISTORY index 424c0d7a..c75c52aa 100644 --- a/HISTORY +++ b/HISTORY @@ -1460,8 +1460,9 @@ Video Disk Recorder Revision History Stefan Huelswitt for reporting this one). - Added play mode pmAudioOnlyBlack (thanks to Stefan Huelswitt). -2002-09-14: Version 1.1.10 +2002-09-15: Version 1.1.10 - Removed a superfluous error message from cLockFile::Unlock() (reported by Helmut Auer). -- Fixed starting a recording of the current channel with only one DVB card. +- Fixed starting a recording of the current channel with only one DVB card + (thanks to Stefan Huelswitt for his help). diff --git a/dvbdevice.c b/dvbdevice.c index d455759b..904bb5ea 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 1.16 2002/09/14 13:26:16 kls Exp $ + * $Id: dvbdevice.c 1.17 2002/09/15 10:43:12 kls Exp $ */ #include "dvbdevice.h" @@ -390,30 +390,52 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) LiveView = true; #endif - // Avoid noise while switching: + bool DoTune = frequency != Channel->frequency; // TODO will be changed when DiSEqC handling is revised - if (HasDecoder()) { - CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, true)); - CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true)); - CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER)); - CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER)); - } + bool TurnOffLivePIDs = HasDecoder() + && (DoTune + || Channel->ca > CACONFBASE // CA channels can only be decrypted in "live" mode + || IsPrimaryDevice() + && (LiveView // for a new live view the old PIDs need to be turned off + || pidHandles[ptVideo].pid == Channel->vpid // for recording the PIDs must be shifted from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER + ) + ); + + bool StartTransferMode = IsPrimaryDevice() && !DoTune + && (LiveView && HasPid(Channel->vpid) && pidHandles[ptVideo].pid != Channel->vpid // the PID is already set as DMX_PES_OTHER + || !LiveView && pidHandles[ptVideo].pid == Channel->vpid // a recording is going to shift the PIDs from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER + ); + + bool TurnOnLivePIDs = HasDecoder() && !StartTransferMode + && (Channel->ca > CACONFBASE // CA channels can only be decrypted in "live" mode + || LiveView + ); // Stop setting system time: if (siProcessor) siProcessor->SetCurrentTransponder(0); - // Turn off current PIDs: + // Turn off live PIDs if necessary: + + if (TurnOffLivePIDs) { + + // Avoid noise while switching: + + CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, true)); + CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true)); + CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER)); + CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER)); + + // Turn off live PIDs: - if (IsPrimaryDevice() && (LiveView || pidHandles[ptVideo].pid == Channel->vpid)) { DelPid(pidHandles[ptAudio].pid); DelPid(pidHandles[ptVideo].pid); DelPid(pidHandles[ptTeletext].pid); DelPid(pidHandles[ptDolby].pid); } - if (frequency != Channel->frequency || Channel->ca > CACONFBASE) { // CA channels can only be decrypted in "live" mode + if (DoTune) { #ifdef NEWSTRUCT dvb_frontend_parameters Frontend; @@ -595,21 +617,19 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) // PID settings: - if (HasDecoder() && (LiveView || !IsPrimaryDevice() || Channel->ca > CACONFBASE)) { // CA channels can only be decrypted in "live" mode - if (!HasPid(Channel->vpid) && (IsPrimaryDevice() || !pidHandles[ptVideo].used || Channel->ca > CACONFBASE)) { - if (!(AddPid(Channel->apid1, ptAudio) && AddPid(Channel->vpid, ptVideo))) {//XXX+ dolby dpid1!!! (if audio plugins are attached) - esyslog("ERROR: failed to set PIDs for channel %d", Channel->number); - return false; - } - if (IsPrimaryDevice()) - AddPid(Channel->tpid, ptTeletext); - CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true)); - CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false)); - CHECK(ioctl(fd_video, VIDEO_SET_BLANK, false)); + if (TurnOnLivePIDs) { + if (!(AddPid(Channel->apid1, ptAudio) && AddPid(Channel->vpid, ptVideo))) {//XXX+ dolby dpid1!!! (if audio plugins are attached) + esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->number, CardIndex() + 1); + return false; } - else if (LiveView) - cControl::Launch(new cTransferControl(this, Channel->vpid, Channel->apid1, 0, 0, 0)); + if (IsPrimaryDevice()) + AddPid(Channel->tpid, ptTeletext); + CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true)); + CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false)); + CHECK(ioctl(fd_video, VIDEO_SET_BLANK, false)); } + else if (StartTransferMode) + cControl::Launch(new cTransferControl(this, Channel->vpid, Channel->apid1, 0, 0, 0)); // Start setting system time: