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

37392 Commits

Author SHA1 Message Date
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
942fb43d0c client API: implement setting options using their native type too
This is only half-implemented: actually the option will first be
converted from mpv_node to its native type, then it's converted to a
string, and then back to its native type. This is because the option
API was made for strings and not anything else.

Other than being grossly inelegant, the only downside is probably with
string lists and key/value lists, which don't escape strings containing
syntax elements correctly.
2014-02-24 22:50:23 +01:00
wm4
a6ebfbea69 m_property: retrieve chapter lists etc. as mpv_node
This automatically allows accessing properties like chapter-list and
track-list to be read as mpv_node. This affects all properties which use
m_property_read_sub() and m_property_read_list().
2014-02-24 22:50:23 +01:00
wm4
62653605da client API: add support for accessing properties by their native type
This actually makes use of the client.h declarations and the mpv_node
mechanisms added some commits ago.

For now, using MPV_FORMAT_STRING will usually fallback to explicit
string conversion, but not in the other cases. E.g. reading a numeric
property as string will work, but not reading a string property as
number. Other than that, only MPV_FORMAT_INT64->MPV_FORMAT_DOUBLE does
an automatic conversion.

I'm not sure whether these semantics and API are good, so comments and
suggestions are welcome.
2014-02-24 22:50:23 +01:00
wm4
91f752f43f m_property: add mechanism to access properties as mpv_node
Allows retrieving properties by their native values (or something close
to it), rather than having to go through string conversion. The caller
could actually just copy the value itself and then use the m_option
functions to convert it to mpv_node, but maybe it's more flexible this
way.
2014-02-24 22:50:23 +01:00
wm4
e94bab5a99 m_option: add a way to convert values to/from mpv_node
m_option is basically the mechanism to handle C data types in a dynamic
way. Add functions to convert values to and from mpv_node. For example,
string lists are turned into mpv_node using MPV_FORMAT_NODE_ARRAY, and
so on.
2014-02-24 22:50:23 +01:00
wm4
74e0654733 client API: adjust error strings
These error codes can be used for setting and getting, not just for
settings (although currently there's no API to get options directly).
2014-02-24 20:51:05 +01:00
wm4
b097d76281 m_property: simplify some code 2014-02-24 20:51:05 +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
Andrey Morozov
d0e64dcc9b vdpau: change the error message when video too large 2014-02-24 17:59:52 +01:00
Niklas Haas
701c8c8254
vo_opengl: Add :icc-approx-gamma suboption to approximate BT.709 gamma
This uses the value of 1.95 as an approximation for the exact gamma
curve, which replicates the behavior of popular video software including
anything in the Apple ecosystem, as per issue #534.
2014-02-24 14:34:12 +01:00
wm4
e3f7d4f5ea m_option: fix printf format specifier 2014-02-24 12:00:56 +01:00
Nyx0uf
8f4bc16cd7 configure: fix typo
When using help, the output for --enable-shared was :
`--enable-shared     enable enable shared library [disable]`
2014-02-24 11:50:21 +01:00
wm4
40486fd8bd dvd: treat missing volume ID as "unsupported", not error
This is probably better and more consistent with the rest of the code,
although it doesn't change any currently existing behavior in this case.
2014-02-23 18:16:33 +01:00
wm4
f30149e80e cache: cache DVD volume ID
Since this might be queried every frame or so, it's important not to
stall the cache by doing a synchronous stream_control().
2014-02-23 18:16:33 +01:00
wm4
42e70868ab dvd: check for empty DVD volume ID
The only DVD sample I have just returns an empty string for this. Let
command.c use the filename if the ID is empty.
2014-02-23 18:16:33 +01:00
xylosper
5cbef87c17 command: use DVD volume ID for media-title property
Signed-off-by: wm4 <wm4@nowhere>

Closes #582.
2014-02-23 18:16:24 +01:00
wm4
8906e40925 example.conf: change subtitle codepage example to use UTF-8 fallback
This should be pretty safe compared to forcing the codepage.
2014-02-23 17:57:16 +01:00
Yaser Alraddadi
d364e09174 example.conf: subtitle encoding
Signed-off-by: wm4 <wm4@nowhere>

Closes #580.
2014-02-23 17:54:13 +01:00
xylosper
bb6b543812 command: provide per-file-options for loadfile command
Signed-off-by: wm4 <wm4@nowhere>

Closes #575. Minor changes over original pull request.
2014-02-23 17:49:34 +01:00
wm4
f5c781b0d5 command: remove special casing for strings in input commands
Until now, strings were the only allowed dynamically allocated argument
type in input commands. Extend it so that it works for any type. (The
string expansion in command.c is of course still string specific.)
2014-02-23 17:43:38 +01:00
wm4
b184c7d1e7 old build: add a missing config.h define
The configure check was added to waf only.
2014-02-23 17:41:58 +01:00
wm4
82648ff229 ta: fix comment
If this function could return the input value (i.e. the == case was
correct), then macros like MP_GROW_ARRAY would have been incorrect. The
implementation was correct though, so there's no bug.
2014-02-23 16:51:00 +01:00
wm4
7dae316d50 ta: clarify a corner case 2014-02-23 16:50:51 +01:00
wm4
ae2472f0ee manpage: fix a metadata property name 2014-02-23 16:49:59 +01:00
wm4
f225b5fc00 command: don't use option name in properties
Some code accessed m_option.name to get the property name. (Maybe only
show_property_osd() had a significant use of it.) Remove that, and
remove setting names and dummy names as well.

The old code usually assumed that the name was set, and
show_property_osd() used it to get the proper name of deprecated
aliases.

The "vf" property was listed as "vf*". Not sure why that was done, but
it works without anyway.
2014-02-23 16:49:47 +01:00
wm4
0d4ec7d665 manpage: fix yadif example in one case 2014-02-23 16:49:27 +01:00
wm4
c3c82f5c3b m_option: explicitly allow m_option.name==NULL
Doesn't require other code to care about this, which will allow us to
simplify the property code.

Only "wildcard" options like "vf" and string lists used this, and
m_option_list_findb() (which is excused).
2014-02-23 16:49:18 +01:00
wm4
641fdff65f lua: fix behavior if no script command handler is registered 2014-02-23 16:48:48 +01:00
wm4
98dc8206ae options: handle escape sequences in e.g. --playing-msg differently
M_OPT_PARSE_ESCAPES was pretty stupid, and broke the (useful) assumption
that string variables contain exactly the same value as set by the
option. Simplify it, and move escape handling to the place where it's
used.

Escape handling itself is not terribly useful, but still allows useful
things like multiline custom OSD with "\n".
2014-02-20 14:46:23 +01:00
wm4
857952dce3 input: check for abort cmd in multi-commands
MP_CMD_COMMAND_LIST commands (used to implement key bindings with
multiple commands) were not checked for abort commands. Implement it.

Remove the remarks about multi-commands being special from the manpage.
Seek coalescing is handled differently now, and the issue with abort
commands is fixed with this commit.
2014-02-20 13:40:32 +01:00
James Ross-Gowan
1d0730d22d input: ignore modifiers when releasing keys
This prevents keys from getting stuck if the modifier is released before
the base key.
2014-02-20 23:07:53 +11:00
Stefano Pigozzi
08170c6a67 build: syms: add support for Mach-O binaries
Current code stolen from waf's extras, only supported 'pe' and 'elf'. OS X
uses the 'Mach-O' binary format (which waf calls 'mac-o'... go figure).

Add support for generating the global symbols file with nm and using it from
clang.
2014-02-19 21:56:39 +01:00
wm4
f6ed246826 manpage: input: clarify chapter-metadata property 2014-02-19 16:32:54 +01:00
wm4
bda0e7da13 command: allow accessing metadata entries as list
Not sure about these deep path-names. Maybe "metadata/0" should work
instead of "metadata/list/0". I'm so unsure about it, that I'm leaving
it open.
2014-02-19 16:29:04 +01:00
wm4
844efa5431 command: move metadata entry access to metadata/by-key/
The old way still works, and is fine to use. Still discourage it,
because it might conflict with other ways to access this property, such
as the one added in the next commit.
2014-02-19 16:16:42 +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
57c9f5236a input, dvdnav: fix osc stealing input from dvdnav
This is a regression introduced from moving Lua scripts (including the
OSC) to their own threads. Now OSC and dvdnav can add their bindings at
the same time without coordination, which seems to result in the OSC
winning most time, and thus overriding the dvdnav menu bindings.

Fix this by adding a flag that makes dvdnav menu bindings take priority
over all other bindings.
2014-02-19 15:40:04 +01:00
wm4
8b57e4bc12 input: minor simplification for --input-test 2014-02-19 15:39:59 +01:00
wm4
5d7cf6e508 video: add rounding to aspect ratio calculations
Small errors are unavoidable, but truncation can cause anamorphic video
to be off by 1 or 2 pixels.
2014-02-19 15:37:47 +01:00
wm4
283139607c command: export list of editions as properties 2014-02-19 00:42:05 +01:00
wm4
dc0636102c command: export codec for each track 2014-02-19 00:42:05 +01:00
wm4
09d873d5d4 player: fix start time if timeline is used (ordered chapters, EDL)
When timeline was used, and the --start option was not used, the initial
seek (needed to switch to the first timeline segment) seeked to -1 due
to an oversight.
2014-02-19 00:41:34 +01:00
wm4
e6f543ebec edl: extend with chapter timestamps
Example see edl-mpv.rst.

What is this useful for? No clue...
2014-02-19 00:06:00 +01:00
wm4
d29661af8a edl: fix offset of user-visible chapters
Basically, chapter marks and chapter seek-points were incorrect, while
the rest worked.
2014-02-19 00:05:14 +01:00