Straighten logic when probing for encoders

This commit is contained in:
Yukino Song
2025-07-16 03:21:18 +08:00
parent 95c61a2b9e
commit 9753a996da

View File

@@ -323,7 +323,7 @@ int main(int argc, char *argv[]) {
if (video::probe_encoders()) {
#ifdef _WIN32
bool allow_probing = !video::allow_encoder_probing();
bool allow_probing = video::allow_encoder_probing();
bool probe_result = false;
// Create a temporary virtual display for encoder capability probing
if (proc::vDisplayDriverStatus == VDISPLAY::DRIVER_STATUS::OK) {
@@ -349,21 +349,18 @@ int main(int argc, char *argv[]) {
std::this_thread::sleep_for(500ms);
// Probe again anyways
probe_result = video::probe_encoders();
if (video::probe_encoders()) {
if (allow_probing) {
BOOST_LOG(error) << "Video failed to find working encoder: allow probing but failed"sv;
} else {
BOOST_LOG(error) << "Video failed to find working encoder even after attempted with a virtual display"sv;
}
}
VDISPLAY::removeVirtualDisplay(*probe_guid);
} else if (!allow_probing) {
BOOST_LOG(error) << "Video failed to find working encoder: probe failed and virtual display driver isn't initialized"sv;
}
// When probing still fails somehow
if (allow_probing && probe_result) {
if (allow_probing) {
BOOST_LOG(error) << "Video failed to find working encoder: allow probing but failed"sv;
} else {
BOOST_LOG(error) << "Video failed to find working encoder even after attempted with a virtual display"sv;
}
}
#else
BOOST_LOG(error) << "Video failed to find working encoder: probing failed."sv;
#endif