summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-02-27 10:36:19 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-02-27 10:36:19 +0100
commit43576a394f96a092c2aace344faf506bef760e37 (patch)
tree8f5ad9da0191212b9c104b96379032501add5693 /device.c
parent6ef9ec9ac0863fdd15e15b1e332270f1b09ab849 (diff)
downloadvdr-43576a394f96a092c2aace344faf506bef760e37.tar.gz
vdr-43576a394f96a092c2aace344faf506bef760e37.tar.bz2
Improved automatic audio track selection
Diffstat (limited to 'device.c')
-rw-r--r--device.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/device.c b/device.c
index 85d91235..6c74b08d 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.96 2005/02/26 11:45:10 kls Exp $
+ * $Id: device.c 1.97 2005/02/26 16:19:57 kls Exp $
*/
#include "device.h"
@@ -169,7 +169,7 @@ cDevice::cDevice(void)
player = NULL;
pesAssembler = new cPesAssembler;
ClrAvailableTracks();
- currentAudioTrack = ttAudioFirst;
+ currentAudioTrack = ttNone;
currentAudioTrackMissingCount = 0;
for (int i = 0; i < MAXRECEIVERS; i++)
@@ -598,13 +598,13 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
if (LiveView && IsPrimaryDevice()) {
// Set the available audio tracks:
ClrAvailableTracks();
- currentAudioTrack = ttAudioFirst;
for (int i = 0; i < MAXAPIDS; i++)
SetAvailableTrack(ttAudio, i, Channel->Apid(i), Channel->Alang(i));
if (Setup.UseDolbyDigital) {
for (int i = 0; i < MAXDPIDS; i++)
SetAvailableTrack(ttDolby, i, Channel->Dpid(i), Channel->Dlang(i));
}
+ currentChannel = Channel->Number();
EnsureAudioTrack(true);
}
}
@@ -705,6 +705,7 @@ void cDevice::ClrAvailableTracks(bool DescriptionsOnly)
pre_1_3_19_PrivateStream = false;
SetAudioChannel(0); // fall back to stereo
currentAudioTrackMissingCount = 0;
+ currentAudioTrack = ttNone;
}
}
@@ -717,12 +718,14 @@ bool cDevice::SetAvailableTrack(eTrackType Type, int Index, uint16_t Id, const c
strn0cpy(availableTracks[t].language, Language, sizeof(availableTracks[t].language));
if (Description)
strn0cpy(availableTracks[t].description, Description, sizeof(availableTracks[t].description));
- if (Id)
+ if (Id) {
availableTracks[t].id = Id; // setting 'id' last to avoid the need for extensive locking
- if (!availableTracks[currentAudioTrack].id && currentAudioTrackMissingCount++ > NumAudioTracks() * 10)
- EnsureAudioTrack();
- else if (t == currentAudioTrack)
- currentAudioTrackMissingCount = 0;
+ int numAudioTracks = NumAudioTracks();
+ if (!availableTracks[currentAudioTrack].id && numAudioTracks && currentAudioTrackMissingCount++ > numAudioTracks * 10)
+ EnsureAudioTrack();
+ else if (t == currentAudioTrack)
+ currentAudioTrackMissingCount = 0;
+ }
return true;
}
else
@@ -920,7 +923,7 @@ int cDevice::PlayPesPacket(const uchar *Data, int Length, bool VideoOnly)
uchar SubStreamId = Data[PayloadOffset];
uchar SubStreamType = SubStreamId & 0xF0;
uchar SubStreamIndex = SubStreamId & 0x1F;
-
+
// Compatibility mode for old VDR recordings, where 0xBD was only AC3:
pre_1_3_19_PrivateStreamDeteced:
if (pre_1_3_19_PrivateStream) {
@@ -928,7 +931,6 @@ pre_1_3_19_PrivateStreamDeteced:
SubStreamType = 0x80;
SubStreamIndex = 0;
}
-
switch (SubStreamType) {
case 0x20: // SPU
case 0x30: // SPU
@@ -1028,7 +1030,7 @@ int cDevice::PlayPes(const uchar *Data, int Length, bool VideoOnly)
if (i < Length)
pesAssembler->Put(Data + i, Length - i);
return Length;
- }
+}
int cDevice::Ca(void) const
{