Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(avform): add missing "first" video mode back to video modes
Browse files Browse the repository at this point in the history
This commit fixes the fact that the selectBestModes() function strips
off the first video mode, often a 1080p or 720p mode.

Fixes #3588.
  • Loading branch information
initramfs committed Aug 4, 2016
1 parent 0da1a2f commit 5324e76
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/widget/form/settings/avform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,22 @@ void AVForm::selectBestModes(QVector<VideoMode> &allVideoModes)
for (auto it = bestModeInds.rbegin(); it != bestModeInds.rend(); ++it)
{
VideoMode mode = allVideoModes[it->second];
int size = getModeSize(mode);
auto result = std::find_if(newVideoModes.cbegin(), newVideoModes.cend(),
[size](VideoMode mode) { return getModeSize(mode) == size; });

if (result == newVideoModes.end())
if(newVideoModes.empty())
{
newVideoModes.push_back(mode);
}
else
{
int size = getModeSize(mode);
auto result = std::find_if(newVideoModes.cbegin(), newVideoModes.cend(),
[size](VideoMode mode) { return getModeSize(mode) == size; });

if(result == newVideoModes.end())
{
newVideoModes.push_back(mode);
}
}
}
allVideoModes = newVideoModes;
}
Expand Down

0 comments on commit 5324e76

Please sign in to comment.