1
mirror of https://github.com/mpv-player/mpv synced 2024-11-03 03:19:24 +01:00
Commit Graph

37467 Commits

Author SHA1 Message Date
wm4
9cc9d19eee common: add some helper macros 2014-03-07 12:47:07 +01:00
Diogo Franco
52428ece91 Merge pull request #619 from mpv-player/wasapi/better_timing
ao_wasapi: Add device latency to get_delay
2014-03-06 18:22:41 -02:00
Diogo Franco (Kovensky)
fe03981bbc ao_wasapi: Slightly improve timer accuracy
Use QueryPerformanceCounter to improve the accuracy of
IAudioClock::GetPosition.

While this is mainly for "realtime correctness" (usually the delay is a
single sample or less), there are cases where IAudioClock::GetPosition
takes a long time to return from its call (though the documentation doesn't
define what a "long time" is), so correcting its value might be important in
case the documented possible delay happens.
2014-03-06 17:21:34 -03:00
Diogo Franco (Kovensky)
1d096f9f1b ao_wasapi: Add device latency to get_delay
The lack of device latency made get_delay report latencies shorter than
they should; on systems with fast enough drivers, the delay is not
perceptible, but high enough invisible delays would cause desyncs.

I'm not yet completely sure whether this is 100% accurate, there are
some issues involved when repeatedly pausing+unpausing (the delay might
jump around by several dozen miliseconds), but seeking seems to be
working correctly now.
2014-03-06 17:21:33 -03:00
Alexander Preisinger
a9eae4276d wayland/shm: fix leak in buffer pool
Rename it to reinit and check if parts of the pool are already allocated.
2014-03-06 14:43:20 +01:00
wm4
d268d896d9 ao_jack: fix termination on the end of file
The player didn't quit when the end of a file was reached. The reason
for this is that jack reported a constant audio delay even when all
audio was done playing. Whether that was recognized as EOF by the player
depended whether the exact value was higher or lower than the player's
threshhold for what it considers no more audio.

get_delay() should return amount of time it takes until the last sample
written to the audio buffer reaches the speaker. Therefore, we have to
track the estimated time when the last sample is done, and subtract it
from the calculated latency. Basically, the latency is the only amount
of time left in the delay, and it should go towards 0 as audio reaches
ths speakers.

I'm not sure if this is correct, but at least it solves the problem. One
suspicious thing is that we use system time to estimate the end of the
audio time. Maybe using jack_frame_time() would be more correct. But
apart from this, there doesn't seem to be a better way to handle this.
2014-03-05 18:02:41 +01:00
wm4
5b3fd09908 build: update waf
<lachs0r> it fixes issues with recent python3
2014-03-04 12:08:40 +01:00
wm4
44fc61cec0 demux_lavf: fix typo in comment
Pushed too early...
2014-03-04 00:32:29 +01:00
wm4
5606cf2948 sub: use new FFmpeg API to check MicroDVD FPS
Before this, it wasn't possible to distinguish MicroDVD subtitles
without FPS header, and subtitles with FPS header equal to FFmpeg's
fallback FPS.
2014-03-04 00:28:10 +01:00
wm4
43e997ca07 player: reformat some code 2014-03-03 23:58:19 +01:00
wm4
59d9007e15 player: make separation between user/automatic track selection stronger
For example, consider the case when audio initialization fails. Then the
audio track is deselected. Before this commit, this would have been
equivalent to the user disabling audio. This is bad when multiple files
are played at once (the next file would have audio disabled, even if it
works), or if playback resume is used (if e.g. audio output failed to
initialize, then audio would be disabled when resuming, even if the
system's audio driver was fixed).
2014-03-03 23:53:12 +01:00
wm4
082b1cdeaa m_property: allow setting string properties via M_PROPERTY_SET_STRING
Setting string options to strings over the m_option fallback (i.e.
M_PROPERTY_SET_STRING is called if the option type is CONF_TYPE_STRING)
failed. This was because m_option_parse() returns 0. 0 still means
success, but the property code tried to be clever, and considered 0 not
a success in order to disallow setting flags to an emtpy string (which
in turn is allowed, because the command line allows flag options without
parameters).

Fix this by removing the overly clever code.

This could happen when e.g. using the "set" command on options/title (a
string option), and also was a problem for the client API.

Closes #610.
2014-03-03 12:48:41 +01:00
wm4
4bc0e3feac command: fix null pointer dereference in idle mode
Pressing 'h' in idle mode -> crash.
2014-03-02 22:39:20 +01:00
wm4
8f2ee917d4 player: cheap hack against idle event feedback loop
The OSC used significant CPU time while the player was paused. It turned
out that the "tick" event sent during pause is the problem. The OSC
accesses the player core when receiving a tick event, which in turn will
cause the core to send another tick event, leading to infinite feedback.

Fix this by sending an idle tick only every 500ms. This is not very
proper, but the idea behind the tick event isn't very clean to begin
with (and the OSC should use timers instead).
2014-03-01 21:29:13 +01:00
wm4
4de22d1cbc client API: fix playloop thread wakeup
The playloop usually waits in select(), using a timeout needed for
refilling audio and video buffers. This means the client API needs
a separate mechanism to interrupt the select() call. This mechanism
exists, but I forgot to use it. This commit fixes it.

If it works, this will make the client API react faster, epsecially
in audio-only mode. If video is enabled, the reaction time is capped
to 50ms (or somewhat faster if the framerate is >20 fps), because
the playloop stops reacting to anything in order to render and time
the next video frame. (This will be fixed later by moving the VO
to its own thread.)
2014-03-01 15:46:39 +01:00
wm4
b684ea55a5 vo_opengl: minor simplification
I think this is easier to follow.
2014-03-01 15:40:46 +01:00
Niklas Haas
d5b5ed0b46 vo_opengl: Include :icc-approx-gamma option in the 3DLUT cache header
This makes sure the ICC cache is recomputed when the :icc-approx-gamma
option is changed, since it affects the output quite a lot.
2014-03-01 02:28:46 +01:00
wm4
bcceeec737 sd_ass: add a very simple and evil way to override ASS subtitle styles
--ass-style-override=force now attempts to override the 'Default' style.
May or may not work. In some situations it will work, but also mess up
seemingly unrelated things like signs typeset with ASS.
2014-03-01 02:18:03 +01:00
wm4
32d18d77cd lua: set a proper chunk name for builtin modules
luaL_loadstring(), which was used until now, uses the start of the Lua
code itself as chunk name. Since the chunk name shows up even with
runtime errors triggered by e.g. Lua code loaded from user scripts, this
looks a but ugly. Switch to luaL_loadbuffer(), which is almost the same
as luaL_loadstring(), but allows setting a chunk name.
2014-03-01 00:50:59 +01:00
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