Commit Graph

43897 Commits

Author SHA1 Message Date
wm4 2d34171bec options: fix pseudo-options like -v
Some pseudo-options do not have associated storage, which made
m_config_set_option_raw() return failure.

Regression due to commit d1d5e9dd.
2016-09-17 20:34:00 +02:00
wm4 ffc9aa8104 manpage: document some more property/options inconsistencies 2016-09-17 19:08:35 +02:00
wm4 b44d075164 command: make window-scale redirect to option if no window created
For consistency with other properties that mirror options.
2016-09-17 19:08:17 +02:00
RiCON b7d5cbd375 DOCS: vo/ao auto profiles are deprecated
Leftovers from removal of references to ao/vo auto profiles.
2016-09-17 18:31:10 +02:00
wm4 dc48893630 options: simplify M_OPT_EXIT
There were multiple values under M_OPT_EXIT (M_OPT_EXIT-n for n>=0).
Somehow M_OPT_EXIT-n either meant error code n (with n==0 no error?), or
the number of option valus consumed (0 or 1). The latter is MPlayer
legacy, which left it to the option type parsers to determine whether an
option took a value or not. All of this was changed in mpv, by requiring
the user to use explicit syntax ("--opt=val" instead of "-opt val").

In any case, the n value wasn't even used (anymore), so rip this all
out. Now M_OPT_EXIT-1 doesn't mean anything, and could be used by a new
error code.
2016-09-17 18:07:40 +02:00
wm4 d1d5e9dda4 m_config: make option setting always call m_config_set_option_raw()
This makes m_config_set_option_raw() the function that is always called
on the lowest level (as leaf function for all other functions).

To do this, m_config_parse_option() has to do something special to deal
with "impure" options like --vf-add, which work on the previous option
value, instead of fully replacing it. m_config_set_option_raw() itself
always completely replaced the previous value.
2016-09-17 17:47:22 +02:00
wm4 7fa26bfd9c options: kill M_OPT_GLOBAL flag
This meant "cannot be used as per-file option" (wrt. playlist items).
Doesn't make too much sense anymore, especially given how obscure
per-file options are.
2016-09-17 17:04:13 +02:00
wm4 4395a4f837 player: don't enter playloop for client API requests
This _actually_ does what commit 8716c2e8 promised, and gives a slight
performance improvement for client API users which make a lot of
requests (like reading properties).

The main issue was that mp_dispatch_lock() (which client.c uses to get
exclusive access to the core) still called the wakeup callback, which
made mp_dispatch_queue_process() exit. So the playloop got executed
again, and since it does a lot of stuff, performance could be reduced.
2016-09-16 20:24:52 +02:00
wm4 56616b0b01 osd: fix OSD getting stuck with --blend-subtitles=yes
If --blend-subtitles=yes is given, vo_opengl will call osd_draw()
multiple times, once for subtitles, and once for OSD. This meant that
the want_redraw flag was reset before the OSD was rendered, which in
turn meant that update_osd() was never called. It seems like removing
the per-OSD object want_redraw wasn't such a good idea. Fix it by
reintroducing such a flag for OSDTYPE_OSD only.

Also, the want_redraw flag is now unused, so kill it.

Another regression caused by commit 9c9cf125. Fixes #3535.
2016-09-16 17:17:32 +02:00
wm4 17e3e800e1 dispatch: fix a race condition triggering an assert()
If we were waiting, and then exiting due to timeout, we still have to
recheck the condition protected by the condition variable/mutex in order
to get back to a consistent state. In this case, the queue was locked
with mp_dispatch_lock(), and mp_dispatch_queue_process() got to return
without waiting for unlock.

Also caused commit 8716c2e8. Probably an argument for replacing the
dispatch queue by a simple mutex.
2016-09-16 16:11:33 +02:00
wm4 ccf3458f8a player: fix a missed wakeup
ytdl.lua stopped working after commit 8716c2e8, because finishing the
hook did not wakeup the playloop correctly.
2016-09-16 15:51:56 +02:00
wm4 c47ae06ed8 vo_opengl: don't pass negative height to overlay_adjust()
Negative height is used to signal a flipped framebuffer. There's
absolutely no reason to pass this down to overlay_adjust(), and only
requires implementers to deal with an additional special-case.
2016-09-16 14:50:05 +02:00
wm4 8716c2e88f player: use better way to wait for input and dispatching commands
Instead of using input_ctx for waiting, use the dispatch queue directly.
One big change is that the dispatch queue will just process commands
that come in (e.g. from client API) without returning. This should
reduce unnecessary playloop excutions (which is good since the playloop
got a bit fat from rechecking a lot of conditions every iteration).

