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

37414 Commits

Author SHA1 Message Date
wm4
a0b1d5f888 m_property: fix confused error code
This broke the client API.
2014-02-26 21:03:35 +01:00
wm4
8461143ed7 m_option: don't make "unset" string and string list return NULL strings
This is a bit weird: m_option_string types (i.e. char*) can be NULL. But
they're supposed to be treated just like empty strings. So don't make
the m_option_type.print function return NULL for these values. Returning
NULL would mean failure.

This didn't matter much before, but was quite visible through the client
API.
2014-02-26 21:03:35 +01:00
xylosper
c176f2be39 client API: fix broken property/option functions
1. Cannot set option after initialized: it seems that this bug has
   existed since libmpv was introduced first. Maybe just a typo.
2. Crash when setting property with native format: mpv_set_property
   just causes a crash when using a native format. I found an invalid
   casting and fixed it.
3. Wrong error value for mpv_get_property: when an error occurred,
   mpv_get_property always returns wrong format error because every
   error for property except M_PROPERTY_NOT_IMPLEMENTED is just ignored.

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

Closes pull request #593. Does not incldue the first fix, which was not
correct. The underlying bug will be fixed by a later commit.

Commit message extracted from pull request and slightly edited.
2014-02-26 21:01:54 +01:00
wm4
9a7a3d125b osd: override user bindings for OSC input
E.g. binding MOUSE_BTN0 always used the user defined binding. While it
is ok that the user can override mouse_move and mouse_leave (for
whatever reasons), we want to strictly override the bindings when input
is sent to the OSC itself.

Regression since 03624a1.
2014-02-26 00:59:19 +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
008fe558dc config: when writing resume config, read options, not properties
This lowers the number of data stored in the resume config a bit
further, because some properties can't be read at program start and when
e.g. the VO wasn't created yet.

Some fields still need to be read from a property (actually only
"volume-restore-data", a hack to save the full volume information). So
abuse the "options/" property, and make use of the fact that changing
things at runtime also changes the options.
2014-02-25 22:51:55 +01:00
wm4
67f244c6d4 config: don't save options to resume-config that didn't change
This is approximate: we read each option value on program start
(before starting playback of a file), and when writing the resume
config, compare each value to the current state. This also means
when a value is changed and then changed back, it's not stored. In
particular, option values set in config files and on the command
line are considered the default.

This should help reducing the numbers of options overridden by the
resume config. If too much is overridden, it becomes an inconvenience,
because changes in config files will apparently have no effect when
resuming a file.

Also see github issue #574.
2014-02-25 22:34:32 +01:00
wm4
70ff543029 input: allow input.conf bindings to be declared as builtin
This might be helpful if we ever want cascading config files. Also, we
will probably need it if we change the default input.conf bindings, and
want to provide compatibility input.conf files.
2014-02-25 22:09:20 +01:00
wm4
a85ff44511 config: always print resolved config paths in verbose mode
Restructure the code to make that easier. There should be no functional
changes, other than the log call at the end of each function.
2014-02-25 21:19:18 +01:00
wm4
0ee4e06376 manpage: remove unused environment variable
We removed gettext (which was disabled by default) a while ago.
2014-02-25 21:04:26 +01:00
wm4
428ffb01cf config: add a --config-dir option to force config directory
Useful for slave-mode like uses, and not as radical as --no-config.
2014-02-25 21:04:04 +01:00
wm4
2ea614ada6 config: don't write default config file
This created an essentially empty config file. This is not really
needed and probably causes more trouble than it solves (such as
littering the home directory with crap), so get rid of it.
2014-02-25 20:36:31 +01:00
Niklas Haas
90b4923f4a
manpage: Improve wording on icc-approx-gamma
This version is clearer on its origin, prevalence and use case and
offers some advice to the user.
2014-02-25 17:23:46 +01:00
wm4
36bc6e04ea manpage: document the new loadfile argument
I forgot about this.
2014-02-25 00:00:46 +01:00
wm4
af6305b88a client api examples: set an option with MPV_FORMAT_FLAG 2014-02-24 23:02:50 +01:00
wm4
761975d47b command: fix loadfile command
This was broken by commit bb6b543812. Note that the original pull
request was fine, but it was broken by my own stupidity when I was
"improving" it.

The problem is that the new loadfile argument was not considered
optional anymore after my changes. The original pull request did handle
this by setting .defval to a dummy value, but I removed that part.

Fix it again by introducing a flag that designates that the parameter is
optional. (I didn't want to add it to m_option.h, because technically,
all options are optional, and it's not possible to have non-optional
options.)
2014-02-24 23:02:20 +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
0797babbfa lua, osc: use properties for chapter/track lists 2014-02-24 22:50:24 +01:00
wm4
4d1575173b command: make options property return the list of all options 2014-02-24 22:50:24 +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
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