Permalink
Browse files

prefer matching language to the default audio track in auto selection

From http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-February/046403.html
Streams marked as default are to be selected for playback (or whatever
else) if the user does not have any other preference (like language, or
an exact stream id).
  • Loading branch information...
dekarl committed Dec 16, 2012
1 parent 55591ed commit 0e155f7c5ff0b67b8e0750ea7d866bb88eea04dc
Showing with 16 additions and 12 deletions.
  1. +16 −12 mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -3987,18 +3987,6 @@ int AvFormatDecoder::AutoSelectAudioTrack(void)
int selTrack = (1 == numStreams) ? 0 : -1;
int wlang = wtrack.language;
if (selTrack < 0 && numStreams)
{
LOG(VB_AUDIO, LOG_INFO, 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))
{
@@ -4114,6 +4102,22 @@ int AvFormatDecoder::AutoSelectAudioTrack(void)
selTrack = filter_max_ch(ic, atracks, flang);
}
}
// could not select track based on user preferences (language)
// try to select the default track
if (selTrack < 0 && numStreams)
{
LOG(VB_AUDIO, LOG_INFO, 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;
}
}
}
// try to get best track for any language
if (selTrack < 0)
{

0 comments on commit 0e155f7

Please sign in to comment.