0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
Commit Graph

25 Commits

Author SHA1 Message Date
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
4e5cea86c2 client API: add mpv_get_wakeup_pipe convenience function
Should make integreating with some event loops easier. Untested.
2014-04-12 20:13:07 +02:00
wm4
86094c2c5a client API: include the reason in MPV_EVENT_END_FILE
Otherwise, the client API user could not know why playback was stopped.

Regarding the fact that 0 is used both for normal EOF and EOF on error:
this is because mplayer traditionally did not distinguish these, and in
general it's hard to tell the real reason. (There are various weird
corner cases which make it hard.)
2014-04-11 01:23:32 +02:00
wm4
fa35079361 client API: remove outdated comments 2014-04-11 00:12:35 +02:00
wm4
f0c8c26e29 client API: improve comments 2014-04-10 23:53:42 +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
49d1b42f70 client API: add a way to notify clients of property changes
This turned out ridiculously complex. I think it will have to be
simplified some day. Main reason for the complexity are:
- filtering properties by forcing clients to observe individual
  properties explicitly
  (to avoid spamming clients with changes they don't want)
- optional retrieval of property value with the notification
  (the basic idea was that this is more user friendly)
- allowing to the client to specify a format in which the value
  should be retrieved
  (because if a property changes its type, the client API couldn't
  convert it properly, and compatibility would break)

I don't know yet which of these are important, and everything could
change. In particular, the interface and semantics should be adjusted
to reduce the implementation complexity.

While I consider the API complete, there could (and probably will) be
bugs left. Also while the implementation is complete, it's inefficient.
The complexity of the property matching is O(a*b*c) with a clients,
b observed properties, and c properties changing at once. I threw away
an earlier implementation using bitmasks, because it was too unwieldy.
2014-04-06 03:22:49 +02:00
Alessandro Ghedini
dfc57e6d32 libmpv: add pkg-config file 2014-03-11 19:15:42 +01:00
xylosper
dd13e29cc2 client APIs: fix some typos 2014-02-28 20:54:47 +01:00
wm4
c30bf22d8d client API: rename MPV_EVENT_PLAYBACK_START, add MPV_EVENT_SEEK
Rename MPV_EVENT_PLAYBACK_START to MPV_EVENT_FILE_LOADED.

Add MPV_EVENT_SEEK and MPV_EVENT_PLAYBACK_RESTART.
2014-02-28 01:31:38 +01:00
wm4
f3c933e5d3 options: allow changing options at runtime
Allow changing all options at runtime, except some cherry-picked
options, which are disabled with M_OPT_FIXED.
2014-02-25 23:59:27 +01:00
wm4
279bd8db1f client API: change description of format conversions
This changed during the time between writing the comment, and finishing
up the implementation.

Although I'm still unsure about this.
2014-02-25 22:57:48 +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
5d7007c644 client API: expose the internal clock
May or may not be useful in some ways.

We require a context parameter for this just to be sure, even if the
internal implementation currently doesn't.

That's one less mpv internal function for the Lua wrapper.
2014-02-24 22:50:25 +01:00
wm4
38a36fd7ea client API: add comment about character encoding issues
Also mention that NULL isn't valid. Although I'm not sure whether the
implementation strictly follows this (it should, but there are some
wacky corner cases).
2014-02-24 22:50:24 +01:00
wm4
43ad09393c client API: add more data formats, add a structured data type
This adds declarations for new formats. The implementation will be added
in the following commits. (It still compiles and runs with this commit,
because it adds constants only.)

The obvious new types are MPV_FORMAT_FLAG, MPV_FORMAT_INT64,
MPV_FORMAT_DOUBLE. MPV_FORMAT_FLAG is a boolean, but to avoid nasty ABI
issues or with languages that don't have a bool data type (C89), it uses
int. Thus the format is not named MPV_FORMAT_BOOL, to avoid confusion.

The MPV_FORMAT_NONE type (mpv_node) is a generic structured type, like a
variant or, say, JSON. It can store strings/bools/numbers, as well as
arrays and key/value pairs (with string keys only).

The MPV_FORMAT_NODE_ARRAY and MPV_FORMAT_NODE_MAP types are used
internally by mpv_node only and can't be used with most of the other API
(like mpv_set_property()) directly.
2014-02-24 20:50:47 +01:00
wm4
1e27d130a2 client API: change semantics for MPV_FORMAT_STRING
With mpv_set_property(h, "property", MPV_FORMAT_STRING, ptr), ptr now
has to be of type char** instead of char*. This makes it more consistent
with mpv_get_property() and also non-pointer formats, which will be
introduced in the following commits. mpv_set_property() of course does
not change its interface (only its implementation is adjusted to keep
its interface).

This also affects mpv_set_option(), but again not
mpv_set_option_string().
2014-02-24 20:50:47 +01:00
wm4
1e30048184 client API: fix a typo 2014-02-24 20:48:59 +01:00
wm4
47aeb22b75 client API: remove trailing "," from enums
This is allowed in C99 and C++11, but apparently not in C89 and C++98.

Make it conform to the older standards, since we want the client API
header to be highly portable.
2014-02-24 20:48:59 +01:00
wm4
4123c2a708 client API: spelling 2014-02-24 20:48:55 +01:00
wm4
0ad2211508 client API: add event for metadata changes 2014-02-19 16:00:37 +01:00
wm4
5fcf4b46f7 client API: add events for video and audio reconfig 2014-02-17 02:52:59 +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
5af8070a97 client API: fix description of mpv_event.error field
The description was a left over from an earlier iteration of the API.
2014-02-12 22:00:13 +01:00
wm4
88ae914b1e Add a client API
Add a client API, which is intended to be a stable API to get some rough
control over the player. Basically, it reflects what can be done with
input.conf commands or the old slavemode. It will replace the old
slavemode (and enable the implementation of a new slave protocol).
2014-02-10 21:01:35 +01:00