Commit Graph

43261 Commits

Author SHA1 Message Date
Niklas Haas 2dcf18c0c0 vo_opengl: generate 3DLUT against source and use full BT.1886
This commit refactors the 3DLUT loading mechanism to build the 3DLUT
against the original source characteristics of the file. This allows us,
among other things, to use a real BT.1886 profile for the source. This
also allows us to actually use perceptual mappings. Finally, this
reduces errors on standard gamut displays (where the previous 3DLUT
target of BT.2020 was unreasonably wide).

This also improves the overall accuracy of the 3DLUT due to eliminating
rounding errors where possible, and allows for more accurate use of
LUT-based ICC profiles.

The current code is somewhat more ugly than necessary, because the idea
was to implement this commit in a working state first, and then maybe
refactor the profile loading mechanism in a later commit.

Fixes #2815.
2016-04-01 10:27:27 +02:00
wm4 0d74652232 build: fix AVCodecParameters FFmpeg API check
FFmpeg partially merged the API change. It added the AVCodecParameters
definition, but not the AVCodecContext.codecpar field. The new code
compiles only with the API fully merged, so adjust the check.
2016-04-01 10:13:13 +02:00
wm4 d0238711dc build: disable encoding mode by default
Encoding mode uses deprecated API. See previous commit. Encoding mode
will stop working/compiling at some point in the future, so unless
someone fixes the encoding code, it will stay disabled by default.

