No longer actually tuning the primary interface in 'Transfer Mode'

This commit is contained in:
Klaus Schmidinger 2001-07-29 09:24:47 +02:00
parent 5d415c08d0
commit bdfeda21c7
2 changed files with 126 additions and 114 deletions

View File

@ -586,7 +586,6 @@ Video Disk Recorder Revision History
- DiSEqC support can now be generally enabled/disabled in the Setup menu. This
may be necessary if your multiswitch gets irritated by the default DiSEqC
codes '0' (thanks to Markus Lang).
- Avoiding audio/video distortions in 'Transfer Mode'.
- Fixed replaying in case there is no index file.
- Fixed jumping to an editing mark when replay has been paused.
- Avoiding unnecessary code execution in the replay progress display (thanks
@ -603,3 +602,7 @@ Video Disk Recorder Revision History
confirmation messages (like "Delete...") to "black on yellow".
- Fixed display with DEBUG_OSD (it still crashes sometimes, esp. when replaying,
but I can't seem to find what causes this... any ideas anybody?).
- Avoiding audio/video distortions in 'Transfer Mode' by no longer actually
tuning the primary interface (which can't receive this channel, anyway).
Apparently the driver gets irritated when the channel is switched and a
replay session is started immediately after that.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.c 1.93 2001/07/28 11:45:04 kls Exp $
* $Id: dvbapi.c 1.94 2001/07/29 09:00:19 kls Exp $
*/
#include "dvbapi.h"
@ -2116,6 +2116,15 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization,
StopTransfer();
StopReplay();
// Must set this anyway to avoid getting stuck when switching through
// channels with 'Up' and 'Down' keys:
currentChannel = ChannelNumber;
vPid = Vpid;
aPid1 = Apid1;
aPid2 = Apid2;
dPid1 = Dpid1;
dPid2 = Dpid2;
// Avoid noise while switching:
if (fd_video >= 0 && fd_audio >= 0) {
@ -2125,6 +2134,13 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization,
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
}
// If this card can't receive this channel, we must not actually switch
// the channel here, because that would irritate the driver when we
// start replaying in Transfer Mode immediately after switching the channel:
bool NeedsTransferMode = (this == PrimaryDvbApi && Ca && Ca != Index() + 1);
if (!NeedsTransferMode) {
// Turn off current PIDs:
SetVpid( 0x1FFF, DMX_OUT_DECODER);
@ -2134,10 +2150,6 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization,
SetDpid2(0x1FFF, DMX_OUT_DECODER);
SetTpid( 0x1FFF, DMX_OUT_DECODER);
// Must set this anyway to avoid getting stuck when switching through
// channels with 'Up' and 'Down' keys:
currentChannel = ChannelNumber;
bool ChannelSynced = false;
if (fd_qpskfe >= 0 && fd_sec >= 0) { // DVB-S
@ -2239,11 +2251,6 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization,
// PID settings:
vPid = Vpid;
aPid1 = Apid1;
aPid2 = Apid2;
dPid1 = Dpid1;
dPid2 = Dpid2;
if (!SetPids(false)) {
esyslog(LOG_ERR, "ERROR: failed to set PIDs for channel %d", ChannelNumber);
return false;
@ -2251,24 +2258,26 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization,
SetTpid(Tpid, DMX_OUT_DECODER);
if (fd_audio >= 0)
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
}
if (this == PrimaryDvbApi && siProcessor)
siProcessor->SetCurrentServiceID(Pnr);
// If this DVB card can't receive this channel, let's see if we can
// use the card that actually can receive it and transfer data from there:
if (this == PrimaryDvbApi && Ca && Ca != Index() + 1) {
if (NeedsTransferMode) {
cDvbApi *CaDvbApi = GetDvbApi(Ca, 0);
if (CaDvbApi) {
if (!CaDvbApi->Recording()) {
if (CaDvbApi->SetChannel(ChannelNumber, FrequencyMHz, Polarization, Diseqc, Srate, Vpid, Apid1, Apid2, Dpid1, Dpid2, Tpid, Ca, Pnr)) {
usleep(500000); // avoids distortions (apparently switching into replay mode immediately after tuning causes problems)
SetModeReplay();
transferringFromDvbApi = CaDvbApi->StartTransfer(fd_video);
}
}
}
}
if (fd_video >= 0 && fd_audio >= 0) {
CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false));
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, false));