OpenGL: change option key type to library

To avoid conflict with JSON config `type`
This commit is contained in:
Carter Li
2023-06-17 22:33:41 +08:00
parent a994d398d9
commit 4bde3afe8a
5 changed files with 33 additions and 31 deletions
+1 -1
View File
@@ -216,7 +216,7 @@
# Sets with opengl context creation library to use
# Must be either auto, egl, glx or osmesa
# Default is auto.
#--opengl-type auto
#--opengl-library auto
# GPU hide options
# Sets weather to hide certain gpu types
+5 -6
View File
@@ -115,14 +115,13 @@ Module specific options:
--bluetooth-show-disconnected: <?value>: Set if disconnected bluetooth devices should be printed. Default is false
--display-compact-type: <?string>: Set if all displays should be printed in one line. Default is none
--display-detect-name: <?value>: Set if display name should be detected and printed (if supported). Default is false
--display-precise-refresh-rate: <?value>:Set if decimal refresh rates should not be rounded into integers when printing
--display-precise-refresh-rate: <?value>:Set if decimal refresh rates should not be rounded into integers when printing. Default is true
--sound-type: <value>: Set what type of sound devices should be printed. Should be either main, active or all. Default is main
--battery-dir <folder>: The directory where the battery folders are. Standard: /sys/class/power_supply/
--cpu-temp <?value>: Detect and display CPU temperature if supported. Default is false
--gpu-temp <?value>: Detect and display GPU temperature if supported. Default is false
--gpu-force-vulkan <?value>: Force using vulkan to detect GPUs, which support video memory usage detection with `--allow-slow-operations`. Default is false
--gpu-hide-integrated <?value>: Hide integrated GPU if supported. Default is false
--gpu-hide-discrete <?value>: Hide discrete GPU if supported. Default is false
--gpu-hide-type <?value>: Specify the type of GPUs should not be printed. Must be `integrated`, `discrete` or `none`. Default is none
--battery-temp <?value>: Detect and display Battery temperature if supported. Default is false
--localip-show-ipv4 <?value>: Show IPv4 addresses in local ip module. Default is true
--localip-show-ipv6 <?value>: Show IPv6 addresses in local ip module. Default is false
@@ -135,10 +134,10 @@ Module specific options:
--weather-timeout: Time in milliseconds to wait for the weather server to respond. Default is disabled (0)
--weather-output-format: The output weather format to be used. It must be URI encoded.
--player-name: The name of the player to use
--opengl-type <value>: Set the OpenGL context creation library to use. Must be auto, egl, glx or osmesa. Default is auto
--opengl-library <value>: Set the OpenGL context creation library to use. Must be auto, egl, glx or osmesa. Default is auto
--command-shell <str>: Set the shell program to execute the command text. Default is cmd for Windows, csh for FreeBSD, bash for others
--command-key <str>: Set the module key to display, can be specified mulitple times
--command-text <str>: Set the command text to be executed, can be specified mulitple times
--command-key <str>: Set the module key to display
--command-text <str>: Set the command text to be executed
Parsing is not case sensitive. E.g. "--lib-PCI" is equal to "--Lib-Pci"
If a value starts with a ?, it is optional. "true" will be used if not set.
+3 -3
View File
@@ -318,7 +318,7 @@ const char* ffDetectOpenGL(FFinstance* instance, FFOpenGLResult* result)
{
#if FF_HAVE_GL
if(instance->config.openGL.type == FF_OPENGL_TYPE_GLX)
if(instance->config.openGL.library == FF_OPENGL_LIBRARY_GLX)
{
#ifdef FF_HAVE_GLX
return glxPrint(instance, result);
@@ -327,7 +327,7 @@ const char* ffDetectOpenGL(FFinstance* instance, FFOpenGLResult* result)
#endif
}
if(instance->config.openGL.type == FF_OPENGL_TYPE_EGL)
if(instance->config.openGL.library == FF_OPENGL_LIBRARY_EGL)
{
#ifdef FF_HAVE_EGL
return eglPrint(instance, result);
@@ -336,7 +336,7 @@ const char* ffDetectOpenGL(FFinstance* instance, FFOpenGLResult* result)
#endif
}
if(instance->config.openGL.type == FF_OPENGL_TYPE_OSMESA)
if(instance->config.openGL.library == FF_OPENGL_LIBRARY_OSMESA)
{
#ifdef FF_HAVE_OSMESA
return osMesaPrint(instance, result);
+17 -14
View File
@@ -47,7 +47,7 @@ void ffInitOpenGLOptions(FFOpenGLOptions* options)
ffOptionInitModuleArg(&options->moduleArgs);
#if defined(__linux__) || defined(__FreeBSD__)
options->type = FF_OPENGL_TYPE_AUTO;
options->library = FF_OPENGL_LIBRARY_AUTO;
#endif
}
@@ -59,13 +59,16 @@ bool ffParseOpenGLCommandOptions(FFOpenGLOptions* options, const char* key, cons
return true;
#if defined(__linux__) || defined(__FreeBSD__)
options->type = (FFOpenGLType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "auto", FF_OPENGL_TYPE_AUTO },
{ "egl", FF_OPENGL_TYPE_EGL },
{ "glx", FF_OPENGL_TYPE_GLX },
{ "osmesa", FF_OPENGL_TYPE_OSMESA },
{}
});
if (strcasecmp(key, "library") == 0)
{
options->library = (FFOpenGLLibrary) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "auto", FF_OPENGL_LIBRARY_AUTO },
{ "egl", FF_OPENGL_LIBRARY_EGL },
{ "glx", FF_OPENGL_LIBRARY_GLX },
{ "osmesa", FF_OPENGL_LIBRARY_OSMESA },
{}
});
}
#endif
return false;
@@ -95,20 +98,20 @@ void ffParseOpenGLJsonObject(FFinstance* instance, yyjson_val* module)
continue;
#if defined(__linux__) || defined(__FreeBSD__)
if (strcasecmp(key, "type") == 0)
if (strcasecmp(key, "library") == 0)
{
int value;
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
{ "auto", FF_OPENGL_TYPE_AUTO },
{ "egl", FF_OPENGL_TYPE_EGL },
{ "glx", FF_OPENGL_TYPE_GLX },
{ "osmesa", FF_OPENGL_TYPE_OSMESA },
{ "auto", FF_OPENGL_LIBRARY_AUTO },
{ "egl", FF_OPENGL_LIBRARY_EGL },
{ "glx", FF_OPENGL_LIBRARY_GLX },
{ "osmesa", FF_OPENGL_LIBRARY_OSMESA },
{},
});
if (error)
ffPrintError(instance, FF_OPENGL_MODULE_NAME, 0, &options.moduleArgs, "Invalid %s value: %s", key, error);
else
options.type = (FFOpenGLType) value;
options.library = (FFOpenGLLibrary) value;
continue;
}
#endif
+7 -7
View File
@@ -5,13 +5,13 @@
#include "common/option.h"
#if defined(__linux__) || defined(__FreeBSD__)
typedef enum FFOpenGLType
typedef enum FFOpenGLLibrary
{
FF_OPENGL_TYPE_AUTO,
FF_OPENGL_TYPE_EGL,
FF_OPENGL_TYPE_GLX,
FF_OPENGL_TYPE_OSMESA
} FFOpenGLType;
FF_OPENGL_LIBRARY_AUTO,
FF_OPENGL_LIBRARY_EGL,
FF_OPENGL_LIBRARY_GLX,
FF_OPENGL_LIBRARY_OSMESA
} FFOpenGLLibrary;
#endif
typedef struct FFOpenGLOptions
@@ -20,6 +20,6 @@ typedef struct FFOpenGLOptions
FFModuleArgs moduleArgs;
#if defined(__linux__) || defined(__FreeBSD__)
FFOpenGLType type;
FFOpenGLLibrary library;
#endif
} FFOpenGLOptions;