summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-11-03 14:32:03 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2007-11-03 14:32:03 +0100
commit06f813d2a81b889ac1d1e2e8eb9c805243408abe (patch)
tree0463d5675384e28b505f82989dac09341574066e
parent2fa568654d92277511ee53e66fc73b5dc6efd376 (diff)
downloadvdr-06f813d2a81b889ac1d1e2e8eb9c805243408abe.tar.gz
vdr-06f813d2a81b889ac1d1e2e8eb9c805243408abe.tar.bz2
Added a workaround for recovering from wrongfully interpreted "pre 1.3.19 PS1 packets"
-rw-r--r--HISTORY3
-rw-r--r--device.c24
-rw-r--r--device.h4
3 files changed, 20 insertions, 11 deletions
diff --git a/HISTORY b/HISTORY
index d07488e7..0e4fcd8d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5488,7 +5488,7 @@ Video Disk Recorder Revision History
both opening and closing section filters (thanks to Rolf Ahrenberg).
- Some fixes to PLUGINS.html (thanks to Rolf Ahrenberg).
-2007-10-21: Version 1.5.11
+2007-11-03: Version 1.5.11
- Fixed checking compatibility mode for old subtitles plugin (thanks to Marco
Schlüßler).
@@ -5502,3 +5502,4 @@ Video Disk Recorder Revision History
- Added more special characters to the list of allowed characters when entering
strings (thanks to Thomas Günther).
- Added Ukrainian language texts (thanks to Yarema Aka Knedlyk).
+- Added a workaround for recovering from wrongfully interpreted "pre 1.3.19 PS1 packets".
diff --git a/device.c b/device.c
index 43b44aab..b8e5a8f5 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.146 2007/10/17 18:31:02 kls Exp $
+ * $Id: device.c 1.147 2007/11/03 13:30:09 kls Exp $
*/
#include "device.h"
@@ -209,6 +209,9 @@ int cPesAssembler::PacketSize(const uchar *data)
// 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;
@@ -931,7 +934,7 @@ void cDevice::ClrAvailableTracks(bool DescriptionsOnly, bool IdsOnly)
}
else
memset(availableTracks, 0, sizeof(availableTracks));
- pre_1_3_19_PrivateStream = false;
+ pre_1_3_19_PrivateStream = 0;
SetAudioChannel(0); // fall back to stereo
currentAudioTrackMissingCount = 0;
currentAudioTrack = ttNone;
@@ -1245,11 +1248,13 @@ int cDevice::PlayPesPacket(const uchar *Data, int Length, bool VideoOnly)
// Compatibility mode for old VDR recordings, where 0xBD was only AC3:
pre_1_3_19_PrivateStreamDeteced:
- if (pre_1_3_19_PrivateStream) {
+ if (pre_1_3_19_PrivateStream > MIN_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
@@ -1277,11 +1282,14 @@ pre_1_3_19_PrivateStreamDeteced:
break;
default:
// Compatibility mode for old VDR recordings, where 0xBD was only AC3:
- 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;
+ 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;
+ }
}
}
}
diff --git a/device.h b/device.h
index 825aadf5..0139f4e1 100644
--- a/device.h
+++ b/device.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.h 1.85 2007/10/14 13:09:12 kls Exp $
+ * $Id: device.h 1.86 2007/11/03 13:30:00 kls Exp $
*/
#ifndef __DEVICE_H
@@ -377,7 +377,7 @@ private:
cMutex mutexCurrentSubtitleTrack;
int currentAudioTrackMissingCount;
bool autoSelectPreferredSubtitleLanguage;
- bool pre_1_3_19_PrivateStream;
+ int pre_1_3_19_PrivateStream;
protected:
virtual void SetAudioTrackDevice(eTrackType Type);
///< Sets the current audio track to the given value.