Commit Graph

40020 Commits

Author SHA1 Message Date
wm4 5a3070304f vo_opengl: don't use 10 bit video on Intel GPUs
vo_opengl was originally written against OpenGL 3 core, and it seems
GPUs/drivers supporting this are mostly sane. Later, it was made to work
with OpenGL 2.1 too. Lately we removed the requirement for RG textures,
and look, someone reported a problem with "lesser" Intel GPUs.

This commit does the same in vo_opengl what was added to vo_opengl_old a
long time ago.

Fixes #1383.
2014-12-24 16:54:47 +01:00
wm4 fdb379109f player: hack against --keep-open misbehaving with broken files
If a file (or a demuxer) is broken, seeking close to the end of the file
doesn't work, and seek_to_last_frame() will be called over and over
again, burning CPU for no reason.

Observed with incomplete mp4 files. That this can happen was already
mentioned in commit 090f6cfc, but I guess now I'll do something against
it.

hrseek_lastframe is cleared by reset_playback_state(), so it's only set
if seek_to_last_frame() was called, and no other seek happened since
then. If finding the last frame succeeds, no EOF will happen (unless the
user unpauses, but then it will simply remain at the last frame). If it
fails, then it will return immediately, without retrying.
2014-12-24 15:12:11 +01:00
wm4 7593a1f638 player: fix a typo in message output
This typo has been around for over a year. Oops.
2014-12-24 14:35:04 +01:00
wm4 2b3b88b6ee stream: always disable cache for pseudo-streams
Streams which don't have a full_buffer function never return any actual
data. Slight improvement over commit 5640c195.
2014-12-24 14:33:34 +01:00
wm4 51abca8afd ipc: add enable_event and disable_event commands
This was requested.
2014-12-24 14:32:02 +01:00
wm4 7f36d1532e client API: document requirement to block SIGPIPE
I noticed that the IPC code does not use MSG_NOSIGNAL or SO_NOSIGPIPE.
The former is "only" POSIX 2008 and also requires switching to sendto(),
while the latter is even less portable.

Not going to bother with this obsolete 80ies crap, just block SIGPIPE,
and instruct client API users to do the same.
2014-12-24 13:25:33 +01:00
wm4 98a80884da ipc: report some user errors better
Using the IPC with a program, it's not often obvious that a newline must
be sent to terminate a command. Print a warning if the connection is
closed while there is still uninterpreted data in the buffer.

Print the OS reported error if reading/writing the socket fails. Print
an erro if JSON parsing fails.

I considered silencing write errors if the write end is closed (EPIPE),
because a client might send a bunch of commands, and then close the
socket without wanting to read the reply. But then, mpv disconnects
without reading further commands that might still be buffered, so it's
probably a good idea to always print the error.
2014-12-24 13:18:00 +01:00
wm4 5640c195a9 stream_edl: disable caching
stream_edl merely makes demux_edl act "special", which checks for the
stream type explicitly and then does something with its URL. If a cache
is added before the stream, it'll try to use the cache's URL (i.e. an
empty string), and will then obviously fail to parse the URL. While this
is slightly stupid, just disabling the entirely useless cache is the
most effective solution.

Fixes #1378.
2014-12-23 14:57:50 +01:00
wm4 2ad1906be6 vo_opengl_cb: use VAOs even in OpenGL 2.1
Using them reduces state change, since now at least vo_opengl_cb has to
setup/break the vertex array bindings on every frame if no VAOs are
available.

This reverts the VAO related change in commit f64665e7.
2014-12-23 14:32:24 +01:00
wm4 a71601231e vo_opengl_cb: always setup/break vertex array bindings
Originally, this code was written to have full control over the OpenGL
state, rather than having to cooperate with unknown components by being
embeded like vo_opengl_cb is meant to be. As a consequence, it was
thought to be ok to setup a global binding (if the context is below
OpenGL 3.0, which guarantees VAOs).

