lua: integrate stats.lua script

Signed-off-by: wm4 <wm4@nowhere>

Rename --stats to --load-stats-overlay and add an entry to options.rst
over the original commit.

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
Julian 2017-09-27 01:17:47 +02:00 committed by wm4
parent c38ad6ae6f
commit 92a9150cc2
7 changed files with 14 additions and 2 deletions

View File

@ -580,6 +580,11 @@ Program Behavior
- ``--ytdl-raw-options=username=user,password=pass``
- ``--ytdl-raw-options=force-ipv6=``
``--load-stats-overlay=<yes|no>``
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=<cplayer|pseudo-gui>``
For enabling "pseudo GUI mode", which means that the defaults for some
options are changed. This option should not normally be used directly, but

View File

@ -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.

View File

@ -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,

View File

@ -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;

View File

@ -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}
};

View File

@ -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)

View File

@ -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