Since this doesn't force a new playloop iteration on every access, this
has to be enforced manually in some cases.

Normal input (via terminal or VO window) still wakes up the playloop
every time, though that's not too important. It makes testing this
harder, though. If there are missing wakeup calls, it will be noticed
only when using the client API in some form.

At this point we could probably use a normal lock instead of the
dispatch queue stuff.
2016-09-16 14:49:23 +02:00
wm4 15baf2789c client API: declare mpv_suspend/mpv_resume deprecated
They're useless, and I have no idea what they're actually supposed to do
(wrt. pending input processing changes).

Also remove their implicit uses from the IPC handlers.
2016-09-16 14:39:47 +02:00
wm4 03fec24e19 player: litter code with explicit wakeup calls
This does 3 kinds of changes:
- change sleeptime=x to mp_set_timeout()
- change sleeptime=0 to mp_wakeup_core() calls (to be more explicit)
- change commands etc. to call mp_wakeup_core() if they do changes that
  require the playloop to be rerun

This is preparation for the following changes. The goal is to process
client API requests without having to rerun the playloop every time. As
of this commit, the changes should not change behavior. In particular,
the playloop is still implicitly woken up on every command.
2016-09-16 14:39:45 +02:00
wm4 b8ade7c99b player, ao, vo: don't call mp_input_wakeup() directly
Currently, calling mp_input_wakeup() will wake up the core thread (also
called the playloop). This seems odd, but currently the core indeed
calls mp_input_wait() when it has nothing more to do. It's done this way
because MPlayer used input_ctx as central "mainloop".

This is probably going to change. Remove direct calls to this function,
and replace it with mp_wakeup_core() calls. ao and vo are changed to use
opaque callbacks and not use input_ctx for this purpose. Other code
already uses opaque callbacks, or has legitimate reasons to use
input_ctx directly (such as sending actual user input).
2016-09-16 14:37:48 +02:00
wm4 f845f64c2a osd: fix subtitle/overlay update problems
This could in theory lead to missed updates if subtitles were switched
or external OSD overlays (via overlay-add) were updated. While the
change IDs of each of those were consistent, switching between two
separate OSD sources is not, and we have to explicitly trigger a change.

Regression since commit 9c9cf125. The new code is actually better,
because we do exactly what is needed, and don't just mess with the
update ID for libass-based OSD.
2016-09-16 14:26:30 +02:00
Philip Langdale b83bfea05d hwdec_cuda: Rename config variable to be more consistent
'cuda-gl' isn't right - you can turn this on without any GL and
get some non-zero benefit (with the cuda-copy hwaccel). So
'cuda-hwaccel' seems more consistent with everything else.
2016-09-16 14:26:30 +02:00
wm4 cf5c3fc31a vo_opengl: rpi: cosmetic change
I almost feel sorry wasting a commit on this.
2016-09-15 14:50:38 +02:00
wm4 8bfcae748c audio: fix missed wakeup when changing audio output device
When playing audio-only, and changing the audio output device, playback
froze until the next time the playback core happened to wakeup (like
moving the mouse, or OSD redrawing). This is probably because of the
awful statemachine in fill_audio_out_buffers() - just make it recreate
the AO directly instead.
2016-09-15 14:50:38 +02:00
wm4 9c9cf125ad osd: slightly simplify update logic
Remove the per-part force_redraw flags, and instead make the difference
between flagging dirty state and returning it to the player frontend
more explicit. The big issue is that 1. the OSD needs to know the dirty
state, and it should be cleared strictly when it is re-rendered
(force_redraw flag), and 2. the player core needs to be notified once,
and the notification must be reset (want_redraw flag).

The call in loadfile.c is replaced by making osd_set_sub() set the
change flag. Increasing the change flag on dirty state (the force_redraw
check in render_object()) should not be needed, because OSD part
renderers set it correctly (at least now).

