Commit Graph

46 Commits

Author SHA1 Message Date
ChrisK2 30fc1a42be osc: fix chapter list display
also fix small typo in DOCS
2014-05-24 17:47:31 +02:00
ChrisK2 ce69afab44 lua/osc: forgot some changed files in previous commit 2014-05-23 13:24:27 +02:00
wm4 f5be96a6e5 manpage: minor corrections 2014-05-11 15:42:12 +02:00
Martin Herkt 11eaa52529 options: rename msg-related options
--msgcolor    → --msg-color
--msglevel    → --msg-level
--msgmodule   → --msg-module
--msgtime     → --msg-time (also document this one)
--playing-msg → --term-playing-msg
--status-msg  → --term-status-msg
2014-05-04 02:46:11 +02:00
wm4 beaa7c7153 lua: remove "lua/" prefix from script names
This affects the return value of mp.script_name, the "client name"
(what's returned by mpv_client_name()) and all associated features, as
well as the mpv terminal output module prefix when scripts print
something.

As discussed in #748.
2014-05-02 01:25:58 +02:00
Kevin Mitchell 164cfeba56 man: grammar tweak of mp.add_timeout() 2014-04-29 08:31:44 -07:00
wm4 e8a996cede client API: add chapter change event
Also works for mpv_observe_property() on the "chapter" property.
2014-04-27 22:28:07 +02:00
wm4 196619671d client API: remove mpv_event_pause_reason
And slightly adjust the semantics of MPV_EVENT_PAUSE/MPV_EVENT_UNPAUSE.

The real pause state can now be queried with the "core-idle" property,
the user pause state with the "pause" property, whether the player is
paused due to cache with "paused-for-cache", and the keep open event can
be guessed with the "eof-reached" property.
2014-04-14 22:33:41 +02:00
wm4 76961843c3 manpage: lua: separate "advanced" functions into a separate section
This will be less confusing.
2014-04-12 20:44:13 +02:00
wm4 f3c0897b3f lua: make it easier to integrate with foreign event loops
We provide some "official" utility functions for this.
2014-04-12 20:41:12 +02:00
wm4 19abeaf62d lua: wrap mpv_get_wakeup_pipe()
Pretty much experimental for issue #661.
2014-04-12 20:13:53 +02:00
wm4 fb06e30b7b lua: add a minor helper function 2014-04-10 23:56:06 +02:00
wm4 89d400dc21 client API: avoid redundant property change events if possible
This is done simply by comparing the previous and current values. Do
this only if the requested format is not MPV_FORMAT_NONE.
2014-04-08 22:06:39 +02:00
wm4 a94020e25b lua: add API for observing property changes
A low level API was added already earlier, but that was merely a binding
for the raw C API. Add a "proper" one, and document it.
2014-04-08 21:10:00 +02:00
wm4 e3e9661a33 lua: give more control over timers
Now they can be paused and resumed.

Since pausing and disabling the timer is essentially the same underlying
operation, we also just provide one method for it.

mp.cancel_timer probably still works, but I'm considering this
deprecated, and it's removed from the manpage. (We didn't have a release
with this function yet, so no formal deprecation.)
2014-04-02 17:09:45 +02:00
wm4 3207366daa lua: add mp.unregister_event() function
Someone requested this... I think.
2014-04-01 00:37:50 +02:00
wm4 780f172a8a lua: rename mp.register_script_command() to mp.register_script_message()
More consistent naming.
2014-03-17 18:27:25 +01:00
wm4 637664d95a command, lua: change script_message semantics
Change script_message to broadcast the message to all clients. Add a new
script_message_to command, which does what the old script_message
command did.

This is intended as simplification, although it might lead to chaos too.
2014-03-17 18:26:56 +01:00
wm4 37ada157eb manpage: lua: fix typo 2014-02-28 20:53:15 +01:00
wm4 c49a8427d4 manpage: lua: update from previous commit
I forgot about this.
2014-02-28 02:04:33 +01:00
wm4 c1cb0dd7ee lua: add set_property_native function
Probably completely useless, at least for now.

Also not very well tested, but initial test seems successful.
2014-02-26 22:38:34 +01:00
wm4 0adb8a9aaf client API: report pause/unpause reason
Not sure about this... might redo.

