--- device.c.orig 2007-11-03 14:30:09.000000000 +0100 +++ device.c 2008-04-08 15:06:51.000000000 +0200 @@ -209,9 +209,6 @@ // The default priority for non-primary devices: #define DEFAULTPRIORITY -1 -// The minimum number of unknown PS1 packets to consider this a "pre 1.3.19 private stream": -#define MIN_PRE_1_3_19_PRIVATESTREAM 10 - int cDevice::numDevices = 0; int cDevice::useDevice = 0; int cDevice::nextCardIndex = 0; @@ -934,7 +931,7 @@ } else memset(availableTracks, 0, sizeof(availableTracks)); - pre_1_3_19_PrivateStream = 0; + pre_1_3_19_PrivateStream = false; SetAudioChannel(0); // fall back to stereo currentAudioTrackMissingCount = 0; currentAudioTrack = ttNone; @@ -1239,7 +1236,7 @@ int PayloadOffset = Data[8] + 9; // Compatibility mode for old subtitles plugin: - if ((Data[7] & 0x01) && (Data[PayloadOffset - 3] & 0x81) == 0x01 && Data[PayloadOffset - 2] == 0x81) + if ((Data[PayloadOffset - 3] & 0x81) == 1 && Data[PayloadOffset - 2] == 0x81) PayloadOffset--; uchar SubStreamId = Data[PayloadOffset]; @@ -1248,13 +1245,11 @@ // Compatibility mode for old VDR recordings, where 0xBD was only AC3: pre_1_3_19_PrivateStreamDeteced: - if (pre_1_3_19_PrivateStream > MIN_PRE_1_3_19_PRIVATESTREAM) { + if (pre_1_3_19_PrivateStream) { SubStreamId = c; SubStreamType = 0x80; SubStreamIndex = 0; } - else if (pre_1_3_19_PrivateStream) - pre_1_3_19_PrivateStream--; // every known PS1 packet counts down towards 0 to recover from glitches... switch (SubStreamType) { case 0x20: // SPU case 0x30: // SPU @@ -1282,14 +1277,11 @@ break; default: // Compatibility mode for old VDR recordings, where 0xBD was only AC3: - if (pre_1_3_19_PrivateStream <= MIN_PRE_1_3_19_PRIVATESTREAM) { - dsyslog("unknown PS1 packet, substream id = %02X (counter is at %d)", SubStreamId, pre_1_3_19_PrivateStream); - pre_1_3_19_PrivateStream += 2; // ...and every unknown PS1 packet counts up (the very first one counts twice, but that's ok) - if (pre_1_3_19_PrivateStream > MIN_PRE_1_3_19_PRIVATESTREAM) { - dsyslog("switching to pre 1.3.19 Dolby Digital compatibility mode - substream id = %02X", SubStreamId); - ClrAvailableTracks(); - goto pre_1_3_19_PrivateStreamDeteced; - } + if (!pre_1_3_19_PrivateStream) { + dsyslog("switching to pre 1.3.19 Dolby Digital compatibility mode"); + ClrAvailableTracks(); + pre_1_3_19_PrivateStream = true; + goto pre_1_3_19_PrivateStreamDeteced; } } }