Browse Source

feat(camera): add higher resolution camera options

Fix #5065
reviewable/pr5075/r2
Anthony Bilinski 7 years ago
parent
commit
04ecfe3f34
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 6
      src/video/videomode.cpp
  2. 1
      src/video/videomode.h
  3. 4
      src/widget/form/settings/avform.cpp

6
src/video/videomode.cpp

@ -67,6 +67,12 @@ uint32_t VideoMode::norm(const VideoMode& other) const @@ -67,6 +67,12 @@ uint32_t VideoMode::norm(const VideoMode& other) const
return qAbs(this->width - other.width) + qAbs(this->height - other.height);
}
uint32_t VideoMode::tolerance() const
{
constexpr uint32_t toleranceFactor = 10; // video mode must be within 10% to be "close enough" to ideal
return (width + height)/toleranceFactor;
}
/**
* @brief All zeros means a default/unspecified mode
*/

1
src/video/videomode.h

@ -39,6 +39,7 @@ struct VideoMode @@ -39,6 +39,7 @@ struct VideoMode
operator bool() const;
bool operator==(const VideoMode& other) const;
uint32_t norm(const VideoMode& other) const;
uint32_t tolerance() const;
};
#endif // VIDEOMODE_H

4
src/widget/form/settings/avform.cpp

@ -230,6 +230,8 @@ void AVForm::selectBestModes(QVector<VideoMode>& allVideoModes) @@ -230,6 +230,8 @@ void AVForm::selectBestModes(QVector<VideoMode>& allVideoModes)
idealModes[480] = VideoMode(854, 480);
idealModes[720] = VideoMode(1280, 720);
idealModes[1080] = VideoMode(1920, 1080);
idealModes[1440] = VideoMode(2560, 1440);
idealModes[2160] = VideoMode(3840, 2160);
std::map<int, int> bestModeInds;
for (int i = 0; i < allVideoModes.size(); ++i) {
@ -244,7 +246,7 @@ void AVForm::selectBestModes(QVector<VideoMode>& allVideoModes) @@ -244,7 +246,7 @@ void AVForm::selectBestModes(QVector<VideoMode>& allVideoModes)
VideoMode idealMode = iter->second;
// don't take approximately correct resolutions unless they really
// are close
if (mode.norm(idealMode) > 300)
if (mode.norm(idealMode) > idealMode.tolerance())
continue;
if (bestModeInds.find(res) == bestModeInds.end()) {

Loading…
Cancel
Save