Skip to content

Commit 963e10c

Browse files
committed
yt-dlp: Если найден выбранный язык звуковой дорожки, то удаляем все остальные языки из списка.
В commit 5ccb72c были все изменения.
1 parent 5ccb72c commit 963e10c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/apps/mplayerc/PlayerYtDlp.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,10 @@ bool YT_DLP::SetFormats(const rapidjson::Document& doc, const CStringA& audioLan
668668
mAudioFormats = std::move(hlsAudioFormats);
669669
}
670670

671-
auto it = std::find_if(mAudioFormats..begin(), mAudioFormats.end(), [](const yt_aformat_t& a) { return a.language == audioLang; });
672-
for (auto& afmt : mAudioFormats) {
671+
auto it = std::find_if(mAudioFormats.cbegin(), mAudioFormats.cend(), [&audioLang](const yt_aformat_t& a) { return a.language == audioLang; });
672+
if (it != mAudioFormats.cend()) {
673+
mAudioFormats.erase(std::remove_if(mAudioFormats.begin(), mAudioFormats.end(), [&audioLang](yt_aformat_t a) { return a.language != audioLang; }), hlsAudioFormats.end());
674+
}
673675

674676
std::sort(mVideoFormats.begin(), mVideoFormats.end(), [](const yt_vformat_t& a, const yt_vformat_t& b) {
675677
return (vformat_cmp(a, b) < 0);

0 commit comments

Comments
 (0)