gui/movieplayer.cpp: try to select file play audio lang from audio preferences

This commit is contained in:
[CST] Focus
2014-02-18 14:20:09 +04:00
parent d93dafed84
commit 64688db9c4
2 changed files with 41 additions and 9 deletions

View File

@@ -585,15 +585,8 @@ void CMoviePlayerGui::PlayFile(void)
playback->SetSpeed(1);
}
}
if (is_file_player && ext_subs) {
playback->FindAllSubs(spids, sub_supported, &numsubs, slanguage);
for (unsigned count = 0; count < numsubs; count++) {
if (spids[count] == 0x1FFF) {
currentspid = spids[count];
playback->SelectSubtitles(currentspid);
}
}
}
if (is_file_player)
selectAutoLang();
CAudioMute::getInstance()->enableMuteIcon(true);
InfoClock->enableInfoClock(true);
@@ -1557,3 +1550,41 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data)
avsubtitle_free(sub);
delete sub;
}
void CMoviePlayerGui::selectAutoLang()
{
if (ext_subs) {
playback->FindAllSubs(spids, sub_supported, &numsubs, slanguage);
for (unsigned count = 0; count < numsubs; count++) {
if (spids[count] == 0x1FFF) {
currentspid = spids[count];
playback->SelectSubtitles(currentspid);
}
}
}
if(g_settings.auto_lang) {
int pref_idx = -1;
playback->FindAllPids(apids, ac3flags, &numpida, language);
for(int i = 0; i < 3; i++) {
for (unsigned j = 0; j < numpida; j++) {
std::map<std::string, std::string>::const_iterator it;
for(it = iso639.begin(); it != iso639.end(); ++it) {
if (g_settings.pref_lang[i] == it->second && strncasecmp(language[j].c_str(), it->first.c_str(), 3) == 0) {
pref_idx = j;
break;
}
}
if (pref_idx >= 0)
break;
}
if (pref_idx >= 0)
break;
}
if (pref_idx >= 0) {
currentapid = apids[pref_idx];
currentac3 = ac3flags[pref_idx];
playback->SetAPid(currentapid, currentac3);
}
}
}

View File

@@ -141,6 +141,7 @@ class CMoviePlayerGui : public CMenuTarget
void showSubtitle(neutrino_msg_data_t data);
void clearSubtitle();
void selectChapter();
void selectAutoLang();
void Cleanup();
static void *ShowStartHint(void *arg);