This could break badly. Fix it by setting up and breaking the bindings
on entry/exit.
2014-12-23 14:27:47 +01:00
wm4 759656d0ba ao_alsa: fix unpause path atfer previous commit
The resume code was accidentally fully removed from this code path.
2014-12-23 13:20:32 +01:00
wm4 d7b5484f51 ao_alsa: fix resuming from suspend mode
snd_pcm_prepare() was not always called, which could result in an
infinite loop.

Whether snd_pcm_prepare() was actually called depended on whether the
device was a hw device (or other characteristics; depending on
snd_pcm_hw_params_can_pause()), and required real suspend (annoying for
testing), so it was somewhat tricky to reproduce without knowing these
things.
2014-12-23 03:59:14 +01:00
wm4 4cfd641f05 vo_opengl: fix build on OSX
Missing modern OpenGL symbols again.
2014-12-23 03:12:37 +01:00
wm4 8782710993 demux_mkv: use attachment filename as coverart title 2014-12-23 02:50:53 +01:00
wm4 04a4c9b53c vo_opengl: don't allow setting 3D LUT if unsupported
The code was always uploading the 3D LUT (even of unused), as long as
vo_opengl was setting a icc-profile. This could crash with GLES 2.
2014-12-23 02:48:58 +01:00
wm4 a8ffa0d0eb vo_opengl: make use of newer OpenGL logging API
GL_ARB_debug_output provides a logging callback, which can be used to
diagnose problems etc. in case the driver supports it. It's enabled only
if the vo_opengl "debug" suboption is set.
2014-12-23 02:46:44 +01:00
wm4 b7d0db8bfe demux_mf: add probing by mime type
Reuses the mime type table introduced in the previous commit.
2014-12-22 12:54:18 +01:00
wm4 1ef56e9d08 demux_mkv: support embedded coverart
The code could as well be in demux.c, but it's better to avoid
accidental clashes with demux_lavf.c.

FFmpeg provides no way yet to map a mime type to a codec, so do it
manually. (It _can_ map a mime type to an "input format", but not a
codec.)

Fixes #1374.
2014-12-22 12:53:51 +01:00
wm4 c912288e57 vo_opengl_cb: parse renderer parameters
Now it accepts the same renderer arguments as vo_opengl. This also
disables debug checks by default, and reverts the background color
override. Both can now be controlled by the host application.
2014-12-22 12:51:23 +01:00
wm4 2b9a7c4b5b vo_opengl, vo_opengl_cb: check GL version in renderer
vo_opengl actually checks this in the context creation code already, but
it still increases robustness in case the requirements are changed
later.
2014-12-22 12:49:20 +01:00
wm4 cb347a9d05 client API: fix compiler warning if openglcb API is disabled
The function is void, and of course you can't return anything from it.
(Why does C or gcc even allow this?)
2014-12-22 12:47:05 +01:00
wm4 16a5971d28 vo_opengl_cb: free context on exit
Minor memory leak.

Actually, this also exposes some problems in the QtQuick example. This
will have to be fixed in the example.
2014-12-22 12:45:43 +01:00
wm4 c640b8f3c0 vo_opengl: fix feature detection
Fixes #1373.
2014-12-22 02:50:26 +01:00
wm4 4b4d3a57bf client API: fix mpv_wakeup()
Of course this was going to get stuck in the retry loop.

Fixes #1372.
2014-12-22 01:53:39 +01:00
wm4 bdae2f8fa8 sd_lavc: ignore image subtitles with unknown duration after 1 minute
Most image subtitle formats implicitly terminate the current subtitle
event with the next event (e.g. a new packet read from the demuxer will
instruct the subtitle render to stop display). If the subtitle event is
just trailing, it will be displayed forever. So there's no proper way
of doing this and we just apply an heuristic to avoid annoyances.
2014-12-22 00:00:18 +01:00
wm4 1e3400e353 sd_lavc: compensate for a stupid libavcodec API issue
The libavcodec PGS decoder sets end_display_time to UINT32_MAX, in an
attempt to signal unknown end time (the API does not allow to signal
this properly, and this was a backwards compatible hack).

