summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-01-23 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-01-23 18:00:00 +0100
commite36fe18c483b8e520752f61975e44ddd0317a332 (patch)
tree83cbf9e5ec53bcf099f702028f9d6720f5fe13ce /device.c
parentfb5cccb2df60361a18fe3fd572b0fe18f3a4331c (diff)
downloadvdr-patch-lnbsharing-e36fe18c483b8e520752f61975e44ddd0317a332.tar.gz
vdr-patch-lnbsharing-e36fe18c483b8e520752f61975e44ddd0317a332.tar.bz2
Version 1.3.19vdr-1.3.19
- Making sure at least the default skin is available at program start in case a plugin needs to issue an error message (thanks to Achim Tuffentshammer for reporting a crash in such a case). Also checking if there is a current skin in cSkins::Message(). - Completed the Finnish OSD texts and fixed internationalization of the text for "Setup/DVB/Audio language(s)" (thanks to Rolf Ahrenberg). - Completed the Estonian OSD texts and switched to iso8859-13 character set (thanks to Arthur Konovalov). - Made cCondWait::SleepMs() sleep at least 3ms to avoid a possible busy wait. - Fixed canceling the LIRC thread (thanks to Marco Schlüßler for pointing out this one). - The "Green" button in the "Main" menu is now always "Audio", since the audio channel might be changed even if there is only one actual audio PID. - Fixed handling the '-E' option which was broken in version 1.3.18 (thanks to Christian Jacobsen for reporting this one). - Added 'channels.conf.terr' entries for Mainz (thanks to Michael Heyse). - Implemented cDolbyRepacker for better handling of Dolby Digital PES packets (thanks to Reinhard Nissl). - Fixed playing files with PES packets longer than 2048 byte through the full featured DVB card (thanks to Marco Kremer for reporting this one and providing a test sample). - Recording and Transfer Mode now handle more than 2 audio PIDs. For this the interfaces of the following functions have been changed: cTransferControl::cTransferControl() cTransfer::cTransfer() cRecorder::cRecorder() cReceiver::cReceiver() cRemux::cRemux() - Fixed a possible race condition in cDevice::Action() and cTSBuffer::Action() (thanks to Stefan Huelswitt). - Extended some buffer sizes to allow handling HDTV streams (thanks to Reinhard Nissl). - Added 'channels.conf.terr' entries for Düsseldorf and Köln (thanks to Walter Koch). - Falling back to 'stereo' when switching channels in case the user had switched to 'left' or 'right' (suggested by Rolf Groppe). - Completed the Danish OSD texts (thanks to Mogens Elneff). - Recording and Transfer Mode can now handle up to 8 Dolby Digital tracks (thanks to Marco Schlüßler for a patch that implements substream handling into cDevice::PlayPesPacket(), and Reinhard Nissl for adding substream handling to cDolbyRepacker). - Added PlayPes(NULL, 0) to cTransfer::Action() when clearing the transfer buffer to avoid overflows (thanks to Marco Schlüßler for pointing this out).
Diffstat (limited to 'device.c')
-rw-r--r--device.c77
1 files changed, 55 insertions, 22 deletions
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;