ACMX 2.139.0
Dual-Backend Real-Time GPU Video Synthesis
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1#ifndef SETTINGS_HPP
2#define SETTINGS_HPP
3
4#include "backend.hpp"
5
6/**
7 * @file settings.hpp
8 * @brief Main capture/playback settings dialog for ACMX2 execution.
9 */
10
11#include <QCheckBox>
12#include <QComboBox>
13#include <QDialog>
14#include <QDoubleSpinBox>
15#include <QFileDialog>
16#include <QGroupBox>
17#include <QHBoxLayout>
18#include <QLabel>
19#include <QLineEdit>
20#include <QMap>
21#include <QPushButton>
22#include <QRadioButton>
23#include <QSet>
24#include <QSpinBox>
25#include <QVBoxLayout>
26
27class QScrollArea;
28
29/**
30 * @brief Dialog that collects camera, input source, output, and runtime options.
31 */
32class SettingsWindow : public QDialog {
33 Q_OBJECT
34 public:
35 /// @brief Construct the settings dialog.
36 /// @param execPath Path to the selected backend used for capability discovery.
37 /// @param backend Active rendering backend, used to expose compatible options.
38 /// @param parent Parent widget.
39 explicit SettingsWindow(const QString &execPath, acmx2::Backend backend, QWidget *parent = nullptr);
40 /// @brief Show or hide CUDA-specific controls based on availability.
41 /// @param available True when CUDA runtime/device support is available.
42 void setCudaAvailable(bool available);
43 /// @brief Enable or disable ONNX controls based on OpenCV DNN support.
44 /// @param available True when OpenCV DNN support is compiled in.
45 void setDnnAvailable(bool available);
46 /// @return Selected camera device index.
47 int getSelectedCameraIndex() const;
48 /// @return Selected input camera resolution.
49 QSize getSelectedCameraResolution() const;
50 /// @return Selected output screen resolution.
51 QSize getSelectedScreenResolution() const;
52 /// @return Selected camera capture FPS.
53 int getCameraFPS() const;
54 /// @return Input video file path.
55 QString getInputVideoFile() const;
56 /// @return Output video file path.
57 QString getOutputVideoFile() const;
58 /// @return Graphics/video overlay file path.
59 QString getGraphicsFile() const;
60 /// @return True if input-video mode is selected.
61 bool isUsingInputVideoFile() const;
62 /// @return True if graphics-file mode is selected.
63 bool isUsingGraphicsFile() const;
64 /// @return True if save-to-file is enabled.
65 bool isSavingToOutputVideoFile() const;
66 /// @return True when the video render log should be saved beside its output file.
67 bool isSavingOutputLog() const;
68 /// @return True if HDR was detected in the currently selected input video.
69 bool isInputHdrDetected() const;
70 /// @return True if the user enabled the post-process HDR10 conversion.
71 bool isConvertToHdr10Enabled() const;
72 /// @return True if texture cache is enabled.
73 bool isTextureCacheEnabled() const;
74 /// @return Frame delay used by texture cache.
75 int getCacheDelay() const;
76 /// @return Ring buffer size for texture cache.
77 int getCacheSize() const;
78 /// @return True if fullscreen mode is enabled.
79 bool isFullscreen() const;
80 /// @return True if ACMXVK should render camera input at the selected FPS.
81 bool isMaximizeFpsEnabled() const;
82 /// @return True if ACMXVK should pace video using its reported frame rate.
83 bool isUseSourceFpsEnabled() const;
84 /// @return True if ACMXVK should use video audio for shader reactivity.
85 bool isUseSourceAudioEnabled() const;
86 /// @return True if input audio should be copied to output.
87 bool isCopyAudioEnabled() const;
88 /// @brief Return whether Write PNG mode is enabled.
89 bool isPngOutputEnabled() const;
90 /// @brief Return the directory used for ACMXVK PNG-sequence output.
91 QString getPngOutputDirectory() const;
92 /// @brief Return the selected ACMXVK PNG compression level.
93 int getPngLevel() const;
94 /// @return True if --generate &lt;N&gt; mode is enabled.
95 bool isGenerateEnabled() const;
96 /// @return Frame interval to pass with --generate.
97 int getGenerateInterval() const;
98 /// @return True if 3D rendering mode is enabled.
99 bool is3dEnabled() const;
100 /// @return True if YUV mode is enabled for selected resolution.
101 bool isUseYuvEnabled() const;
102 /// @return Selected 3D model file path.
103 QString getModelFile() const;
104 /// @return True if the ONNX model pass is enabled.
105 bool isOnnxModelEnabled() const;
106 /// @return Selected ONNX model YAML config path.
107 QString getOnnxModelFile() const;
108 /// @return Selected CUDA device index.
109 int getSelectedCudaDevice() const;
110 /// @return Time speed multiplier applied at runtime.
111 float getTimeSpeed() const;
112 /// @brief Return whether maximum duration limiting is enabled.
113 bool isDurationLimitEnabled() const;
114 /// @brief Return configured max run duration in seconds.
115 double getDurationLimit() const;
116 /// @brief Return whether maximum output-size limiting is enabled.
117 bool isMaxSizeLimitEnabled() const;
118 /// @brief Return configured maximum output size in MB.
119 double getMaxSizeLimit() const;
120 /// @brief Return crossfade duration between shader transitions.
121 float getCrossFadeDuration() const;
122 /// @brief Return whether flip mode is enabled.
123 bool isFlipEnabled() const;
124 /// @brief Return whether input-frame rotation is enabled.
125 bool is_rotate_enabled() const;
126 /// @brief Return the selected rotation token for --rotate.
127 QString get_rotation_mode() const;
128 /// @brief Resolve display name for a camera device index.
129 /// @param device_index Camera device index.
130 /// @return Human-readable camera name.
131 QString getCameraName(int device_index);
132
133 /// @return Selected software or NVENC encoder preset name.
134 QString getEncodePreset() const;
135 /// @return Selected encoder tune (empty for "none").
136 QString getEncodeTune() const;
137 /// @return Selected encoder CRF value (0..51).
138 int getEncodeCrf() const;
139 /// @return Encoding rate-control mode: quality or bitrate.
140 QString getEncodeRateControl() const;
141 /// @return Target video bitrate text, such as 10M.
142 QString getEncodeBitrate() const;
143 /// @return Selected encoder codec preference (auto/software/nvenc).
144 QString getEncodeCodec() const;
145 /// @return Additional FFmpeg-style video encoder parameters.
146 QString getEncodeParameters() const;
147 /// @return True if realtime low-latency encoding is enabled.
148 bool isEncodeRealtime() const;
149 /// @return True if no-drop encoder backpressure mode is enabled.
150 bool isEncodeNoDrop() const;
151 /// @return True if sequential constant-frame-rate encoding is enabled.
152 bool isEncodeConstantFrameRate() const;
153 /// @return True if source PTS gaps should be filled with held frames.
154 bool isEncodeFillPtsGaps() const;
155 private slots:
156 void acceptSettings();
157 void rejectSettings();
161 void browseGraphicsFile();
162 void browseModelFile();
163 void browseOnnxModelFile();
164 /// @brief Display the AVOptions reported by the selected FFmpeg encoder.
165 void showEncoderOptions();
166 /// @brief Probe the currently selected input video file with ffprobe and
167 /// update HDR-related UI state (status label, HDR10 checkbox).
168 void detectInputHdr();
169 /// @brief React to camera-device combo selection changes.
170 /// @param comboIndex Selected combo-box index.
171 void onCameraDeviceChanged(int comboIndex);
172 /// @brief React to camera-resolution selection changes.
173 /// @param comboIndex Selected combo-box index.
174 void onCameraResolutionChanged(int comboIndex);
175
176 private:
177 void init();
178 void loadUiState();
179 void saveUiState();
181 void populateCudaDevices();
182 /// @brief Populate exact encoder names by querying the selected backend executable.
183 void populateVideoEncoders(const QString &savedEncoder);
184 /// @brief Refresh the selected encoder description and option-button state.
186 /// @brief Query resolutions and FPS capabilities for one camera device.
187 /// @param deviceIndex Camera device index to inspect.
188 void enumerateDevice(int deviceIndex);
189 void populateResolutions();
190 void populateFPS();
191
195 // resolution -> list of FPS values
196 QMap<QString, QList<double>> deviceCapabilities;
197 QSet<QString> yuvResolutions;
198
202 QPushButton *okButton;
203 QPushButton *cancelButton;
206 QLabel *hdrStatusLabel = nullptr;
207 QCheckBox *convertHdr10CheckBox = nullptr;
210 QLineEdit *pngOutputDirectoryLineEdit = nullptr;
211 QPushButton *browsePngOutputDirectoryButton = nullptr;
218 QCheckBox *saveOutputLogCheckBox = nullptr;
223 QCheckBox *maximizeFpsCheckBox = nullptr;
224 QCheckBox *useSourceFpsCheckBox = nullptr;
225 QCheckBox *useSourceAudioCheckBox = nullptr;
228 QCheckBox *useYuvCheckBox;
230 QPushButton *browseModelButton;
231 QLabel *onnxModelLabel = nullptr;
236 QLabel *cudaDeviceLabel = nullptr;
237 QDoubleSpinBox *timeSpeedSpinBox;
239 QDoubleSpinBox *durationLimitSpinBox;
241 QDoubleSpinBox *maxSizeLimitSpinBox;
242 QDoubleSpinBox *crossFadeSpinBox;
243 QCheckBox *flipCheckBox;
246
247 QComboBox *encodePresetComboBox = nullptr;
248 QComboBox *encodeTuneComboBox = nullptr;
249 QSpinBox *encodeCrfSpinBox = nullptr;
250 QComboBox *encodeRateControlComboBox = nullptr;
251 QLineEdit *encodeBitrateLineEdit = nullptr;
252 QComboBox *encodeCodecComboBox = nullptr;
253 QLabel *encodeCodecDetailsLabel = nullptr;
254 QPushButton *encodeOptionsButton = nullptr;
255 QLineEdit *encodeParametersLineEdit = nullptr;
256 QCheckBox *encodeRealtimeCheckBox = nullptr;
257 QCheckBox *encodeNoDropCheckBox = nullptr;
259 QCheckBox *encodeFillPtsGapsCheckBox = nullptr;
260 QCheckBox *writePngCheckBox = nullptr;
261 QComboBox *pngLevelComboBox = nullptr;
262 QCheckBox *generateCheckBox = nullptr;
263 QSpinBox *generateIntervalSpinBox = nullptr;
264 QScrollArea *settingsScrollArea = nullptr;
265 QWidget *settingsContent = nullptr;
266
267 // Responsive layout: groups are reflowed between 1 and 2 columns
268 // depending on the dialog width when the user resizes the window.
269 QHBoxLayout *groupsRow = nullptr;
270 QVBoxLayout *leftColumn = nullptr;
271 QVBoxLayout *rightColumn = nullptr;
272 QList<QGroupBox *> reflowGroups;
274 void reflowGroupColumns(int columns);
275
276 protected:
277 void resizeEvent(QResizeEvent *event) override;
278
279 private:
290 bool saveOutputLog = false;
293 QString modelFile;
295 bool dnnAvailable = true;
299 bool inputHdrDetected = false;
300 QString preferredFpsText = "30";
301};
302
303#endif
bool saveOutputVideoFile
Definition settings.hpp:289
bool isSavingOutputLog() const
QLineEdit * outputVideoFileLineEdit
Definition settings.hpp:208
QCheckBox * textureCacheCheckBox
Definition settings.hpp:219
bool isGenerateEnabled() const
bool isDurationLimitEnabled() const
Return whether maximum duration limiting is enabled.
QPushButton * browseOutputVideoButton
Definition settings.hpp:209
QLabel * onnxModelLabel
Definition settings.hpp:231
bool isInputHdrDetected() const
QComboBox * cameraIndexComboBox
Definition settings.hpp:199
bool isCopyAudioEnabled() const
QPushButton * cancelButton
Definition settings.hpp:203
int getSelectedCameraIndex() const
QString executablePath
Definition settings.hpp:192
void browseInputVideoFile()
QLineEdit * encodeBitrateLineEdit
Definition settings.hpp:251
bool isSavingToOutputVideoFile() const
QDoubleSpinBox * maxSizeLimitSpinBox
Definition settings.hpp:241
void reflowGroupColumns(int columns)
bool isEncodeNoDrop() const
double maxSizeLimit
Definition settings.hpp:298
void rejectSettings()
QLabel * cudaDeviceLabel
Definition settings.hpp:236
void acceptSettings()
QSize getSelectedScreenResolution() const
QComboBox * screenResolutionComboBox
Definition settings.hpp:201
QString getEncodeRateControl() const
QDoubleSpinBox * timeSpeedSpinBox
Definition settings.hpp:237
QWidget * settingsContent
Definition settings.hpp:265
QLineEdit * graphicsFileLineEdit
Definition settings.hpp:212
void browseModelFile()
QSpinBox * cacheSizeSpinBox
Definition settings.hpp:221
QMap< QString, QList< double > > deviceCapabilities
Definition settings.hpp:196
bool is_rotate_enabled() const
Return whether input-frame rotation is enabled.
QComboBox * encodeCodecComboBox
Definition settings.hpp:252
QString inputVideoFile
Definition settings.hpp:284
QVBoxLayout * rightColumn
Definition settings.hpp:271
QCheckBox * encodeRealtimeCheckBox
Definition settings.hpp:256
QCheckBox * useOnnxModelCheckBox
Definition settings.hpp:232
QLineEdit * onnxModelFileLineEdit
Definition settings.hpp:233
QString getEncodeParameters() const
bool isTextureCacheEnabled() const
QPushButton * browsePngOutputDirectoryButton
Definition settings.hpp:211
bool isEncodeConstantFrameRate() const
QPushButton * browseGraphicsButton
Definition settings.hpp:213
float getTimeSpeed() const
double getMaxSizeLimit() const
Return configured maximum output size in MB.
void onCameraResolutionChanged(int comboIndex)
React to camera-resolution selection changes.
QLineEdit * modelFileLineEdit
Definition settings.hpp:229
QCheckBox * maximizeFpsCheckBox
Definition settings.hpp:223
QSpinBox * encodeCrfSpinBox
Definition settings.hpp:249
bool isPngOutputEnabled() const
Return whether Write PNG mode is enabled.
void browseOnnxModelFile()
QString getModelFile() const
QCheckBox * saveOutputLogCheckBox
Definition settings.hpp:218
QSize selectedScreenResolution
Definition settings.hpp:282
QString getOutputVideoFile() const
void browsePngOutputDirectory()
QSet< QString > yuvResolutions
Definition settings.hpp:197
QString getCameraName(int device_index)
Resolve display name for a camera device index.
void detectInputHdr()
Probe the currently selected input video file with ffprobe and update HDR-related UI state (status la...
QPushButton * browseOnnxModelButton
Definition settings.hpp:234
int getCacheSize() const
QHBoxLayout * groupsRow
Definition settings.hpp:269
QScrollArea * settingsScrollArea
Definition settings.hpp:264
QLineEdit * inputVideoFileLineEdit
Definition settings.hpp:204
QList< QGroupBox * > reflowGroups
Definition settings.hpp:272
QString getPngOutputDirectory() const
Return the directory used for ACMXVK PNG-sequence output.
QString getGraphicsFile() const
bool isUsingGraphicsFile() const
bool isEncodeFillPtsGaps() const
QString onnxModelFile
Definition settings.hpp:294
bool isConvertToHdr10Enabled() const
bool isUseSourceFpsEnabled() const
void populateVideoEncoders(const QString &savedEncoder)
Populate exact encoder names by querying the selected backend executable.
Definition settings.cpp:570
QCheckBox * encodeNoDropCheckBox
Definition settings.hpp:257
QCheckBox * encodeConstantFrameRateCheckBox
Definition settings.hpp:258
void resizeEvent(QResizeEvent *event) override
QComboBox * cameraFPSComboBox
Definition settings.hpp:194
QString getEncodeBitrate() const
QString graphicsFile
Definition settings.hpp:291
QLabel * encodeCodecDetailsLabel
Definition settings.hpp:253
QString outputVideoFile
Definition settings.hpp:285
QCheckBox * flipCheckBox
Definition settings.hpp:243
QCheckBox * generateCheckBox
Definition settings.hpp:262
QSize getSelectedCameraResolution() const
QString getInputVideoFile() const
QCheckBox * useYuvCheckBox
Definition settings.hpp:228
int getPngLevel() const
Return the selected ACMXVK PNG compression level.
acmx2::Backend activeBackend
Definition settings.hpp:193
QCheckBox * rotate_check_box
Definition settings.hpp:244
double maxDuration
Definition settings.hpp:297
int getEncodeCrf() const
QPushButton * browseInputVideoButton
Definition settings.hpp:205
bool isUseSourceAudioEnabled() const
SettingsWindow(const QString &execPath, acmx2::Backend backend, QWidget *parent=nullptr)
Construct the settings dialog.
Definition settings.cpp:476
QSize selectedCameraResolution
Definition settings.hpp:281
QRadioButton * cameraOptionRadioButton
Definition settings.hpp:214
bool isMaxSizeLimitEnabled() const
Return whether maximum output-size limiting is enabled.
QString get_rotation_mode() const
Return the selected rotation token for –rotate.
QPushButton * browseModelButton
Definition settings.hpp:230
bool useInputVideoFile
Definition settings.hpp:287
bool isOnnxModelEnabled() const
QComboBox * pngLevelComboBox
Definition settings.hpp:261
QRadioButton * graphicsFileOptionRadioButton
Definition settings.hpp:216
QComboBox * encodePresetComboBox
Definition settings.hpp:247
QComboBox * encodeRateControlComboBox
Definition settings.hpp:250
QCheckBox * useSourceFpsCheckBox
Definition settings.hpp:224
void browseGraphicsFile()
int getCameraFPS() const
QCheckBox * durationLimitCheckBox
Definition settings.hpp:238
void updateEncoderDetails()
Refresh the selected encoder description and option-button state.
Definition settings.cpp:624
void browseOutputVideoFile()
QDoubleSpinBox * durationLimitSpinBox
Definition settings.hpp:239
double getDurationLimit() const
Return configured max run duration in seconds.
QString preferredFpsText
Definition settings.hpp:300
bool isEncodeRealtime() const
bool isMaximizeFpsEnabled() const
QDoubleSpinBox * crossFadeSpinBox
Definition settings.hpp:242
QCheckBox * enable3dCheckBox
Definition settings.hpp:227
QComboBox * rotate_combo_box
Definition settings.hpp:245
float getCrossFadeDuration() const
Return crossfade duration between shader transitions.
void setCudaAvailable(bool available)
Show or hide CUDA-specific controls based on availability.
QString getEncodeCodec() const
void setDnnAvailable(bool available)
Enable or disable ONNX controls based on OpenCV DNN support.
bool isFlipEnabled() const
Return whether flip mode is enabled.
QCheckBox * saveOutputVideoCheckBox
Definition settings.hpp:217
int getSelectedCudaDevice() const
QCheckBox * maxSizeLimitCheckBox
Definition settings.hpp:240
void showEncoderOptions()
Display the AVOptions reported by the selected FFmpeg encoder.
Definition settings.cpp:644
void onCameraDeviceChanged(int comboIndex)
React to camera-device combo selection changes.
QSpinBox * generateIntervalSpinBox
Definition settings.hpp:263
bool is3dEnabled() const
QLabel * hdrStatusLabel
Definition settings.hpp:206
void populateResolutions()
QCheckBox * writePngCheckBox
Definition settings.hpp:260
QComboBox * encodeTuneComboBox
Definition settings.hpp:248
QPushButton * encodeOptionsButton
Definition settings.hpp:254
void populateCudaDevices()
Definition settings.cpp:535
QCheckBox * encodeFillPtsGapsCheckBox
Definition settings.hpp:259
QCheckBox * copyAudioCheckBox
Definition settings.hpp:226
int getGenerateInterval() const
QVBoxLayout * leftColumn
Definition settings.hpp:270
QString getOnnxModelFile() const
QLineEdit * encodeParametersLineEdit
Definition settings.hpp:255
QComboBox * cameraResolutionComboBox
Definition settings.hpp:200
void populateCameraDevices()
Definition settings.cpp:478
bool isUseYuvEnabled() const
bool inputHdrDetected
Definition settings.hpp:299
QCheckBox * useSourceAudioCheckBox
Definition settings.hpp:225
int getCacheDelay() const
QSpinBox * cacheDelaySpinBox
Definition settings.hpp:220
QLineEdit * pngOutputDirectoryLineEdit
Definition settings.hpp:210
int selectedCameraIndex
Definition settings.hpp:280
QString modelFile
Definition settings.hpp:293
QCheckBox * fullscreenCheckBox
Definition settings.hpp:222
QString getEncodeTune() const
QString getEncodePreset() const
bool isFullscreen() const
QComboBox * cudaDeviceComboBox
Definition settings.hpp:235
QString pngOutputDirectory
Definition settings.hpp:286
bool isUsingInputVideoFile() const
QRadioButton * inputVideoOptionRadioButton
Definition settings.hpp:215
QCheckBox * convertHdr10CheckBox
Definition settings.hpp:207
void enumerateDevice(int deviceIndex)
Query resolutions and FPS capabilities for one camera device.
QPushButton * okButton
Definition settings.hpp:202
Backend
Definition backend.hpp:8