summaryrefslogtreecommitdiff
path: root/dvbdevice.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-08-17 13:41:06 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-08-17 13:41:06 +0200
commit1f3dbe585be2d71740529f4bf460b118213bcf92 (patch)
tree9b204d5812848ec17ebd9e83d9db68191fbbfee2 /dvbdevice.c
parent7bb744ccb03c9c5685e66c2db4fab62d7d3ec7f1 (diff)
downloadvdr-1f3dbe585be2d71740529f4bf460b118213bcf92.tar.gz
vdr-1f3dbe585be2d71740529f4bf460b118213bcf92.tar.bz2
Some optimizations in cDvbDevice::SetChannelDevice()
Diffstat (limited to 'dvbdevice.c')
-rw-r--r--dvbdevice.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/dvbdevice.c b/dvbdevice.c
index 8757710a..7d1a5c8c 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.164 2007/02/25 11:46:52 kls Exp $
+ * $Id: dvbdevice.c 1.165 2007/08/17 13:37:56 kls Exp $
*/
#include "dvbdevice.h"
@@ -793,18 +793,25 @@ bool cDvbDevice::IsTunedToTransponder(const cChannel *Channel)
bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
{
+ int apid = Channel->Apid(0);
+ int vpid = Channel->Vpid();
+ int dpid = Channel->Dpid(0);
+
bool DoTune = !dvbTuner->IsTunedTo(Channel);
+ bool pidHandlesVideo = pidHandles[ptVideo].pid == vpid;
+ bool pidHandlesAudio = pidHandles[ptAudio].pid == apid;
+
bool TurnOffLivePIDs = HasDecoder()
&& (DoTune
|| !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
+ || pidHandlesVideo // for recording the PIDs must be shifted from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER
);
bool StartTransferMode = IsPrimaryDevice() && !DoTune
- && (LiveView && HasPid(Channel->Vpid() ? Channel->Vpid() : Channel->Apid(0)) && (pidHandles[ptVideo].pid != Channel->Vpid() || (pidHandles[ptAudio].pid != Channel->Apid(0) && (Channel->Dpid(0) ? pidHandles[ptAudio].pid != Channel->Dpid(0) : true)))// the PID is already set as DMX_PES_OTHER
- || !LiveView && (pidHandles[ptVideo].pid == Channel->Vpid() || pidHandles[ptAudio].pid == Channel->Apid(0)) // a recording is going to shift the PIDs from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER
+ && (LiveView && HasPid(vpid ? vpid : apid) && (!pidHandlesVideo || (!pidHandlesAudio && (dpid ? pidHandles[ptAudio].pid != dpid : true)))// the PID is already set as DMX_PES_OTHER
+ || !LiveView && (pidHandlesVideo || pidHandlesAudio) // a recording is going to shift the PIDs from DMX_PES_AUDIO/VIDEO to DMX_PES_OTHER
);
if (CamSlot() && !ChannelCamRelations.CamDecrypt(Channel->GetChannelID(), CamSlot()->SlotNumber()))
StartTransferMode |= LiveView && IsPrimaryDevice() && Channel->Ca() >= CA_ENCRYPTED_MIN;
@@ -836,7 +843,7 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
if (TurnOnLivePIDs) {
SetAudioBypass(false);
- if (!(AddPid(Channel->Ppid(), ptPcr) && AddPid(Channel->Vpid(), ptVideo) && AddPid(Channel->Apid(0), ptAudio))) {
+ if (!(AddPid(Channel->Ppid(), ptPcr) && AddPid(vpid, ptVideo) && AddPid(apid, ptAudio))) {
esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1);
return false;
}
@@ -848,7 +855,7 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
}
else if (StartTransferMode)
- cControl::Launch(new cTransferControl(this, Channel->GetChannelID(), Channel->Vpid(), Channel->Apids(), Channel->Dpids(), Channel->Spids()));
+ cControl::Launch(new cTransferControl(this, Channel->GetChannelID(), vpid, Channel->Apids(), Channel->Dpids(), Channel->Spids()));
return true;
}