At least this provides a case of a broadcasted event, which requires
per-event data allocation.

See github issue #576.
2014-02-24 22:50:25 +01:00
wm4 f628d5e859 lua: add a bunch of functions to get/set properties by their native type
There are some complications because the client API distinguishes
between integers and floats, while Lua has only "numbers" (which are
usually floats). But I think this should work now.
2014-02-24 22:50:24 +01:00
wm4 15fa120222 manpage: lua: improve explanation of tracks-changed and tracks-switched 2014-02-19 16:01:18 +01:00
wm4 0ad2211508 client API: add event for metadata changes 2014-02-19 16:00:37 +01:00
wm4 333d1045b7 manpage: lua: shorten description of register_script_command()
This is simply not important enough to warrant so much space, and it's
perhaps also very confusing.

Although I'm not fully sure, since this is about the only way that
allows a user to interact with a script, besides key bindings and static
options.
2014-02-17 20:30:44 +01:00
wm4 6d87f6f550 manpage: lua: attempt to improve add_key_binding() description 2014-02-17 20:30:44 +01:00
wm4 c79ea489bf manpage: lua: improve introduction, add simplistic example 2014-02-17 20:30:44 +01:00
wm4 ceca513e9d manpage: lua: fix typo 2014-02-17 20:30:44 +01:00
wm4 5fcf4b46f7 client API: add events for video and audio reconfig 2014-02-17 02:52:59 +01:00
wm4 24fa69dbfa lua: add mechanism for script provided key bindings
There was already an undocumented mechanism provided by
mp.set_key_bindings and other functions, but this was relatively
verbose, and also weird. It was mainly to make the OSC happy (including
being efficient and supporting weird corner cases), while the new
functions try to be a bit simpler.

This also provides a way to let users rebind script-provided commands.

(This mechanism is less efficient, because it's O(n^2) for n added key
bindings, but it shouldn't matter.)
2014-02-17 02:52:58 +01:00
wm4 75d3267b43 client API: add a client message event
This comes with a "script_message" input command, which sends these
messages. Used by the following commits.
2014-02-17 02:52:58 +01:00
wm4 5fd661b50e lua: allow giving fallback values in get_property() calls
E.g. ``mp.get_property("foo", "value")`` will return ``value`` if the
property can't be read.
2014-02-17 02:52:58 +01:00
wm4 414c4f9322 lua: make register_event() not overwrite previous event handler
Instead, chain them.

Note that there's no logic to prevent the other event handlers to be run
from an event handler (like it's popular in GUI toolkits), because I
think that's not very useful for this purpose.
2014-02-14 14:01:27 +01:00
wm4 69769860c2 manpage: lua: move less important events to the end of the list 2014-02-12 22:00:22 +01:00
wm4 b71d492555 manpage: lua: document receiving of terminal messages 2014-02-12 22:00:18 +01:00
wm4 c342dcf096 manpage: lua: rewrite event description
Using such a small table is not such a great idea, because you can't put
much information in it, even if you need to.
2014-02-12 22:00:13 +01:00
wm4 3abbe31d6b manpage: lua: minor fixes 2014-02-12 22:00:07 +01:00
wm4 157d470b31 manpage: fix Lua script shutdown description again
It was split at the wrong sentence.

Also, sneak in a reference to mp.suspend.
2014-02-11 17:41:14 +01:00
wm4 37a4e6b583 manpage: use Lua for Lua example 2014-02-11 15:22:02 +01:00
wm4 891f58e834 manpage: document mp.commandv Lua command 2014-02-11 01:25:26 +01:00
wm4 c776ac33e3 manpage: move description of script shutdown to a separate paragraph
No other changes, just adding a paragraph break and reflowing the text.
2014-02-11 01:25:15 +01:00
wm4 d473933923 manpage: fix formatting of example code 2014-02-11 01:14:08 +01:00
wm4 0ed6644ded manpage: document some Lua scripting functions 2014-02-11 01:05:05 +01:00
wm4 2da916f6df manpage: fix typo 2014-01-05 19:28:45 +01:00
wm4 6048f87e3c 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-26 01:28:58 +02:00