mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
obs-ffmpeg: Fix Ubuntu 20.04 detection
This commit is contained in:
@@ -242,43 +242,19 @@ static void do_nvenc_check_for_ubuntu_20_04(void)
|
||||
FILE *fp;
|
||||
char *line = NULL;
|
||||
size_t linecap = 0;
|
||||
struct dstr distro;
|
||||
struct dstr version;
|
||||
|
||||
fp = fopen("/etc/os-release", "r");
|
||||
if (!fp) {
|
||||
return;
|
||||
}
|
||||
|
||||
dstr_init_copy(&distro, "Unknown");
|
||||
dstr_init_copy(&version, "Unknown");
|
||||
|
||||
while (getline(&line, &linecap, fp) != -1) {
|
||||
if (!strncmp(line, "NAME", 4)) {
|
||||
char *start = strchr(line, '=');
|
||||
if (!start || *(++start) == '\0')
|
||||
continue;
|
||||
dstr_copy(&distro, start);
|
||||
dstr_resize(&distro, distro.len - 1);
|
||||
if (strncmp(line, "VERSION_CODENAME=focal", 22) == 0) {
|
||||
ubuntu_20_04_nvenc_fallback = true;
|
||||
}
|
||||
|
||||
if (!strncmp(line, "VERSION_ID", 10)) {
|
||||
char *start = strchr(line, '=');
|
||||
if (!start || *(++start) == '\0')
|
||||
continue;
|
||||
dstr_copy(&version, start);
|
||||
dstr_resize(&version, version.len - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (dstr_cmpi(&distro, "ubuntu") == 0 &&
|
||||
dstr_cmp(&version, "20.04") == 0) {
|
||||
ubuntu_20_04_nvenc_fallback = true;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
dstr_free(&version);
|
||||
dstr_free(&distro);
|
||||
free(line);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user