From 92a9150cc253fb3ce21228d5b5afb6a06d7054fd Mon Sep 17 00:00:00 2001 From: Julian Date: Wed, 27 Sep 2017 01:17:47 +0200 Subject: lua: integrate stats.lua script Signed-off-by: wm4 Rename --stats to --load-stats-overlay and add an entry to options.rst over the original commit. Signed-off-by: wm4 --- DOCS/man/options.rst | 5 +++++ options/m_option.h | 2 +- options/options.c | 2 ++ options/options.h | 1 + player/lua.c | 3 +++ player/scripting.c | 1 + wscript_build.py | 2 +- 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index bf097dab42..72176c7895 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -580,6 +580,11 @@ Program Behavior - ``--ytdl-raw-options=username=user,password=pass`` - ``--ytdl-raw-options=force-ipv6=`` +``--load-stats-overlay=`` + Enable the builtin script that shows useful playback information on a key + binding (default: yes). By default, the ``i`` key is used (``I`` to make + the overlay permanent). + ``--player-operation-mode=`` For enabling "pseudo GUI mode", which means that the defaults for some options are changed. This option should not normally be used directly, but diff --git a/options/m_option.h b/options/m_option.h index ad6dfe6698..ac10ed9dd2 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -400,7 +400,7 @@ struct m_option { #define UPDATE_TERM (1 << 7) // terminal options #define UPDATE_DEINT (1 << 8) // --deinterlace #define UPDATE_OSD (1 << 10) // related to OSD rendering -#define UPDATE_BUILTIN_SCRIPTS (1 << 11) // osc/ytdl +#define UPDATE_BUILTIN_SCRIPTS (1 << 11) // osc/ytdl/stats #define UPDATE_IMGPAR (1 << 12) // video image params overrides #define UPDATE_INPUT (1 << 13) // mostly --input-* options #define UPDATE_AUDIO (1 << 14) // --audio-channels etc. diff --git a/options/options.c b/options/options.c index eae58a45a4..a0aa4a89f8 100644 --- a/options/options.c +++ b/options/options.c @@ -304,6 +304,7 @@ const m_option_t mp_opts[] = { OPT_FLAG("ytdl", lua_load_ytdl, UPDATE_BUILTIN_SCRIPTS), OPT_STRING("ytdl-format", lua_ytdl_format, 0), OPT_KEYVALUELIST("ytdl-raw-options", lua_ytdl_raw_options, 0), + OPT_FLAG("load-stats-overlay", lua_load_stats, UPDATE_BUILTIN_SCRIPTS), #endif // ------------------------- stream options -------------------- @@ -871,6 +872,7 @@ const struct MPOpts mp_default_opts = { .lua_load_ytdl = 1, .lua_ytdl_format = NULL, .lua_ytdl_raw_options = NULL, + .lua_load_stats = 1, #endif .auto_load_scripts = 1, .loop_times = 1, diff --git a/options/options.h b/options/options.h index d2d0ea3cf9..3bb2a0a311 100644 --- a/options/options.h +++ b/options/options.h @@ -90,6 +90,7 @@ typedef struct MPOpts { int lua_load_ytdl; char *lua_ytdl_format; char **lua_ytdl_raw_options; + int lua_load_stats; int auto_load_scripts; diff --git a/player/lua.c b/player/lua.c index b3e4fe8317..cf754b661b 100644 --- a/player/lua.c +++ b/player/lua.c @@ -68,6 +68,9 @@ static const char * const builtin_lua_scripts[][2] = { }, {"@ytdl_hook.lua", # include "player/lua/ytdl_hook.inc" + }, + {"@stats.lua", +# include "player/lua/stats.inc" }, {0} }; diff --git a/player/scripting.c b/player/scripting.c index 5651950a42..4073da765d 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -220,6 +220,7 @@ void mp_load_builtin_scripts(struct MPContext *mpctx) { load_builtin_script(mpctx, mpctx->opts->lua_load_osc, "@osc.lua"); load_builtin_script(mpctx, mpctx->opts->lua_load_ytdl, "@ytdl_hook.lua"); + load_builtin_script(mpctx, mpctx->opts->lua_load_stats, "@stats.lua"); } void mp_load_scripts(struct MPContext *mpctx) diff --git a/wscript_build.py b/wscript_build.py index 1344b39a5e..cb66fbec40 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -100,7 +100,7 @@ def build(ctx): ) lua_files = ["defaults.lua", "assdraw.lua", "options.lua", "osc.lua", - "ytdl_hook.lua"] + "ytdl_hook.lua", "stats.lua"] for fn in lua_files: fn = "player/lua/" + fn -- cgit v1.2.3