summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'device.c')
-rw-r--r--device.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/device.c b/device.c
index 27b82629..c1dc7aba 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.76 2005/01/16 16:04:56 kls Exp $
+ * $Id: device.c 1.77 2005/01/23 14:10:15 kls Exp $
*/
#include "device.h"
@@ -660,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)
@@ -837,15 +839,42 @@ 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 & 0x80)) // 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);