Commit Graph

37548 Commits

Author SHA1 Message Date
wm4 d706f8181a lua: fix add_key_binding()
add_key_binding() didn't work, because it passed a flag that was
renamed. add_forced_key_binding() worked, but did the wrong thing.
2014-03-01 00:42:53 +01:00
wm4 6357c27ab6 lua: fix format string in luaL_error() 2014-03-01 00:40:22 +01:00
wm4 93065af3ed client API: fix timeout handling
(Again.)

Fixed Lua timers as well.
2014-03-01 00:38:17 +01:00
wm4 0ad267c1d5 lua: fix use of renamed function
Apparently this was overlooked when get_timer was renamed to get_time.
2014-03-01 00:37:57 +01:00
wm4 1f8a400ad7 timer: add utility function to get relative time 2014-02-28 23:18:52 +01:00
wm4 97409ec4e6 msg: add --msgtime option to add timestamps to each output message
Will be helpful to track down strange wait times and such issues, as
well when you have develop something timing related. (Then you may print
timestamps in your debug output, and the --msgtime timestamps will help
giving context.)
2014-02-28 22:45:34 +01:00
wm4 1e2d409fb4 lua: add option to disable auto-loading of lua scripts 2014-02-28 22:25:48 +01:00
wm4 47ede0f5e3 config: don't load global config files with --config-dir
This sidestepped the usual logic by hardcoding the path.
2014-02-28 21:32:04 +01:00
wm4 42299ed868 config: fix --config-dir logic for global config files
Global config files should be loaded only when --no-config is missing
_and_ --config-dir is not set.
2014-02-28 21:32:00 +01:00
wm4 3020490ab1 manpage: document properties added in previous commit 2014-02-28 20:57:54 +01:00
xylosper 70b6c163ff client API: add two properties, 'time-start' and 'seekable' 2014-02-28 20:54:58 +01:00
xylosper dd13e29cc2 client APIs: fix some typos 2014-02-28 20:54:47 +01:00
xylosper c6448d7a9b audio: add enum name for speaker id 2014-02-28 20:54:15 +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 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 1852555ca1 client API: wait for remaining asynchronous requests before terminating
Sending an asynchronous request and then calling mpv_destroy() would
crash the player when trying to send the reply to the removed client.
Fix this by waiting until all remaining replies have been sent.
2014-02-28 01:03:37 +01:00
wm4 6b2a929ca7 ao: document some functions 2014-02-28 00:56:10 +01:00
wm4 91404e8a19 DOCS: kill the rest of the old mplayer tech documentation
Not really useful anymore, other than confusing everyone.
2014-02-28 00:24:59 +01:00
wm4 14607f27ef command: use the step size for "add volume" commands
The step argument for "add volume <step>" was ignored until now. Fix it.

There is one problem: by defualt, "add volume" should use the value set
with --volstep. This value is 3 by default. Since the default volue for
the step argument is always 1 (and we don't really want to make the
generic code more complicated by introducing custom step sizes), we
simply multiply the step argument with --volstep to keep it compatible.

The --volstep option should probably be just removed in the future.
2014-02-27 01:07:46 +01:00
wm4 b4fb71634c command: format volume property as integer for OSD
The value range is 0-100, so fractional values don't make much sense.
But the underlying data type is probably float to avoid getting "stuck"
when doing small volume increments. So step this around and pretend it's
an integer just on display.
2014-02-27 00:57:41 +01:00
wm4 8a51a6b79c vo_opengl: change gamma suboption to take a value
The previous version of the gamma suboption was pretty useless. It could
be used to disable delayed gamma enabling, which is a mechanism to avoid
having to adjust gamma in the shader by default.

Repurpose the suboption and allow setting an exact gamma value with it.
You can already override gamma with the --gamma option as well as the
gamma input property, but these use a weird curve to create the
impression of a linear perceived brightness change when changing the
value. This suboption now allows setting an exact gamma value.
2014-02-27 00:53:41 +01:00
Niklas Haas 6119cf13be vo_opengl: Change the default icc-intent to relative colorimetric
This used to be absolute colorimetric, but relative colorimetric is a
saner default due to the arguments presented in issue #595.

A short summary: In general it doesn't affect much because our eyes
adapt to the white point either way, but if running in windowed mode it
would make the whites seem inconsistent/tinted. For fullscreen
projection it's also undesirable since it reduces the dynamic range
without much benefit (again, since our eyes adapt either way) and it
also breaks calibration against ambient lighting.

This shouldn't change much, since most profile types that aren't 3DLUTs
aren't capable of either of those transforms, and most displays are
calibrated against D65 (same as BT.709 source) either way.
2014-02-26 23:05:20 +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 1513493560 lua: mark table values returned by get_property_native with their type
Lua doesn't distinguish between arrays and maps on the language level;
there are just tables. Use metatables to mark these tables with their
actual types. In particular, it allows distinguishing empty arrays from
empty tables.
2014-02-26 22:32:57 +01:00
wm4 5eab4f43ec m_option: make converting mpv_node to string always fail 2014-02-26 22:30:18 +01:00
wm4 11ee72fe1b lua: implement mp.get_opt() in Lua
Will be more expensive if used very often, but it's probably ok.

Reduce the dependency of lua.c on MPContext a bit further.
2014-02-26 21:03:36 +01:00
wm4 25f086973f m_option: fix key/value list string conversion
Meh.
2014-02-26 21:03:35 +01:00
wm4 5bfe131340 client API: don't send MPV_EVENT_IDLE when not entering idle mode
For simplicity, this was sent before actually checking the idle
condition, which meant that we'd send it even of the idle loop is never
entered.
2014-02-26 21:03:35 +01:00
wm4 9ccbc03ab1 threads: fix wait time overflow check
When passing a very large timeout to mpthread_cond_timed_wait(), the
calculations could overflow, setting tv_sec to a negative value, and
making the pthread_cond_timed_wait() call return immediately. This
accidentally made Lua support poll and burn CPU for no reason.

The existing overflow check was ineffective on 32 bit systems. tv_sec is
usually a long, so adding INT_MAX to it will usually not overflow on 64
bit systems, but on 32 bit systems it's guaranteed to overflow. Simply
fix by clamping against a relatively high value. This will work until 1
week before the UNIX time wraps around in 32 bits.
2014-02-26 21:03:35 +01:00
wm4 412bb336ab client API: don't explode when destroying uninitialized mpv_handle 2014-02-26 21:03:35 +01:00
wm4 bd75766ef0 client API: accept NULL as mpv_destroy() argument 2014-02-26 21:03:35 +01:00
wm4 e749470018 options: fix --list-options output
This was a bit damaged by commit f3c933e5.
2014-02-26 21:03:35 +01:00
wm4 eca9210399 client API: treat MPV_FORMAT_STRING differently in mpv_set_property
Always map MPV_FORMAT_STRING to setting property value directly through
M_PROPERTY_SET_STRING, instead of trying to go through
M_PROPERTY_SET_NODE.

This treats a direct MPV_FORMAT_STRING query differently from a
MPV_FORMAT_STRING wrapped in a mpv_node. This was already the case in
mpv_get_property(). The reason for all this is that mpv_node is supposed
to be the exact type, while a direct MPV_FORMAT_STRING goes through all
possible conversions.

Not sure if these semantics are good.
2014-02-26 21:03:35 +01:00
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