While we have no issues with the large value, our code wants to
distinguish between known and unknown end time explicitly.
2014-12-21 23:58:09 +01:00
wm4 49d01d81e0 sub: reset sub decoder correctly when cycling subtitles
reset_subtitles() works in mpctx->d_sub[], which is set to NULL before
calling it from uninit_sub(). This fixes resetting the subtitle when
cycling subtitle tracks.

Actually, this was probably a feature, because it's annoying if
subtitles don't show up when cycling them. But it also can have
unintended consequences, so get rid of it.
2014-12-21 23:48:20 +01:00
wm4 dc0b0cdeb0 player: cosmetics: move code around
Separate commit to reduce noise in the following one.
2014-12-21 23:47:00 +01:00
wm4 d9f448da02 old-configure: fix disabling VAAPI GLX with --disable-gl
waf handles this correctly.
2014-12-21 23:46:54 +01:00
wm4 d5a7ad630f vo_opengl: improve fallback handling with GLES
Whether we have texture_rg doesn't matter much anymore; the scaler
should be fine with this. But on ES 2.0, 1st class arrays are missing,
so even if filterable float textures should be available, it won't work.

Dithering (at least the "fruit" variant) will not work either, because
it uses floats.
2014-12-21 23:46:54 +01:00
James Ross-Gowan ec4bbbb69b vo_opengl: silence an INVALID_ENUM error with GLES2
Signed-off-by: wm4 <wm4@nowhere>
2014-12-21 21:39:45 +01:00
wm4 f6dac5d884 vo_opengl: GLES does not support GL_BGRA
Apparently GLES 2 and 3 do not support this. (The implementations I
tested with were derived from desktop OpenGL and were not overly strict
with this.)

This is no problem; just use GL_RGBA and mangle the channels in the
shader.

Also disable direct support for image formats like IMGFMT_RGB555 with
GLES; at least some of them are not supported in this form, and the
formats aren't important anyway.
2014-12-20 19:23:17 +01:00
wm4 501290da02 vo_opengl_old: fix OSD regression
Commit 0e8fbdbd removed the rg_texture requirement from vo_opengl;
commit 541f6731 changed to a more convenient method. Both commits broke
vo_opengl_old in some ways. vo_opengl_old always requires GL_ALPHA for
single-channel texture, because it draws the OSD without shaders and by
using certain blend modes.

So we need to explicitly distinguish between vo_opengl and vo_opengl_old
in the OSD renderer, and force fixed texture formats for vo_opengl_old.
The other logic is specific to the internals of vo_opengl. (Although it
might be possible to get the same result by playing with the old GL
fixed-function functions in vo_opengl_old. But seems like a waste of
time.)

Fixes #1370.
2014-12-20 18:43:11 +01:00
wm4 7d43a7ea84 player: don't show "0%" percentage in infinite streams 2014-12-20 17:31:58 +01:00
wm4 a69f168dff ao_alsa: fix setting mono channel map
When setting the ALSA channel map, we never actually set the map we got
from ALSA directly, but convert it to mpv's, and then back to ALSA's.
mpv and ALSA use different conventions for mono, and there is already an
exception for ALSA->mpv, but not mpv->ALSA.
2014-12-20 17:18:50 +01:00
wm4 0dc455eb16 ao_alsa: remove some dead code
This was only added recently (c1e97161) as an attempt to minimize the
bad impact of channel layout device aliases. But use of these was
removed in commit 49df0132. Now this code does pretty much nothing, and
shouldn't be needed anymore. It does something when using spdif, but
this fallback won't work anyway.
2014-12-20 16:54:00 +01:00
wm4 5b32f30aa1 audio: fix previous commit
This would have always forced mono first (if supported by the AO),
instead of stereo.
2014-12-20 16:48:30 +01:00
wm4 d07c6566cd audio: fix fallback if audio API does not support mono
This makes it fallback to stereo properly.
2014-12-20 16:21:52 +01:00
Stefano Pigozzi e80d233fd4 cocoa: mark window for redraw after title change
This used to work correctly without the call to displayIfNeeded. I think this
may only be needed for Yosemite.