(Note that the deprecations are not merged in FFmpeg yet, but they will
soon. They've been deprecated in Libav for a while now.)
2016-03-31 22:04:22 +02:00
wm4 c971220cdd demux_lavf, ad_lavc, ad_spdif, vd_lavc: handle FFmpeg codecpar API change
AVFormatContext.codec is deprecated now, and you're supposed to use
AVFormatContext.codecpar instead.

Handle this for all of the normal playback code.

Encoding mode isn't touched.
2016-03-31 22:00:45 +02:00
wm4 38c813c919 demux_lavf: remove old MicroDVD frame timing guessing
This was changed in 2014, so I suppose users will usually have a FFmpeg
release which includes the corresponding upstream change. If not, well
too bad for those MicroDVD-obsessed users.

Also don't try to retrieve the default framerate as exported by the
demuxer, and instead hardcode it and trust it won't ever change. this
avoids that we have to deal with a larger mess in the codecpar commit.
2016-03-31 21:46:23 +02:00
wm4 0e7bdce907 demux_lavf: remove some old framerate guessing
I don't trust it one bit, and it's a bother with the codecpar change.
If it turns out to be important for some file formats, it could be
added back (or FFmpeg fixed).
2016-03-31 21:39:01 +02:00
Ben Boeckel 02dfc2c051 mplayer-input.conf: fix input.conf location in comment 2016-03-31 08:19:36 +02:00
Kevin Mitchell d88934815d dxva2: abort on mp_image_new_custom_ref failure 2016-03-30 09:01:35 -07:00
Kevin Mitchell c0848e18e9 dxva2: stop using pointer obfuscator LPDIRECT3DSURFACE9
It's just ugly and unnecessary.
2016-03-30 09:01:34 -07:00
Kevin Mitchell 213c611471 dxva2: rewrite to use shared code with d3d11va
This is basically a full rewrite to make it look more like d3d11va.c
2016-03-30 09:01:33 -07:00
Kevin Mitchell a7110862c8 vd_lavc: add d3d11va hwdec
This commit adds the d3d11va-copy hwdec mode using the ffmpeg d3d11va
api. Functions in common with dxva2 are handled in a separate decode/d3d.c
file. A future commit will rewrite decode/dxva2.c to share this code.
2016-03-30 09:01:27 -07:00
Kevin Mitchell 872d0838a4 ta: add TA_FREEP macro
This sets the pointer to NULL after talloc_freeing it. This emulates the
av_freep function for ta_talloc, but with a macro instead.
2016-03-30 05:48:01 -07:00
wm4 3984d2acca player: hide cache in status line by default again
Commit 57506b27 accidentally broke this. The status (including the
usually always active demuxer cache) should be shown only if the stream
cache is actually enabled.
2016-03-30 11:40:13 +02:00
wm4 1107a070e4 Revert "demux_mkv: don't trust DefaultDuration for audio"
This reverts commit 503c6f7fd6.

There are situations where some decoders (MF apparently) always require
a timestamp. Also, this makes bitrate estimation more granular than
necessary. It seems it's better to try to detect fiels with broken
default durations explicitly instead. Or maybe something should be
added to smooth audio timestamps after filters.
2016-03-30 11:34:35 +02:00
Niklas Haas ec6e8a31e0 vo_opengl: draw transparency checkerboard after upscaling
This also draws it after color management etc. In a nutshell, this
change makes the transparency checkerboard independent of upscaling,
panning, cropping etc. It will always be the same apparent size and
position (relative to the window).

It will also be independent of the video colorspace and such things.
(Note: This might cause white imbalance issues if playing a file with a
white point that does not match the display, in absolute colorimetric
mode. But that's uncommon, especially in conjunction with transparent
image files, so it's not a primary concern here)
2016-03-29 22:29:19 +02:00
wm4 dae23fff09 vo_opengl: always premultiply alpha
Until now, we've let the windowing backend decide. But since they
usually require premultiplied alpha, and premultiplied alpha is easier
to handle, hardcode it.
2016-03-29 21:56:38 +02:00
wm4 b95a10c2dd vo_opengl: fix rotation direction
The recent changes fixed rotation handling, but reversed the rotation
direction. The direction is expected to be counter-clockwise, because
demuxers export video rotation metadata as such.
2016-03-29 11:47:16 +02:00
wm4 8d69731871 cache: fix incorrect EOF condition
Don't assume EOF if we didn't try to read anything in the first place.
Fixes regressions in particular with low cache sizes, which triggered
the other code paths more often.
2016-03-29 11:43:16 +02:00
wm4 57506b27ed cache: use a single STREAM_CTRL for various cache info
Instead of having a separate for each, which also requires separate
additional caching in the demuxer. (The demuxer adds an indirection,
since STREAM_CTRLs are not thread-safe.)

Since this includes the cache speed, this should fix #3003.
2016-03-29 11:29:52 +02:00
wm4 e1264d3976 command: add video-stereo-mode property
Enables runtime change of the option.

Fixes #2994.
2016-03-28 19:40:47 +02:00
wm4 d73d5327b3 player: fix breakage when combining 3D and rotate auto-filters
This would get stuck in reconfiguring the filter chain forever, because
params was mutated ("params.rotate = 0;"). This was used as input for
vf_reconfig(), but the filter chain input must always be equivalent to
the decoder output, or filter chain reconfiguration will be triggered.
The line of code to reset the rotation is from a time when this used to
work differently.

Also remove the unnecessary try_filter() parameter.
2016-03-28 19:39:33 +02:00
wm4 cdd30fd0ab player: remove auto-inserted filters before adding them again
Makes certain cases of runtime changes actually work.

Also change the label for the stereo3d filter and make it consistent
with the rotate one.
2016-03-28 19:36:11 +02:00
wm4 bd98d9e232 vo_opengl: slightly compress gl_set_debug_logger()
No functional changes.
2016-03-28 18:07:41 +02:00
wm4 b8b2a465d1 vo_opengl: reduce temporary variables in gl_transform_trans()
Using a single gl_transform variable instead of many float ones makes it
easier to see what it's doing. No functional change.
2016-03-28 18:07:18 +02:00
wm4 5827d9cc09 vo_opengl: fix rotation
This has been completely broken since commit 93546f0c. But even before,
rotation handling did not make too much sense. In particular, it rotated
the contents of the cropped image, instead of adjusting the crop
rectangle as well. The result was that things like panscan or zooming
did not behave as expected with rotation applied.

The same is true for vertical flipping. Flipping is triggered by
negative image stride. OpenGL does not support flipping the image on
upload, so it's done as part of the rendering. It can be triggered with
--vf=flip, but other filters and even decoders could setup negative
stride to flip the image.

Fix these issues by applying transforms to texture coordinates properly,
and by making rotation and flipping part of these transforms.

This still doesn't work properly for separated scaling. The issue is
that we'd have to adjust how the passes are done. For now, pick a very
stupid solution by rotating the image to a FBO, and then scaling from
that. This has the avantage that the scale logic doesn't have to be
complicated for such a rare case. It could be improved later.

Prescaling is apparently still broken. I don't know if chroma
positioning works properly either. None of this should affect the case
with no rotation.
2016-03-28 17:02:27 +02:00
wm4 e5b5cc2a2f vo_opengl: fix row-major vs. column-major confusion
gl_transform_vec() assumed column-major, while everything else seemed to
assumed row-major memory organization for gl_transform.m. Also,
gl_transform_trans() seems to contain additional confusion.

This didn't matter until now, as everything has been orthogonal, this
the swapped matrix entries were always 0.
2016-03-28 16:16:09 +02:00
wm4 fb70819048 vo_opengl: don't upload potentially uninitialized memory to GL buffer
If the texture count is lower than 4, entries in va.textcoord[] will
remain uninitialized. While this is unlikely to be a problem (since
these values are unused on the shader side too), it's not nice and might
explain some things which have shown up in valgrind.

Fix by always initializing the whole thing.
2016-03-28 16:13:56 +02:00
wm4 c51fe7944d vo_openg: fix debanding + rectangle-textures 2016-03-27 16:46:01 +02:00
wm4 4470976cee player: fix --stream-dump exit code
Inverted condition due to weird semantics after a refactor some time
ago. Fixes #2848.
2016-03-26 20:14:02 +01:00
wm4 447da032a3 input: do not force double-click emulation for artificial commands
E.g. "mouse 100 100 1 double" did not actually process the double-click,
because double-click emulation is on by default. So the user would have
to send two successive clicks instead. This is probably not expected, so
disable this weird logic for artificial input.

Fixes #2899.
2016-03-26 20:03:11 +01:00
wm4 e0cf90a0c8 build: allow plain-gl build on OSX
Still requires Cocoa for various things, but no vo_opengl.

Untested. Fixes #2980 (probably).
2016-03-26 19:39:38 +01:00
Martin Herkt a4168d85ab
player: add wv to list of external audio file extensions 2016-03-26 18:24:07 +01:00
Martin Herkt d5c5a2b05e
TOOLS/zsh.pl: add .wv extension in zsh completions 2016-03-26 18:23:37 +01:00
wm4 32fde273d3 lua: don't require key for mp.add_key_binding()
Requested. The intention is that scripts can provide mappable actions
for key bindings without setting a default key.
2016-03-26 10:44:57 +01:00
Jan Ekström 5843392db5 Add a mediacodec decoder hwdec wrapper
Does the same thing as the rpi one - makes fallback possible by
pretending that h264_mediacodec is a hwdec.
2016-03-25 21:35:59 +01:00
Jan Ekström 83b8d3f52c vd_lavc: mediacodec also needs special timebase love 2016-03-25 21:35:57 +01:00
wm4 5fe2812494 sub: force segment switch if video is already ahead
In particular, this prevents subtitle packets from building up in the
subtitle queue if e.g. --vo=null is used. In this situation,
sub_get_bitmaps() is never called, and thus the segment never switched.

This also seems to help with flickering at segment switch boundaries (if
subs are supposed to be visible at the transition points).

In theory, this could trigger a switch too early, but the way VO and
subtitle renderer interact wrt. timing is a bit iffy anyway.
2016-03-25 17:40:44 +01:00
wm4 dafafc90de demux_timeline: request subtitle prefetching on crossing segments
SEEK_HR is interpreted by demux_mkv.c, and enables subtitle preroll by
prefetching additional subtitle pakcets which might overlap with the
seek destination. This should make the case work when segment boundaries
fall into the middle of subtitle events.

This still usually leaves a flicker of at least 1 frame on start,
because dec_sub.c does not ensure that enough subtitles are read before
rendering after a segment switch. (Probably a WONTFIX.)
2016-03-25 17:27:02 +01:00
James Ross-Gowan ef625a78a4 ipc-win: restrict read access to the IPC pipe
The default security descriptor for named pipes in Windows allows the
pipe to be opened for read access by the Everyone group and Anonymous
account, as well as low-integrity processes (like web browser renderer
processes.) This does not allow commands to be ran, but it does allow
events to be received.

I don't think any sensitive data is exposed by events, but that may not
always be the case and Lua plugins might change this, since they can
broadcast their own events with script-message. To be safe, this commit
sets a custom security descriptor on the named pipe which only allows
access from processes running under the same user account with an
integrity level greater than or equal to the one used by mpv.
2016-03-25 21:06:30 +11:00
wm4 a76f3e8e46 vo_opengl: minor coding style adjustment 2016-03-24 21:23:22 +01:00
wm4 da015d9d00 vo_opengl: utils: some more minor shader string building optimization
Instead of reallocating almost all of the shader string several times
per pass, build it into a fixed buffer that will be reallocated as
needed.

While this still uses a linear search and full comparison of the shader
text, this will compare the shader's string length first before doing a
full comparison as a nice side effect. (That's also why the fragment
shader is compared first - it's more likely to be different for
different cache entries than the vertex shader stub.)
2016-03-24 21:22:10 +01:00
wm4 73682a634a DOCS/interface-changes: mention --input-ipc-server change 2016-03-24 19:24:40 +01:00
wm4 4300bfd518 ad_lavc, vd_lavc: support new Libav decoding API
For now only found in Libav.
2016-03-24 17:53:30 +01:00
wm4 f0febc35eb ad_lavc: add codec_timebase hack too
vd_lavc.c had this, and soon I'll need it in ad_lavc.c too. For now it's
unused.
2016-03-24 16:39:15 +01:00
wm4 b34befbab8 vd_lavc: slightly improve codec_timebase hack
The mp_set_av_packet()/mp_pts_from_av() functions check whether the
timebase is set at all (i.e. AVRational.num!=0), so there's no need to
fiddle with pointers.
2016-03-24 16:38:14 +01:00
wm4 30e94fa711 vo_opengl: utils: slightly optimize shader string building
Use bstr as appending buffer, which should avoid frequent reallocation
and copying. The previous commit should help with this a little.
2016-03-23 22:03:53 +01:00
wm4 f9084c7bce bstr: avoid redundant vsnprintf calls
Until now, bstr_xappend_vasprintf() called vsnprintf() always twice:
once to determine how much output the call would produce, and a second
time to actually output the data to the (possibly resized) target
memory.

Change this so that it tries to output to the already allocated memory
first, and repeat the call only if allocation is required.

This is especially helpful, as bstr_xappend_vasprintf() is designed to
avoid reallocation when building strings. Usually, the second
vsnprintf() will happen only at the beginning, when the buffer hasn't
been extended to his largest needed size yet.

Not sure if there is a need to optimize this; but see the next commit.
2016-03-23 22:00:35 +01:00
wm4 c7f802ee45 vo_opengl_cb: fix NULL deref
Broken in commit d6c99c85. vo_opengl_cb.c adds the corner case that
p->osd can be NULL. This make opengl-cb always crash.
2016-03-23 14:49:39 +01:00
James Ross-Gowan a07832313d man: ipc: update for named pipe IPC on Windows 2016-03-23 23:15:27 +11:00
James Ross-Gowan cd50ebba36 ipc: rename --input-unix-socket to --input-ipc-server
JSON IPC works on Windows now, and although the transports for each
plaform have similar characteristics, they unfortunately have different
names (Unix domain sockets on Linux/Unix vs. named pipes on Windows.)

Hopefully this change better reflects the purpose of the option too,
since with --input-ipc-server, mpv acts as an IPC server that can
service many simultaneous clients (as opposed to --input-file, which can
only do one-to-one IPC.)
2016-03-23 23:15:26 +11:00