From e36fe18c483b8e520752f61975e44ddd0317a332 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 23 Jan 2005 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.3.19=20-=20Making=20sure=20at=20least=20the?= =?UTF-8?q?=20default=20skin=20is=20available=20at=20program=20start=20in?= =?UTF-8?q?=20case=20a=20=20=20plugin=20needs=20to=20issue=20an=20error=20?= =?UTF-8?q?message=20(thanks=20to=20Achim=20Tuffentshammer=20for=20=20=20r?= =?UTF-8?q?eporting=20a=20crash=20in=20such=20a=20case).=20Also=20checking?= =?UTF-8?q?=20if=20there=20is=20a=20current=20skin=20=20=20in=20cSkins::Me?= =?UTF-8?q?ssage().=20-=20Completed=20the=20Finnish=20OSD=20texts=20and=20?= =?UTF-8?q?fixed=20internationalization=20of=20the=20text=20=20=20for=20"S?= =?UTF-8?q?etup/DVB/Audio=20language(s)"=20(thanks=20to=20Rolf=20Ahrenberg?= =?UTF-8?q?).=20-=20Completed=20the=20Estonian=20OSD=20texts=20and=20switc?= =?UTF-8?q?hed=20to=20iso8859-13=20character=20set=20=20=20(thanks=20to=20?= =?UTF-8?q?Arthur=20Konovalov).=20-=20Made=20cCondWait::SleepMs()=20sleep?= =?UTF-8?q?=20at=20least=203ms=20to=20avoid=20a=20possible=20busy=20wait.?= =?UTF-8?q?=20-=20Fixed=20canceling=20the=20LIRC=20thread=20(thanks=20to?= =?UTF-8?q?=20Marco=20Schl=C3=BC=C3=9Fler=20for=20pointing=20out=20=20=20t?= =?UTF-8?q?his=20one).=20-=20The=20"Green"=20button=20in=20the=20"Main"=20?= =?UTF-8?q?menu=20is=20now=20always=20"Audio",=20since=20the=20audio=20=20?= =?UTF-8?q?=20channel=20might=20be=20changed=20even=20if=20there=20is=20on?= =?UTF-8?q?ly=20one=20actual=20audio=20PID.=20-=20Fixed=20handling=20the?= =?UTF-8?q?=20'-E'=20option=20which=20was=20broken=20in=20version=201.3.18?= =?UTF-8?q?=20(thanks=20to=20=20=20Christian=20Jacobsen=20for=20reporting?= =?UTF-8?q?=20this=20one).=20-=20Added=20'channels.conf.terr'=20entries=20?= =?UTF-8?q?for=20Mainz=20(thanks=20to=20Michael=20Heyse).=20-=20Implemente?= =?UTF-8?q?d=20cDolbyRepacker=20for=20better=20handling=20of=20Dolby=20Dig?= =?UTF-8?q?ital=20PES=20packets=20=20=20(thanks=20to=20Reinhard=20Nissl).?= =?UTF-8?q?=20-=20Fixed=20playing=20files=20with=20PES=20packets=20longer?= =?UTF-8?q?=20than=202048=20byte=20through=20the=20full=20=20=20featured?= =?UTF-8?q?=20DVB=20card=20(thanks=20to=20Marco=20Kremer=20for=20reporting?= =?UTF-8?q?=20this=20one=20and=20providing=20=20=20a=20test=20sample).=20-?= =?UTF-8?q?=20Recording=20and=20Transfer=20Mode=20now=20handle=20more=20th?= =?UTF-8?q?an=202=20audio=20PIDs.=20For=20this=20the=20=20=20interfaces=20?= =?UTF-8?q?of=20the=20following=20functions=20have=20been=20changed:=20=20?= =?UTF-8?q?=20cTransferControl::cTransferControl()=20=20=20cTransfer::cTra?= =?UTF-8?q?nsfer()=20=20=20cRecorder::cRecorder()=20=20=20cReceiver::cRece?= =?UTF-8?q?iver()=20=20=20cRemux::cRemux()=20-=20Fixed=20a=20possible=20ra?= =?UTF-8?q?ce=20condition=20in=20cDevice::Action()=20and=20cTSBuffer::Acti?= =?UTF-8?q?on()=20=20=20(thanks=20to=20Stefan=20Huelswitt).=20-=20Extended?= =?UTF-8?q?=20some=20buffer=20sizes=20to=20allow=20handling=20HDTV=20strea?= =?UTF-8?q?ms=20(thanks=20to=20Reinhard=20=20=20Nissl).=20-=20Added=20'cha?= =?UTF-8?q?nnels.conf.terr'=20entries=20for=20D=C3=BCsseldorf=20and=20K?= =?UTF-8?q?=C3=B6ln=20(thanks=20to=20Walter=20Koch).=20-=20Falling=20back?= =?UTF-8?q?=20to=20'stereo'=20when=20switching=20channels=20in=20case=20th?= =?UTF-8?q?e=20user=20had=20switched=20=20=20to=20'left'=20or=20'right'=20?= =?UTF-8?q?(suggested=20by=20Rolf=20Groppe).=20-=20Completed=20the=20Danis?= =?UTF-8?q?h=20OSD=20texts=20(thanks=20to=20Mogens=20Elneff).=20-=20Record?= =?UTF-8?q?ing=20and=20Transfer=20Mode=20can=20now=20handle=20up=20to=208?= =?UTF-8?q?=20Dolby=20Digital=20tracks=20(thanks=20=20=20to=20Marco=20Schl?= =?UTF-8?q?=C3=BC=C3=9Fler=20for=20a=20patch=20that=20implements=20substre?= =?UTF-8?q?am=20handling=20into=20=20=20cDevice::PlayPesPacket(),=20and=20?= =?UTF-8?q?Reinhard=20Nissl=20for=20adding=20substream=20handling=20to=20?= =?UTF-8?q?=20=20cDolbyRepacker).=20-=20Added=20PlayPes(NULL,=200)=20to=20?= =?UTF-8?q?cTransfer::Action()=20when=20clearing=20the=20transfer=20buffer?= =?UTF-8?q?=20=20=20to=20avoid=20overflows=20(thanks=20to=20Marco=20Schl?= =?UTF-8?q?=C3=BC=C3=9Fler=20for=20pointing=20this=20out).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- device.c | 77 +++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 22 deletions(-) (limited to 'device.c') diff --git a/device.c b/device.c index 9e60b70..dcb6989 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.73 2005/01/09 12:36:48 kls Exp $ + * $Id: device.c 1.78 2005/01/23 15:41:05 kls Exp $ */ #include "device.h" @@ -512,7 +512,7 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) 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()! - cControl::Launch(new cTransferControl(CaDevice, Channel->Vpid(), Channel->Apid(0), Channel->Apid(1), Channel->Dpid(0), Channel->Dpid(1))); + cControl::Launch(new cTransferControl(CaDevice, Channel->Vpid(), Channel->Apids(), Channel->Dpids(), Channel->Spids())); else Result = scrNoTransfer; } @@ -545,11 +545,12 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) // Set the available audio tracks: ClrAvailableTracks(); currentAudioTrack = ttAudioFirst; - for (int i = 0; i < MAXAPIDS; i++) { + for (int i = 0; i < MAXAPIDS; i++) SetAvailableTrack(ttAudio, i, Channel->Apid(i), Channel->Alang(i)); - if (Setup.UseDolbyDigital) + if (Setup.UseDolbyDigital) { + for (int i = 0; i < MAXDPIDS; i++) SetAvailableTrack(ttDolby, i, Channel->Dpid(i), Channel->Dlang(i)); - } + } // Select the preferred audio track: eTrackType PreferredTrack = ttAudioFirst; int LanguagePreference = -1; @@ -568,6 +569,8 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView) const tTrackId *Track = GetTrack(GetCurrentAudioTrack()); if (!Track || !Track->id || PreferredTrack != GetCurrentAudioTrack()) SetCurrentAudioTrack(PreferredTrack); + // Fall back to stereo: + SetAudioChannel(0); } cStatus::MsgChannelSwitch(this, Channel->Number()); // only report status if channel switch successfull } @@ -657,8 +660,10 @@ void cDevice::ClrAvailableTracks(bool DescriptionsOnly) for (int i = ttNone; i < ttMaxTrackTypes; i++) *availableTracks[i].description = 0; } - else + else { memset(availableTracks, 0, sizeof(availableTracks)); + pre_1_3_19_PrivateStream = false; + } } bool cDevice::SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const char *Language, const char *Description, uint32_t Flags) @@ -834,22 +839,49 @@ int cDevice::PlayPesPacket(const uchar *Data, int Length, bool VideoOnly) if (!VideoOnly && c == availableTracks[currentAudioTrack].id) w = PlayAudio(Start, d); break; - case 0xBD: // dolby - if (Setup.UseDolbyDigital) { - SetAvailableTrack(ttDolby, 0, c); - if (!VideoOnly && c == availableTracks[currentAudioTrack].id) { - w = PlayAudio(Start, d); - if (FirstLoop) - Audios.PlayAudio(Data, Length); - } + case 0xBD: { // private stream 1 + int PayloadOffset = Data[8] + 9; + uchar SubStreamId = Data[PayloadOffset]; + uchar SubStreamType = SubStreamId & 0xE0; + uchar SubStreamIndex = SubStreamId & 0x1F; + + // Compatibility mode for old VDR recordings, where 0xBD was only AC3: + //TODO apparently this doesn't work for old ORF Dolby Digital recordings + if (!pre_1_3_19_PrivateStream && (Data[6] & 4) && Data[PayloadOffset] == 0x0B && Data[PayloadOffset + 1] == 0x77) + pre_1_3_19_PrivateStream = true; + if (pre_1_3_19_PrivateStream) { + SubStreamId = c; + SubStreamType = 0x80; + SubStreamIndex = 0; } + + switch (SubStreamType) { + case 0x20: // SPU + break; + case 0x80: // AC3 & DTS + if (Setup.UseDolbyDigital) { + SetAvailableTrack(ttDolby, SubStreamIndex, SubStreamId); + if (!VideoOnly && SubStreamId == availableTracks[currentAudioTrack].id) { + w = PlayAudio(Start, d); + if (FirstLoop && !(SubStreamId & 0x08)) // no DTS + Audios.PlayAudio(Data, Length); + } + } + break; + case 0xA0: // LPCM + SetAvailableTrack(ttAudio, SubStreamIndex, SubStreamId); + if (!VideoOnly && SubStreamId == availableTracks[currentAudioTrack].id) + w = PlayAudio(Start, d); + break; + } + } break; default: ;//esyslog("ERROR: unexpected packet id %02X", c); } if (w > 0) Start += w; - else if (w <= 0) { + else { if (Start != Data) esyslog("ERROR: incomplete PES packet write!"); return Start == Data ? w : Start - Data; @@ -990,8 +1022,7 @@ bool cDevice::Receiving(bool CheckAny) const void cDevice::Action(void) { - active = true; - if (OpenDvr()) { + if (active && OpenDvr()) { for (; active;) { // Read data from the DVR device: uchar *b = NULL; @@ -1041,7 +1072,7 @@ bool cDevice::AttachReceiver(cReceiver *Receiver) cMutexLock MutexLock(&mutexReceiver); for (int i = 0; i < MAXRECEIVERS; i++) { if (!receiver[i]) { - for (int n = 0; n < MAXRECEIVEPIDS; n++) { + for (int n = 0; n < Receiver->numPids; n++) { if (!AddPid(Receiver->pids[n])) { for ( ; n-- > 0; ) DelPid(Receiver->pids[n]); @@ -1053,7 +1084,10 @@ bool cDevice::AttachReceiver(cReceiver *Receiver) Receiver->device = this; receiver[i] = Receiver; Unlock(); - Start(); + if (!active) { + active = true; + Start(); + } return true; } } @@ -1074,7 +1108,7 @@ void cDevice::Detach(cReceiver *Receiver) receiver[i] = NULL; Receiver->device = NULL; Unlock(); - for (int n = 0; n < MAXRECEIVEPIDS; n++) + for (int n = 0; n < Receiver->numPids; n++) DelPid(Receiver->pids[n]); } else if (receiver[i]) @@ -1093,10 +1127,10 @@ cTSBuffer::cTSBuffer(int File, int Size, int CardIndex) SetDescription("TS buffer on device %d", CardIndex); f = File; cardIndex = CardIndex; - active = false; delivered = false; ringBuffer = new cRingBufferLinear(Size, TS_SIZE, true, "TS"); ringBuffer->SetTimeouts(100, 100); + active = true; Start(); } @@ -1112,7 +1146,6 @@ void cTSBuffer::Action(void) if (ringBuffer) { bool firstRead = true; cPoller Poller(f); - active = true; for (; active;) { if (firstRead || Poller.Poll(100)) { firstRead = false; -- cgit v1.2.3