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 - Added missing reset of the 'repacker' to cTS2PES::Clear() (thanks to Marco
Schlüßler for reporting this one). 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 - Removed some unneeded code and fixed access to unallocated memory in
cEvent::FixEpgBugs() (thanks to Wolfgang Rohdewald). 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). - 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 - Fixed ensuring there is a current audio track in case there is only one track
(thanks to Werner Fink for reporting this one). (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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "device.h"
@ -169,7 +169,7 @@ cDevice::cDevice(void)
player = NULL; player = NULL;
pesAssembler = new cPesAssembler; pesAssembler = new cPesAssembler;
ClrAvailableTracks(); ClrAvailableTracks();
currentAudioTrack = ttAudioFirst; currentAudioTrack = ttNone;
currentAudioTrackMissingCount = 0; currentAudioTrackMissingCount = 0;
for (int i = 0; i < MAXRECEIVERS; i++) for (int i = 0; i < MAXRECEIVERS; i++)
@ -598,13 +598,13 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
if (LiveView && IsPrimaryDevice()) { if (LiveView && IsPrimaryDevice()) {
// Set the available audio tracks: // Set the available audio tracks:
ClrAvailableTracks(); ClrAvailableTracks();
currentAudioTrack = ttAudioFirst;
for (int i = 0; i < MAXAPIDS; i++) for (int i = 0; i < MAXAPIDS; i++)
SetAvailableTrack(ttAudio, i, Channel->Apid(i), Channel->Alang(i)); SetAvailableTrack(ttAudio, i, Channel->Apid(i), Channel->Alang(i));
if (Setup.UseDolbyDigital) { if (Setup.UseDolbyDigital) {
for (int i = 0; i < MAXDPIDS; i++) for (int i = 0; i < MAXDPIDS; i++)
SetAvailableTrack(ttDolby, i, Channel->Dpid(i), Channel->Dlang(i)); SetAvailableTrack(ttDolby, i, Channel->Dpid(i), Channel->Dlang(i));
} }
currentChannel = Channel->Number();
EnsureAudioTrack(true); EnsureAudioTrack(true);
} }
} }
@ -705,6 +705,7 @@ void cDevice::ClrAvailableTracks(bool DescriptionsOnly)
pre_1_3_19_PrivateStream = false; pre_1_3_19_PrivateStream = false;
SetAudioChannel(0); // fall back to stereo SetAudioChannel(0); // fall back to stereo
currentAudioTrackMissingCount = 0; 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)); strn0cpy(availableTracks[t].language, Language, sizeof(availableTracks[t].language));
if (Description) if (Description)
strn0cpy(availableTracks[t].description, Description, sizeof(availableTracks[t].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 availableTracks[t].id = Id; // setting 'id' last to avoid the need for extensive locking
if (!availableTracks[currentAudioTrack].id && currentAudioTrackMissingCount++ > NumAudioTracks() * 10) int numAudioTracks = NumAudioTracks();
EnsureAudioTrack(); if (!availableTracks[currentAudioTrack].id && numAudioTracks && currentAudioTrackMissingCount++ > numAudioTracks * 10)
else if (t == currentAudioTrack) EnsureAudioTrack();
currentAudioTrackMissingCount = 0; else if (t == currentAudioTrack)
currentAudioTrackMissingCount = 0;
}
return true; return true;
} }
else else
@ -928,7 +931,6 @@ pre_1_3_19_PrivateStreamDeteced:
SubStreamType = 0x80; SubStreamType = 0x80;
SubStreamIndex = 0; SubStreamIndex = 0;
} }
switch (SubStreamType) { switch (SubStreamType) {
case 0x20: // SPU case 0x20: // SPU
case 0x30: // SPU case 0x30: // SPU
@ -1028,7 +1030,7 @@ int cDevice::PlayPes(const uchar *Data, int Length, bool VideoOnly)
if (i < Length) if (i < Length)
pesAssembler->Put(Data + i, Length - i); pesAssembler->Put(Data + i, Length - i);
return Length; return Length;
} }
int cDevice::Ca(void) const int cDevice::Ca(void) const
{ {