From patchwork Thu Jan 5 17:11:55 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Fischer X-Patchwork-Id: 12137 Received: from mail.gmx.net ([213.165.64.21]) by www.linuxtv.org with smtp (Exim 4.50) id 1EuYcU-0002j0-Fx for vdr@linuxtv.org; Thu, 05 Jan 2006 18:09:46 +0100 Received: (qmail invoked by alias); 05 Jan 2006 17:09:15 -0000 Received: from p5499469B.dip0.t-ipconnect.de (EHLO [192.168.2.10]) [84.153.70.155] by mail.gmx.net (mp035) with SMTP; 05 Jan 2006 18:09:15 +0100 X-Authenticated: #1735141 Message-ID: <43BD535B.7050707@gmx.de> Date: Thu, 05 Jan 2006 18:11:55 +0100 From: Patrick Fischer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20051002 Thunderbird/1.0.2 Mnenhy/0.7.2.0 X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: vdr@linuxtv.org X-Y-GMX-Trusted: 0 Subject: [vdr] Autodetach unused receiver X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jan 2006 17:09:46 -0000 Status: O X-Status: X-Keywords: X-UID: 6936 So I have written an Patch that fixed that unused cReceiver will be detached automaticly if the source was changed. Attach a cReceiver to Channel ABC on PID xyz. If you switch to an other Channel on the same transponder the you can still receiver the data on the PID xyz. But if you switch to an other Channel on an other transponder, then the receiver needs to detached (NeedsDetachReceivers). (depends on the Prio) For me it seems to be forgotten from Klaus. So I hope my patch will fix it. I need it for my Plugin. Hope this will included in 1.5.x :-) Greetings Patrick --- ../vdr-1.3.37_orig/device.c 2005-11-26 13:56:09.000000000 +0100 +++ device.c 2006-01-05 17:44:22.000000000 +0100 @@ -577,10 +577,15 @@ if (LiveView) StopReplay(); + // If this card switch to an other Channel and the attached reserver can't receiver there source, + // then they will be detached. It would be irritate if the receiver with was attached for a + // specified PID sudden receive data from an other channel which has accidental the same PID + bool NeedsDetachReceivers; + // 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 = (LiveView && IsPrimaryDevice() && !ProvidesChannel(Channel, Setup.PrimaryLimit)); + bool NeedsTransferMode = (LiveView && IsPrimaryDevice() && !ProvidesChannel(Channel, Setup.PrimaryLimit,&NeedsDetachReceivers)); eSetChannelResult Result = scrOk; @@ -588,11 +593,22 @@ // use the card that actually can receive it and transfer data from there: if (NeedsTransferMode) { - cDevice *CaDevice = GetDevice(Channel, 0); + cDevice *CaDevice = GetDevice(Channel, 0, &NeedsDetachReceivers); if (CaDevice && CanReplay()) { cStatus::MsgChannelSwitch(this, 0); // only report status if we are actually going to switch the channel - if (CaDevice->SetChannel(Channel, false) == scrOk) // calling SetChannel() directly, not SwitchChannel()! + if (CaDevice->SetChannel(Channel, false) == scrOk){ // calling SetChannel() directly, not SwitchChannel()! cControl::Launch(new cTransferControl(CaDevice, Channel->Vpid(), Channel->Apids(), Channel->Dpids(), Channel->Spids())); + + //detach all receivers from device + if (NeedsDetachReceivers){ + dsyslog("Need to detach all receivers from device. Source has been changed."); + for (int i = 0; i < MAXRECEIVERS; i++) { + if (CaDevice->receiver[i]){ + CaDevice->receiver[i]->Detach(); + } + } + } + } else Result = scrNoTransfer; } @@ -635,6 +651,16 @@ // Start decrypting any PIDs the might have been set in SetChannelDevice(): if (ciHandler) ciHandler->StartDecrypting(); + + //detach all receivers from device + if (NeedsDetachReceivers){ + dsyslog("Need to detach all receivers from device. Source will be changed."); + for (int i = 0; i < MAXRECEIVERS; i++) { + if (receiver[i]){ + receiver[i]->Detach(); + } + } + } } else Result = scrFailed;