2010-01-30 23:24:23 +00:00
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2010-01-30 23:24:23 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or modify
|
2010-01-30 23:24:23 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2010-01-30 23:24:23 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
2015-04-13 07:36:54 +00:00
|
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2010-01-30 23:24:23 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_COMMAND_H
|
|
|
|
#define MPLAYER_COMMAND_H
|
2008-01-01 21:35:58 +00:00
|
|
|
|
2008-03-31 04:10:54 +00:00
|
|
|
struct MPContext;
|
|
|
|
struct mp_cmd;
|
2013-12-21 18:36:33 +00:00
|
|
|
struct mp_log;
|
2015-04-20 21:00:12 +00:00
|
|
|
struct mpv_node;
|
2008-03-04 23:35:24 +00:00
|
|
|
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
void command_init(struct MPContext *mpctx);
|
2013-09-30 20:27:37 +00:00
|
|
|
void command_uninit(struct MPContext *mpctx);
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
|
2015-04-20 21:00:12 +00:00
|
|
|
int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *res);
|
2013-09-20 21:33:38 +00:00
|
|
|
char *mp_property_expand_string(struct MPContext *mpctx, const char *str);
|
2014-02-20 13:46:23 +00:00
|
|
|
char *mp_property_expand_escaped_string(struct MPContext *mpctx, const char *str);
|
2013-12-21 18:36:33 +00:00
|
|
|
void property_print_help(struct mp_log *log);
|
2012-09-21 10:19:59 +00:00
|
|
|
int mp_property_do(const char* name, int action, void* val,
|
|
|
|
struct MPContext *mpctx);
|
2008-01-01 21:35:58 +00:00
|
|
|
|
2014-02-10 20:01:35 +00:00
|
|
|
void mp_notify(struct MPContext *mpctx, int event, void *arg);
|
2014-06-01 01:41:36 +00:00
|
|
|
void mp_notify_property(struct MPContext *mpctx, const char *property);
|
Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).
This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.
One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-25 22:41:14 +00:00
|
|
|
|
2015-02-14 14:13:58 +00:00
|
|
|
void handle_command_updates(struct MPContext *mpctx);
|
|
|
|
|
2014-08-01 23:39:28 +00:00
|
|
|
int mp_get_property_id(const char *name);
|
|
|
|
uint64_t mp_get_property_event_mask(const char *name);
|
|
|
|
|
2014-11-02 19:26:51 +00:00
|
|
|
enum {
|
|
|
|
// Must start with the first unused positive value in enum mpv_event_id
|
|
|
|
// MPV_EVENT_* and MP_EVENT_* must not overlap.
|
2015-01-19 18:54:20 +00:00
|
|
|
INTERNAL_EVENT_BASE = 25,
|
2015-02-01 17:25:12 +00:00
|
|
|
MP_EVENT_CHANGE_ALL,
|
2014-11-02 19:26:51 +00:00
|
|
|
MP_EVENT_CACHE_UPDATE,
|
|
|
|
MP_EVENT_WIN_RESIZE,
|
2014-11-02 19:48:45 +00:00
|
|
|
MP_EVENT_WIN_STATE,
|
2014-11-02 19:26:51 +00:00
|
|
|
};
|
2014-07-31 02:19:41 +00:00
|
|
|
|
command: add a mechanism to allow scripts to intercept file loads
A vague idea to get something similar what libquvi did.
Undocumented because it might change a lot, or even be removed. To give
an idea what it does, a Lua script could do the following:
-- type ID priority
mp.commandv("hook_add", "on_load", 0, 0)
mp.register_script_message("hook_run", function(param, param2)
-- param is "0", the user-chosen ID from the hook_add command
-- param2 is the magic value that has to be passed to finish
-- the hook
mp.resume_all()
-- do something, maybe set options that are reset on end:
mp.set_property("file-local-options/name", "value")
-- or change the URL that's being opened:
local url = mp.get_property("stream-open-filename")
mp.set_property("stream-open-filename", url .. ".png")
-- let the player (or the next script) continue
mp.commandv("hook_ack", param2)
end)
2014-10-15 21:09:53 +00:00
|
|
|
bool mp_hook_test_completion(struct MPContext *mpctx, char *type);
|
|
|
|
void mp_hook_run(struct MPContext *mpctx, char *client, char *type);
|
|
|
|
|
2015-06-16 21:11:14 +00:00
|
|
|
void handle_ab_loop(struct MPContext *mpctx);
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_COMMAND_H */
|