Doing this just because someone pointed this out.
2016-09-15 14:50:38 +02:00
wm4 5968a307d5 options: add --hwdec=yes as alias for --hwdec=auto
This also lets you just do "mpv --hwdec file.mkv", with the minor caveat
that the legacy syntax "--hwdec val" or "-hwdec val" (without "=") does
not work as expected anymore.
2016-09-15 14:50:38 +02:00
wm4 d1f5b926ac etc/builtin.conf: minor edits
The previous commit merely copied the profile string to a file (plus
changing how RPI-specific defaults are initialized), now make some
changes on top of it. In particular, remove the --input-lirc option,
which was removed a long time ago, but forgotten from the libmpv
profile.
2016-09-15 14:50:38 +02:00
wm4 2b0c620b22 player: move builtin profiles to a separate file
Move the embedded string with the builtin profiles to a separate
builtin.conf file. This makes it easier to read and edit, and you can
also check it for errors with --include=etc/builtin.conf. (Normally
errors are hidden intentionally, because there's no way to output error
messages this early, and because some options might not be present on
all platforms or with all configurations.)
2016-09-15 14:50:38 +02:00
wm4 98f1b5fb98 player: remove unintended !mingw ifdef for IPC uninit
Just wow. This function is implemented in ipc-win.c, and was surely be
meant to be called. But it wasn't called. This could in theory cause
crashes during exit if IPC clients were active.

Untested whether it really works.
2016-09-15 13:17:07 +02:00
wm4 1b5b23b948 client API: remove SIGPIPE overriding code
This workaround prevented that libmpv users could accidentally crash
when the SIGPIPE signal was triggered by FFmpeg's OpenSSL/GnuTLS usage.
But it also modifies the global signal handler state, so remove it now
that this workaround is not required anymore.
2016-09-15 13:13:23 +02:00
wm4 f143665864 manpage: explain "speed-adjusted" FPS for --interpolation-threshold
Fixes #3528.
2016-09-15 10:11:44 +02:00
wm4 30d147687f vo_opengl: fix OSD with icc-profile after previous commit
This happened to break because the texture unit wasn't reset to 0, which
some code expects. The OSD code in particular set the OSD texture on the
wrong texture unit, with the result that OSD/OSC was not visible.
2016-09-14 22:49:08 +02:00
wm4 88a07c5f53 vo_opengl: dynamically manage texture units
A minor cleanup that makes the code simpler, and guarantees that we
cleanup the GL state properly at any point.

We do this by reusing the uniform caching, and assigning each sampler
uniform its own texture unit by incrementing a counter. This has various
subtle consequences for the GL driver, which hopefully don't matter. For
example, it will bind fewer textures at a time, but also rebind them
more often.

For some reason we keep TEXUNIT_VIDEO_NUM, because it limits the number
of hook passes that can be bound at the same time.

OSD rendering is an exception: we do many passes with the same shader,
and rebinding the texture each pass. For now, this is handled in an
unclean way, and we make the shader cache reserve texture unit 0 for the
OSD texture. At a later point, we should allocate that one dynamically
too, and just pass the texture unit to the OSD rendering code. Right now
I feel like vo_rpi.c (may it rot in hell) is in the way.
2016-09-14 20:46:45 +02:00
wm4 e24ba8fa7f vo_opengl: require explicit reset on shader cache after rendering
The caller now has to call gl_sc_reset(), and _after_ rendering. This
way we can unset OpenGL state that was setup for rendering. This affects
the shader program, for example. The next commit uses this to
automatically manage texture units via the shader cache.

