From 8c63e0fd967a7ac037872ca5af378dc92f0410fa Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 27 Nov 2005 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.3.37=20-=20Added=20compiler=20options=20"-f?= =?UTF-8?q?PIC=20-g"=20to=20all=20plugins=20(thanks=20to=20Rolf=20Ahrenber?= =?UTF-8?q?g).=20-=20Fixed=20initializing=20the=20day=20index=20when=20edi?= =?UTF-8?q?ting=20the=20weekday=20parameter=20of=20a=20=20=20repeating=20t?= =?UTF-8?q?imer=20(thanks=20to=20Marco=20Schl=C3=BC=C3=9Fler).=20-=20No=20?= =?UTF-8?q?longer=20removing=20superfluous=20hyphens=20in=20EPG=20data=20-?= =?UTF-8?q?=20would=20become=20too=20=20=20language=20dependent=20to=20han?= =?UTF-8?q?dle=20all=20kinds=20of=20exceptions.=20-=20Modified=20switching?= =?UTF-8?q?=20to=20Dolby=20Digital=20audio=20in=20live=20mode,=20if=20the?= =?UTF-8?q?=20driver=20=20=20and=20firmware=20can=20handle=20live=20DD=20w?= =?UTF-8?q?ithout=20the=20need=20of=20a=20Transfer=20Mode=20(thanks=20=20?= =?UTF-8?q?=20to=20Werner=20Fink).=20Live=20DD=20mode=20requires=20a=20ful?= =?UTF-8?q?l=20featured=20DVB=20card=20and=20a=20=20=20LinuxDVB=20driver?= =?UTF-8?q?=20with=20firmware=20version=200x2622=20or=20higher.=20Older=20?= =?UTF-8?q?versions=20will=20=20=20use=20Transfer=20Mode=20just=20like=20b?= =?UTF-8?q?efore.=20-=20Implemented=20handling=20of=20the=20"CA=20PMT=20Re?= =?UTF-8?q?ply"=20for=20CAMs=20(thanks=20to=20Marco=20=20=20Schl=C3=BC?= =?UTF-8?q?=C3=9Fler=20for=20figuring=20out=20some=20obscure=20length=20by?= =?UTF-8?q?tes=20in=20the=20CA=20PMT=20Reply=20=20=20data=20of=20AlphaCryp?= =?UTF-8?q?t=20CAMs).=20-=20Some=20preparations=20for=20being=20able=20to?= =?UTF-8?q?=20record=20several=20encrypted=20channels=20from=20=20=20the?= =?UTF-8?q?=20same=20transponder=20at=20the=20same=20time=20(or=20record?= =?UTF-8?q?=20and=20view=20different=20encrypted=20=20=20channels),=20prov?= =?UTF-8?q?ided=20the=20CAM=20in=20use=20can=20handle=20this.=20This=20is?= =?UTF-8?q?=20work=20in=20progress=20=20=20and=20isn't=20actively=20used,?= =?UTF-8?q?=20yet.=20-=20Fixed=20SetProgress()=20in=20the=20'skincurses'?= =?UTF-8?q?=20plugin=20in=20case=20Total=20is=200=20(reported=20=20=20by?= =?UTF-8?q?=20Stefan=20Huelswitt).=20-=20Added=20a=20copy=20constructor=20?= =?UTF-8?q?to=20cString=20and=20fixed=20its=20assignment=20operator=20=20?= =?UTF-8?q?=20(thanks=20to=20Holger=20Brunn).=20-=20The=20new=20function?= =?UTF-8?q?=20Skins.QueueMessage()=20can=20be=20called=20from=20a=20backgr?= =?UTF-8?q?ound=20thread=20=20=20to=20queue=20a=20message=20for=20display.?= =?UTF-8?q?=20See=20VDR/skins.h=20for=20details.=20-=20The=20SVDRP=20comma?= =?UTF-8?q?nd=20MESG=20uses=20the=20new=20message=20queueing=20facility,?= =?UTF-8?q?=20so=20MESG=20=20=20commands=20may=20now=20be=20executed=20at?= =?UTF-8?q?=20any=20time,=20and=20the=20message=20will=20be=20displayed=20?= =?UTF-8?q?=20=20(no=20more=20"pending=20message").?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dvbdevice.c | 63 +++++++++++++++++++++---------------------------------------- 1 file changed, 22 insertions(+), 41 deletions(-) (limited to 'dvbdevice.c') diff --git a/dvbdevice.c b/dvbdevice.c index 3f9e144..30ce1e4 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.136 2005/08/21 09:17:20 kls Exp $ + * $Id: dvbdevice.c 1.138 2005/11/26 13:23:11 kls Exp $ */ #include "dvbdevice.h" @@ -35,6 +35,7 @@ extern "C" { #define DO_REC_AND_PLAY_ON_PRIMARY_DEVICE 1 #define DO_MULTIPLE_RECORDINGS 1 +//#define DO_MULTIPLE_CA_CHANNELS #define DEV_VIDEO "/dev/video" #define DEV_DVB_ADAPTER "/dev/dvb/adapter" @@ -69,15 +70,13 @@ static int DvbOpen(const char *Name, int n, int Mode, bool ReportError = false) class cDvbTuner : public cThread { private: - enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked, tsCam }; + enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked }; int fd_frontend; int cardIndex; fe_type_t frontendType; cCiHandler *ciHandler; cChannel channel; const char *diseqcCommands; - bool useCa; - time_t startTime; eTunerStatus tunerStatus; cMutex mutex; cCondVar locked; @@ -89,7 +88,7 @@ public: cDvbTuner(int Fd_Frontend, int CardIndex, fe_type_t FrontendType, cCiHandler *CiHandler); virtual ~cDvbTuner(); bool IsTunedTo(const cChannel *Channel) const; - void Set(const cChannel *Channel, bool Tune, bool UseCa); + void Set(const cChannel *Channel, bool Tune); bool Locked(int TimeoutMs = 0); }; @@ -100,9 +99,7 @@ cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, fe_type_t FrontendType, cCi frontendType = FrontendType; ciHandler = CiHandler; diseqcCommands = NULL; - useCa = false; tunerStatus = tsIdle; - startTime = time(NULL); if (frontendType == FE_QPSK) CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power SetDescription("tuner on device %d", cardIndex + 1); @@ -122,16 +119,11 @@ bool cDvbTuner::IsTunedTo(const cChannel *Channel) const return tunerStatus != tsIdle && channel.Source() == Channel->Source() && channel.Transponder() == Channel->Transponder(); } -void cDvbTuner::Set(const cChannel *Channel, bool Tune, bool UseCa) +void cDvbTuner::Set(const cChannel *Channel, bool Tune) { cMutexLock MutexLock(&mutex); if (Tune) tunerStatus = tsSet; - else if (tunerStatus == tsCam) - tunerStatus = tsLocked; - useCa = UseCa; - if (Channel->Ca() && tunerStatus != tsCam) - startTime = time(NULL); channel = *Channel; newSet.Broadcast(); } @@ -309,7 +301,6 @@ void cDvbTuner::Action(void) continue; case tsTuned: case tsLocked: - case tsCam: if (hasEvent) { if (event.status & FE_REINIT) { tunerStatus = tsSet; @@ -323,30 +314,10 @@ void cDvbTuner::Action(void) } } - if (ciHandler) { - if (ciHandler->Process() && useCa) { - if (tunerStatus == tsLocked) { - for (int Slot = 0; Slot < ciHandler->NumSlots(); Slot++) { - cCiCaPmt CaPmt(channel.Source(), channel.Transponder(), channel.Sid(), ciHandler->GetCaSystemIds(Slot)); - if (CaPmt.Valid()) { - CaPmt.AddPid(channel.Vpid(), 2); - CaPmt.AddPid(channel.Apid(0), 4); - CaPmt.AddPid(channel.Apid(1), 4); - CaPmt.AddPid(channel.Dpid(0), 0); - if (ciHandler->SetCaPmt(CaPmt, Slot)) { - tunerStatus = tsCam; - startTime = 0; - } - } - } - } - } - else if (tunerStatus > tsLocked) - tunerStatus = tsLocked; - } - // in the beginning we loop more often to let the CAM connection start up fast + if (ciHandler) + ciHandler->Process(); if (tunerStatus != tsTuned) - newSet.TimedWait(mutex, (ciHandler && (time(NULL) - startTime < 20)) ? 100 : 1000); + newSet.TimedWait(mutex, 1000); } } @@ -659,6 +630,11 @@ eVideoSystem cDvbDevice::GetVideoSystem(void) return VideoSystem; } +bool cDvbDevice::SetAudioBypass(bool On) +{ + return ioctl(fd_audio, AUDIO_SET_BYPASS_MODE, On) == 0; +} + // ptAudio ptVideo ptPcr ptTeletext ptDolby ptOther dmx_pes_type_t PesTypes[] = { DMX_PES_AUDIO, DMX_PES_VIDEO, DMX_PES_PCR, DMX_PES_TELETEXT, DMX_PES_OTHER, DMX_PES_OTHER }; @@ -777,9 +753,12 @@ bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Ne if (dvbTuner->IsTunedTo(Channel)) { if (Channel->Vpid() && !HasPid(Channel->Vpid()) || Channel->Apid(0) && !HasPid(Channel->Apid(0))) { #ifdef DO_MULTIPLE_RECORDINGS +#ifndef DO_MULTIPLE_CA_CHANNELS if (Ca() > CACONFBASE || Channel->Ca() > CACONFBASE) needsDetachReceivers = Ca() != Channel->Ca(); - else if (!IsPrimaryDevice()) + else +#endif + if (!IsPrimaryDevice()) result = true; #ifdef DO_REC_AND_PLAY_ON_PRIMARY_DEVICE else @@ -829,18 +808,19 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) // Set the tuner: - dvbTuner->Set(Channel, DoTune, !EITScanner.UsesDevice(this)); //XXX 1.3: this is an ugly hack - find a cleaner solution//XXX + dvbTuner->Set(Channel, DoTune); // If this channel switch was requested by the EITScanner we don't wait for // a lock and don't set any live PIDs (the EITScanner will wait for the lock // by itself before setting any filters): - if (EITScanner.UsesDevice(this)) + if (EITScanner.UsesDevice(this)) //XXX return true; // PID settings: if (TurnOnLivePIDs) { + SetAudioBypass(false); if (!(AddPid(Channel->Ppid(), ptPcr) && AddPid(Channel->Vpid(), ptVideo) && AddPid(Channel->Apid(0), ptAudio))) { esyslog("ERROR: failed to set PIDs for channel %d on device %d", Channel->Number(), CardIndex() + 1); return false; @@ -910,7 +890,8 @@ void cDvbDevice::SetAudioTrackDevice(eTrackType Type) { const tTrackId *TrackId = GetTrack(Type); if (TrackId && TrackId->id) { - if (IS_AUDIO_TRACK(Type)) { + SetAudioBypass(false); + if (IS_AUDIO_TRACK(Type) || (IS_DOLBY_TRACK(Type) && SetAudioBypass(true))) { if (pidHandles[ptAudio].pid && pidHandles[ptAudio].pid != TrackId->id) { DetachAll(pidHandles[ptAudio].pid); pidHandles[ptAudio].pid = TrackId->id; -- cgit v1.2.3