Permalink
Browse files

Select the Default audio track if the container supports it.

Containers such as MKV permit one to define which audio track is primary, and using this flag means not going through the avformatdecoder guesswork we currently employ.  This is courtesy an anonymous patch on #8900.  I am uncomfortable with applying the part that prefers FLAC to E-AC3/DTS/AC3, though.  There are a lot of people out there who encode secondary tracks to FLAC and do a straight copy of the lossy primary track.  I just don't feel 100% on the idea of preferring it to other more commonplace codecs.

Fixes #8900.
  • Loading branch information...
1 parent 52c9e68 commit 486d2c5428c96d3f04b9f7d2646a823abf1bf1f7 Robert McNamara committed Jan 28, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -3431,6 +3431,18 @@ int AvFormatDecoder::AutoSelectAudioTrack(void)
int selTrack = (1 == numStreams) ? 0 : -1;
int wlang = wtrack.language;
+ if (selTrack < 0 && numStreams)
+ {
+ VERBOSE(VB_AUDIO, LOC + "Trying to select default track");
+ for (uint i = 0; i < atracks.size(); i++) {
+ int idx = atracks[i].av_stream_index;
+ if (ic->streams[idx]->disposition & AV_DISPOSITION_DEFAULT) {
+ selTrack = i;
+ break;
+ }
+ }
+ }
+
if ((selTrack < 0) && (wtrack.av_substream_index >= 0))
{
VERBOSE(VB_AUDIO, LOC + "Trying to reselect audio sub-stream");

0 comments on commit 486d2c5

Please sign in to comment.