Fixes #1330
2014-12-20 11:45:51 +01:00
wm4 9f4b01400e player: print only changed tags
The code in the demuxer etc. was changed to update all metadata/tags at
once, instead of changing each metadata field. As a consequence,
printing of the tags to the terminal was also changed to print
everything on each change.

Some users didn't like this. Add a very primitive way to avoid printing
fields with the same value again if metadata is marked as changed. This
is not always correct (could print unchanged fields anyway), but usually
works.

(In general, a rather roundabout way to reflect a changed title with ICY
streaming...)

Fixes #813 (let's call it a "policy change").
2014-12-19 23:54:21 +01:00
wm4 fcd2ea7601 vo_opengl: remove pointless glFinish calls 2014-12-19 23:50:12 +01:00
wm4 e749d26ac3 vo_opengl: skip GLES when autoprobing
There are probably bugs with GLES support; also, if you somehow get GLES
instead of desktop GL on a desktop computer, something else is probably
wrong. So I see no point in using this automatically. We first need to
find out whether the GLES support works on real hardware, and whether
it is useful at all.
2014-12-19 20:34:11 +01:00
wm4 d31e584292 vo_opengl, x11: add ES context creation via GLX
Apparently GLX can do this, so using EGL is not strictly required.

This code tries to create an ES context if creating a desktop GL context
fails. Also, a "x11es" backend for forcing ES (instead of desktop GL) is
added, mostly for testing and debugging.
2014-12-19 20:29:31 +01:00
wm4 b7277d25e5 vo_opengl: fail if required functions are missing
Before this, missing additional but required functions were ignored.
("Main" functions still made it error out.) But we pretty much expect
that these are present on a given version level, and only an extremely
buggy OpenGL implementation would not do this.
2014-12-19 18:54:39 +01:00
wm4 88982f2855 vo_opengl: better probe handling
Involve detection of software renderers in the probing properly. Other
VOs could handle probing also more gracefully, and e.g. produce less
noise if an API is unavailable. (Although other than the OpenGL VOs,
only vo_wayland will.)

Now the "sw" suboption for vo_opengl[_old] is strictly speaking not
needed anymore. Doing "--vo=opengl" disables the probing logic, and will
always force it, if possible.

Includes some simplifications as well.
2014-12-19 18:54:39 +01:00
wm4 bebc323c6d vo_opengl: minor simplification
The parameter to default_tex_params() is always the same.
2014-12-19 18:32:51 +01:00
wm4 fd6256f9c7 vo_opengl: unbork
Probably.

The version handling schema is a bit strange (and led to a tricky and
obvious bug), but it's quite similar to what OpenGL does at some places,
so I blame the OpenGL standard.
2014-12-19 02:26:14 +01:00
wm4 a0051b9da2 vo_opengl: add GLES 2 support
Rather basic support. Almost nothing works, and even if it does, it's
bound to be inefficient (due to texture upload). This was tested with
the nVidia desktop binary drivers, which provide GLES 2 support only.
However, nVidia is not known to be very strict about OpenGL, and the
driver is very new too, so the vo_opengl code will have bugs too.
2014-12-19 01:21:19 +01:00
wm4 fe35130ba9 vo_opengl: mess with PixelStorei state management
This is needed for GLES 2 support. GLES 2 doesn't support
GL_UNPACK_ROW_LENGTH, and we shouldn't even use this constant, since a
GLES implementation could raise an error.

So set it only if neccessary, and leave it in the default state
otherwise. This also smuggles in a ES 2 fallback for glUploadTex(),
and querying an extension relevant for ES 2. For the alignment state
(GL_[UN]PACK_ALIGNMENT) do the same for symmetry. All 4 states
(alignment/rows x pack/unpack) are now assumed to be in their initial
states by default.

Also redo the PixelStorei handling in the function table. I could rebase
this, but look at the commit time.
2014-12-19 01:21:18 +01:00
wm4 de3e26bc84 vo_opengl: disable some unavailable features under ES
There are probably many more which I overlooked.
2014-12-19 00:15:38 +01:00