Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 28fb4c22 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

MOD: Add a way not to force the X11 gpu context for libmpv

parent c0b29298
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!128Resolve "Add a way to not force the x11 display"
Pipeline #1960 réussi
...@@ -38,6 +38,7 @@ value("def_repeat", "false") ...@@ -38,6 +38,7 @@ value("def_repeat", "false")
value("font_size", "20") value("font_size", "20")
value("font_name", "Hack Nerd Font") value("font_name", "Hack Nerd Font")
value("msg_duration", "4") value("msg_duration", "4")
value_opt("force_x11", "1") /* Force libmpv to use x11, may segfault on some PCs... */
/* To place hooks, when some things are done in lektor. The default value 'none' is here so that /* To place hooks, when some things are done in lektor. The default value 'none' is here so that
nothing happens. Like any module, the value can point to a module or a function in the internal nothing happens. Like any module, the value can point to a module or a function in the internal
......
...@@ -29,27 +29,38 @@ lmpv_prepare(volatile sqlite3 *db) ...@@ -29,27 +29,38 @@ lmpv_prepare(volatile sqlite3 *db)
RETURN_UNLESS(ctx, "Failed to create context", NULL); RETURN_UNLESS(ctx, "Failed to create context", NULL);
char _opt[LKT_LINE_MAX]; char _opt[LKT_LINE_MAX];
#define MPV_SET_OPTION(opt, value) \ #define MPV_SET_OPTION(opt, value) \
if ((status = mpv_set_option_string(ctx, opt, value)) < 0) { \ if ((status = mpv_set_option_string(ctx, opt, value)) < 0) { \
LOG_ERROR("WINDOW", "Failed to set %s to %s: %s", \ LOG_ERROR("WINDOW", "Failed to set %s to %s: %s", \
opt, value, mpv_error_string(status)); \ opt, value, mpv_error_string(status)); \
return NULL; \ return NULL; \
} }
#define MPV_SET_FROM_INI(opt, section, key) \ #define MPV_SET_FROM_INI(opt, section, key) \
if (!database_config_get_text(db, section, key, _opt, LKT_LINE_MAX)) { \ if (!database_config_get_text(db, section, key, _opt, LKT_LINE_MAX)) { \
LOG_WARN("WINDOW", "Failed to get option " \ LOG_WARN("WINDOW", "Failed to get option " \
key " in section " section); \ key " in section " section); \
return ctx; \ return ctx; \
} \ } \
MPV_SET_OPTION(opt, _opt); MPV_SET_OPTION(opt, _opt);
#define MPV_SET_OPTION_COND(opt, value, ini_section, ini_option, def) ({ \
int ___cond; \
if (!database_config_get_int(db, ini_section, ini_option, &___cond)) { \
LOG_WARN("WINDOW", "Using default value '" #def "' because [" \
#ini_section "->" #ini_option "] was not present in ini " \
"config file"); \
___cond = (def); \
} \
if (___cond) \
MPV_SET_OPTION(opt, value); \
})
MPV_SET_OPTION("input-default-bindings", "yes"); MPV_SET_OPTION("input-default-bindings", "yes");
MPV_SET_OPTION("input-vo-keyboard", "yes"); MPV_SET_OPTION("input-vo-keyboard", "yes");
MPV_SET_OPTION("replaygain", "track"); MPV_SET_OPTION("replaygain", "track");
MPV_SET_OPTION("gpu-context", "x11"); /* Wayland you sucks */
MPV_SET_OPTION("demuxer-readahead-secs", "5.0"); MPV_SET_OPTION("demuxer-readahead-secs", "5.0");
MPV_SET_OPTION("demuxer-max-bytes", "100M"); MPV_SET_OPTION("demuxer-max-bytes", "100M");
MPV_SET_OPTION("hwdec", "yes"); MPV_SET_OPTION("hwdec", "yes");
MPV_SET_OPTION_COND("gpu-context", "x11", "player", "force_x11", 1); /* Wayland you sucks */
MPV_SET_FROM_INI("osd-font-size", "player", "font_size"); MPV_SET_FROM_INI("osd-font-size", "player", "font_size");
MPV_SET_FROM_INI("osd-font", "player", "font_name"); MPV_SET_FROM_INI("osd-font", "player", "font_name");
MPV_SET_FROM_INI("osd-duration", "player", "msg_duration"); MPV_SET_FROM_INI("osd-duration", "player", "msg_duration");
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter