Skip to content

Commit

Permalink
Extend camera caching to Qt6.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticial committed Sep 29, 2023
1 parent 6c68ee3 commit 9e7f180
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ file(GLOB MAIN_SOURCES
Source/CommonFramework/VideoPipeline/Backends/CameraWidgetQt6.5.h
Source/CommonFramework/VideoPipeline/Backends/CameraWidgetQt6.cpp
Source/CommonFramework/VideoPipeline/Backends/CameraWidgetQt6.h
Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.5.cpp
Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.5.h
Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.cpp
Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.h
Source/CommonFramework/VideoPipeline/Backends/VideoToolsQt5.cpp
Source/CommonFramework/VideoPipeline/Backends/VideoToolsQt5.h
Source/CommonFramework/VideoPipeline/CameraInfo.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//#include "Common/Cpp/Time.h"
//#include "Common/Cpp/PrettyPrint.h"
#include "CommonFramework/VideoPipeline/CameraOption.h"
#include "MediaServicesQt6.5.h"
#include "MediaServicesQt6.h"
#include "CameraWidgetQt6.5.h"

//using std::cout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//#include "Common/Cpp/Exceptions.h"
//#include "Common/Cpp/Time.h"
#include "CommonFramework/VideoPipeline/CameraOption.h"
#include "MediaServicesQt6.h"
#include "CameraWidgetQt6.h"

//using std::cout;
Expand All @@ -27,15 +28,23 @@ namespace CameraQt6QVideoSink{


std::vector<CameraInfo> CameraBackend::get_all_cameras() const{
std::vector<CameraInfo> ret;
#if 1
const auto cameras = GlobalMediaServices::instance().get_all_cameras();
#else
const auto cameras = QMediaDevices::videoInputs();
#endif
std::vector<CameraInfo> ret;
for (const auto& info : cameras){
ret.emplace_back(info.id().toStdString());
}
return ret;
}
std::string CameraBackend::get_camera_name(const CameraInfo& info) const{
#if 1
const auto cameras = GlobalMediaServices::instance().get_all_cameras();
#else
const auto cameras = QMediaDevices::videoInputs();
#endif
for (const auto& camera : cameras){
if (camera.id().toStdString() == info.device_name()){
return camera.description().toStdString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

#include <QtGlobal>
#if QT_VERSION_MAJOR == 6 && QT_VERSION_MINOR >= 5
#if QT_VERSION_MAJOR == 6

#include "Common/Cpp/PrettyPrint.h"
#include "Common/Cpp/Time.h"
#include "CommonFramework/Logging/Logger.h"
#include "MediaServicesQt6.5.h"
#include "MediaServicesQt6.h"

namespace PokemonAutomation{

Expand Down

0 comments on commit 9e7f180

Please sign in to comment.