vo_rpi.c changes untested.
2016-09-14 20:24:06 +02:00
wm4 ffbc85cde9 vo_opengl: remove a redundant glActiveTexture() call
This bound video textures to individual texture units - this is how it
used to work long ago, but now is pointless, and maybe even dangerous.
2016-09-14 18:51:32 +02:00
Niklas Haas 8f1a889f75 vo_opengl: make the number of PBOs tunable
Also set the number of PBOs from 2 to 3, which should be better for
pipelining. This makes it easier to add more in the future.
2016-09-14 14:07:21 +02:00
wm4 9b6c93e904 vo_opengl: drm: use new EGL context creation code 2016-09-14 11:00:17 +02:00
wm4 c56f5f0681 vo_opengl: wayland: use new EGL context creation code 2016-09-14 10:46:52 +02:00
wm4 215268ea34 vo_opengl: EGL: dump some version info 2016-09-14 10:38:37 +02:00
wm4 d2e8bc4499 vo_opengl: EGL: better desktop-GL context creation
Stops Mesa from restricting us to OpenGL 3.0. It also tries to create
GLES 3 contexts for drivers which do not just return a higher context
when requesting GLES 2.

I don't know whether this code is a good or bad idea. A not-so-good
aspect is that we don't check for EGL 1.5 (or 1.4 extensions) for some
of the more advanced context attributes. But EGL implementations should
be able to tolerate it and return an error, and then we'd use the
fallback.
2016-09-14 10:19:09 +02:00
wm4 c48bd0ef18 vo_opengl: EGL: silence eglBindAPI() error message
It's not helpful and will be printed with EGL implementations that don't
support OpenGL at all. Just shut it up.
2016-09-13 20:38:05 +02:00
wm4 9def3682d1 vo_rpi, vo_opengl: separate RPI/EGL-specific code for both VOs
This used to be shared, but since vo_rpi is going to be removed,
untangle them. There was barely any actual code shared since the recent
changes anyway.

As a subtle change, we also stop opening libGLESv2.so explicitly in the
vo_opengl backend, and use RTLD_DEFAULT instead.
2016-09-13 20:35:53 +02:00
wm4 5819a4e301 vo_opengl: rpi: use new egl context creation helper function
Only for the "new" vo_opengl backend code.
2016-09-13 20:16:45 +02:00
wm4 060599ac6a vo_x11: fix some ifdeffery
This failed to compile when xext was not available.
2016-09-13 18:26:06 +02:00
wm4 0ccceecdc6 vo_opengl: mali fbdev support
Minimal support just for testing.

Only the window surface creation (including size determination) is
really platform specific, so this could be some generic thing with
platform-specific support as some sort of sub-driver, but on the other
hand I don't see much of a need for such a thing.

While most of the fbdev usage is done by the EGL driver, using this
fbdev ioctl is apparently the only way to get the display resolution.
2016-09-13 18:26:06 +02:00
wm4 6dc9280b58 vo_opengl: factor some EGL context creation code
Add a function to egl_helpers.c for creating an EGL context and make
context_x11egl.c use it. This is meant to be generic, and should work
with other windowing APIs as well. The other EGL-using code in mpv can
be switched to it.
2016-09-13 18:03:43 +02:00
wm4 3905c46f9a DOCS/interface-changes.rst: minor cleanup
Edit the 0.21.0 section: remove the redundant vo_opengl items, move some
up. Move the additions (which are less important and which aren't
documented completely anyway) below the incompatible
changes/deprecations.
2016-09-13 10:02:27 +02:00
wm4 5c0c0e469b manpage: vo_rpi -> vo_opengl 2016-09-13 09:24:17 +02:00
Niklas Haas f7471b7ff4 vo_opengl: fix typo in bt.601 auto-guessing logic
The wrong enum got copied here, so it was essentially using the transfer
characteristics as the primaries (instead of the primaries), which
accidentally worked fine most of the time (since the two usually
coincided), but broke on weird/mistagged files.
2016-09-13 09:23:47 +02:00
Vladimir Panteleev 6a0df47d94 player: Save sub-speed value when resuming playback 2016-09-13 09:23:28 +02:00
Vladimir Panteleev fb8f2a812e player: Improve OSD formatting of sub-speed option 2016-09-13 09:23:26 +02:00
Vladimir Panteleev 00f8ee573b player: Apply new sub-speed values during playback 2016-09-13 09:23:22 +02:00
Vladimir Panteleev 08cbac311d sub: Add SD_CTRL_UPDATE_SPEED 2016-09-13 09:23:19 +02:00
Ricardo Constantino 60a0815b4c ytdl_hook: don't bother adding subtitles if duration isn't known
EDL doesn't work with subtitles with unknown length.
2016-09-13 09:23:00 +02:00