Skip to content

Commit f596c52

Browse files
committed
Fix load profile not loading resolution.
1 parent 5a5e226 commit f596c52

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/CameraWidgetQt6.5.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ CameraVideoSource::CameraVideoSource(
9696
, m_last_frame(logger)
9797
, m_snapshot_manager(logger, m_last_frame)
9898
{
99+
// cout << "desired_resolution = " << desired_resolution.width << " x " << desired_resolution.height << endl;
100+
99101
if (!info){
100102
return;
101103
}

SerialPrograms/Source/CommonFramework/VideoPipeline/VideoSession.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include "VideoSources/VideoSource_Null.h"
1313
#include "VideoSession.h"
1414

15-
// #include <iostream>
16-
// using std::cout;
17-
// using std::endl;
15+
//#include <iostream>
16+
//using std::cout;
17+
//using std::endl;
1818

1919
namespace PokemonAutomation{
2020

@@ -86,7 +86,7 @@ void VideoSession::get(VideoSourceOption& option){
8686
option = m_option;
8787
}
8888
void VideoSession::set(const VideoSourceOption& option){
89-
set_source(option.descriptor());
89+
set_source(option.descriptor(), option.m_resolution);
9090
}
9191

9292
void VideoSession::reset(){
@@ -119,9 +119,12 @@ void VideoSession::reset(){
119119
);
120120
});
121121
}
122-
void VideoSession::set_source(const std::shared_ptr<VideoSourceDescriptor>& device){
122+
void VideoSession::set_source(
123+
const std::shared_ptr<VideoSourceDescriptor>& device,
124+
Resolution resolution
125+
){
123126
m_logger.log("Changing video...", COLOR_GREEN);
124-
dispatch_to_main_thread([this, device]{
127+
dispatch_to_main_thread([this, device, resolution]{
125128
std::lock_guard<std::mutex> lg0(m_reset_lock);
126129
if (*m_descriptor == *device && !m_descriptor->should_reload()){
127130
return;
@@ -140,7 +143,9 @@ void VideoSession::set_source(const std::shared_ptr<VideoSourceDescriptor>& devi
140143
m_option.set_descriptor(device);
141144
m_descriptor = device;
142145

143-
Resolution desired_resolution = m_option.m_resolution;
146+
Resolution desired_resolution = resolution ? resolution : m_option.m_resolution;
147+
// cout << "VideoSession::set_source(): " << &m_option << " - " << desired_resolution.width << " x " << desired_resolution.height << endl;
148+
144149
m_video_source = device->make_VideoSource(m_logger, desired_resolution);
145150

146151
if (m_video_source){

SerialPrograms/Source/CommonFramework/VideoPipeline/VideoSession.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ class VideoSession
145145
// referenced video source option (aka the VideoSourceOption passed to the
146146
// VideoSession constructor).
147147
// The change is dispatched to the Qt main thread to execute.
148-
void set_source(const std::shared_ptr<VideoSourceDescriptor>& device);
148+
void set_source(
149+
const std::shared_ptr<VideoSourceDescriptor>& device,
150+
Resolution resolution = {}
151+
);
149152
// Change video resolution.
150153
// This will trigger a video source reset.
151154
// Change of resolution will be reflected on the internal referenced video

SerialPrograms/Source/CommonFramework/VideoPipeline/VideoSourceDescriptor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ void VideoSourceOption::load_json(const JsonValue& json){
8787
break;
8888
}
8989
m_resolution = Resolution(width, height);
90+
// cout << "VideoSourceOption::load_json(): " << this << " - " << width << " x " << height << endl;
9091
}while (false);
9192
}
9293

0 commit comments

Comments
 (0)