diff options
Diffstat (limited to 'src/GsrInfo.cpp')
-rw-r--r-- | src/GsrInfo.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/GsrInfo.cpp b/src/GsrInfo.cpp index 033757c..d7212d7 100644 --- a/src/GsrInfo.cpp +++ b/src/GsrInfo.cpp @@ -11,7 +11,7 @@ namespace gsr { } bool GsrVersion::operator>=(const GsrVersion &other) const { - return major >= other.major || (major == other.major && minor >= other.minor) || (major == other.major && minor == other.minor && patch >= other.patch); + return major > other.major || (major == other.major && minor > other.minor) || (major == other.major && minor == other.minor && patch >= other.patch); } bool GsrVersion::operator<(const GsrVersion &other) const { @@ -129,6 +129,8 @@ namespace gsr { gsr_info->gpu_info.vendor = GpuVendor::INTEL; else if(key_value->value == "nvidia") gsr_info->gpu_info.vendor = GpuVendor::NVIDIA; + else if(key_value->value == "broadcom") + gsr_info->gpu_info.vendor = GpuVendor::BROADCOM; } else if(key_value->key == "card_path") { gsr_info->gpu_info.card_path = key_value->value; } @@ -157,19 +159,22 @@ namespace gsr { gsr_info->supported_video_codecs.vp9 = true; } + static void parse_image_formats_line(GsrInfo *gsr_info, std::string_view line) { + if(line == "jpeg") + gsr_info->supported_image_formats.jpeg = true; + else if(line == "png") + gsr_info->supported_image_formats.png = true; + } + enum class GsrInfoSection { UNKNOWN, SYSTEM_INFO, GPU_INFO, VIDEO_CODECS, + IMAGE_FORMATS, CAPTURE_OPTIONS }; - static bool starts_with(std::string_view str, const char *substr) { - size_t len = strlen(substr); - return str.size() >= len && memcmp(str.data(), substr, len) == 0; - } - GsrInfoExitStatus get_gpu_screen_recorder_info(GsrInfo *gsr_info) { *gsr_info = GsrInfo{}; @@ -194,6 +199,8 @@ namespace gsr { section = GsrInfoSection::GPU_INFO; else if(section_name == "video_codecs") section = GsrInfoSection::VIDEO_CODECS; + else if(section_name == "image_formats") + section = GsrInfoSection::IMAGE_FORMATS; else if(section_name == "capture_options") section = GsrInfoSection::CAPTURE_OPTIONS; else @@ -217,6 +224,10 @@ namespace gsr { parse_video_codecs_line(gsr_info, line); break; } + case GsrInfoSection::IMAGE_FORMATS: { + parse_image_formats_line(gsr_info, line); + break; + } case GsrInfoSection::CAPTURE_OPTIONS: { // Intentionally ignore, get capture options with get_supported_capture_options instead break; @@ -244,7 +255,7 @@ namespace gsr { std::string stdout_str; const char *args[] = { "gpu-screen-recorder", "--list-audio-devices", nullptr }; - if(exec_program_get_stdout(args, stdout_str) != 0) { + if(exec_program_get_stdout(args, stdout_str, false) != 0) { fprintf(stderr, "error: 'gpu-screen-recorder --list-audio-devices' failed\n"); return audio_devices; } @@ -296,6 +307,8 @@ namespace gsr { static void parse_capture_options_line(SupportedCaptureOptions &capture_options, std::string_view line) { if(line == "window") capture_options.window = true; + else if(line == "region") + capture_options.region = true; else if(line == "focused") capture_options.focused = true; else if(line == "portal") @@ -309,10 +322,11 @@ namespace gsr { static const char* gpu_vendor_to_string(GpuVendor vendor) { switch(vendor) { - case GpuVendor::UNKNOWN: return "unknown"; - case GpuVendor::AMD: return "amd"; - case GpuVendor::INTEL: return "intel"; - case GpuVendor::NVIDIA: return "nvidia"; + case GpuVendor::UNKNOWN: return "unknown"; + case GpuVendor::AMD: return "amd"; + case GpuVendor::INTEL: return "intel"; + case GpuVendor::NVIDIA: return "nvidia"; + case GpuVendor::BROADCOM: return "broadcom"; } return "unknown"; } |