1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Improved automatic audio track selection

This commit is contained in:
Klaus Schmidinger 2005-02-27 10:36:19 +01:00
parent 6ef9ec9ac0
commit 43576a394f
2 changed files with 15 additions and 12 deletions

View File

@ -3416,7 +3416,7 @@ Video Disk Recorder Revision History
- Added missing reset of the 'repacker' to cTS2PES::Clear() (thanks to Marco
Schlüßler for reporting this one).
2005-02-26: Version 1.3.22
2005-02-27: Version 1.3.22
- Removed some unneeded code and fixed access to unallocated memory in
cEvent::FixEpgBugs() (thanks to Wolfgang Rohdewald).
@ -3437,3 +3437,4 @@ Video Disk Recorder Revision History
- Added 'smi' to the Finnish language codes (thanks to Rolf Ahrenberg).
- Fixed ensuring there is a current audio track in case there is only one track
(thanks to Werner Fink for reporting this one).
- Improved automatic audio track selection.

View File

@ -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)
int numAudioTracks = NumAudioTracks();
if (!availableTracks[currentAudioTrack].id && numAudioTracks && currentAudioTrackMissingCount++ > numAudioTracks * 10)
EnsureAudioTrack();
else if (t == currentAudioTrack)
currentAudioTrackMissingCount = 0;
}
return true;
}
else
@ -928,7 +931,6 @@ pre_1_3_19_PrivateStreamDeteced:
SubStreamType = 0x80;
SubStreamIndex = 0;
}
switch (SubStreamType) {
case 0x20: // SPU
case 0x30: // SPU