Commit Graph

40394 Commits

Author SHA1 Message Date
wm4 0bd147bd14 vo_opengl: some minor cleanups
default_tex_params() and texture_size() are each called only once, so
move inline/reimplement them at the caller.

image_dw/dh were unused. texture_w/h, image_format, and component_bits
were rarely used, and can be replaced. Regroup some other fields.

Rename surface_num to surface_idx, because the former sounded like a
count, and not an index. Move fbosurface_next() closer to its callers
too.

Move the DebugMessageCallback() code to gl_utils.c (also simplify it
by always setting the callback, instead of only when it changes).
2015-01-29 16:21:02 +01:00
wm4 1e67ce74d8 vo_opengl: force redraw on command line changes 2015-01-29 15:16:30 +01:00
wm4 14bbbffa99 vo_opengl: move FBO helper to gl_utils
This is somewhat messy, because fbotex_init() itself was depending on
some gl_video parameters unrelated to FBO creation (like what scaler was
in use - what the fuck did this check do in this function?), so this
commit does a bit more than moving code around. In particular, the FBO
for the separate scaling intermediate step now always uses GL_NEAREST
sampling, and all FBOs are destroyed/recreated on renderer
reinitialization.

This also moves the function matrix_ortho2d() - trivial enough not to
put it into a separate commit.
2015-01-29 15:16:17 +01:00
wm4 bf8abc0ca9 vo_opengl: fix shader issue with Intel drivers
Windows Intel drivers seem to reject some (AFAIK) valid GLSL. Make them
happy.

<rossy> GL_RENDERER='Intel(R) HD Graphics 4400'
<rossy> GL_VERSION='3.0.0 - Build 10.18.14.4080'
<rossy> GL_SHADING_LANGUAGE_VERSION='1.30 - Build 10.18.14.4080'
2015-01-29 15:15:14 +01:00
wm4 cd41d1c7eb player: move more code out of central playloop function
...into its own functions. The central playloop function is still too
big, but looks much cleaner now.

No changes in functionality. The code moved to handle_playback_restart()
is unindented by 1 level and moving it out of the if condition around.
The if condition is inverted and early-exits from the function. Also
some comments are changed.
2015-01-29 15:15:13 +01:00
wm4 86d4094b98 player: remove redundant variable
mpctx->audio_delay always has the same value as opts->audio_delay. (This
was not the case a long time ago, when the audio-delay property didn't
actually write to opts->audio_delay. I think.)
2015-01-29 15:15:01 +01:00
wm4 34d3a27f28 vo_opengl: create abstraction for VAOs
Handles stupid boilerplate OpenGL requires you to handle. It's the same
code as in gl_video.c, although if no VAOs are available, the fallback
code rebinds them on every draw call instead of just once.
2015-01-28 22:22:29 +01:00
wm4 616481ad29 vo_opengl: remove some unused functions
These were intended for some plans that were never realized.

Also move some comments around and fix them.
2015-01-28 19:40:52 +01:00
wm4 3583559164 vo_opengl: move utility functions from loader to a separate file
gl_common.c contained the function loader (which is big) and additional
utility functions (not so big, but will grow when moving more out of
gl_video.c). Just split them. There are no changes other than some
modifications to comments.
2015-01-28 19:40:46 +01:00
wm4 7b3feecbc2 player: allow seeking audio between video frames
This allows seeking audio between two video frames that are relatively
far away.

The implementation of this is a bit subtle. It pretend the audio
position is different, and the actual PTS adjustment happens in audio.c
with this line:

    sync_pts -= mpctx->audio_delay - mpctx->delay;

Effectively this is the same as setting sync_pts to hrseek_pts after
this line, though. (I'm actually not sure if this could be written in a
more straightforward way; probably yes.)
2015-01-28 19:40:12 +01:00
wm4 7f7340ce76 player: enable hr-seek on audio after video end
Some files can have audio after video has ended, and playback of the
audio-only remainder is supposed to work just fine.

Seeking is broken-ish though. Not much can be done about this, since
it's the way demuxers work. Also, such files are obscure corner cases.
But enabling hr-seek for audio after video end can improve the situation
a lot.

This helps with issue #1533. The reported also provided a command line
to produce such a file:

    ffmpeg -i image.jpg -i audio.flac -threads $(nproc) \
        -c:v libvpx -crf 10 -qmin 5 -qmax 55 \
        -vf scale=360:-1 -sws_flags lanczos -c:a libvorbis -ac 2 \
        -b:a 128K out.webm
2015-01-28 19:40:12 +01:00
Niklas Haas 8d15f7583c
vo_opengl: remove is_linear_rgb and clean up code
This opportunity for refactoring was enabled by f3c84a3.
2015-01-28 18:52:33 +01:00
Stefano Pigozzi 0a38d69ac0 man: expand on the smoothmotion documentation
Hopefully this will clear up how the thing is supposed to work (and that it's
not SVP, nor MVTools).
2015-01-28 14:19:32 +01:00
wm4 cbd2de6884 vo_opengl: fix the fix for fixing odd video sizes
Commit acb40644 fixed video with unaligned luma/chroma sizes. It
attempted to disable the fix for videos where it effectively does
nothing (just some minor performance paranoia), but this check was
broken - fix it by not duplicating the logic for this.
2015-01-28 13:50:39 +01:00
wm4 f3c84a322d vo_opengl: fix display of ARGB ith color management enabled
PNG uses a different component order from GL_RGBA, so we upload the
surface using the "wrong" order, and then fix it in the shader. This
breaks if a sRGB texture (GL_SRGB) is used: the hardware will not touch
the alpha channel, which means that the B component is not adjusted,
leading to incorrect output.

Just remove the use of sRGB textures completely. It might lead to a
slight slow down when playing RGB with color management enabled, but
with this combination of obscure use case with minor performance impact
it's not a meaningful disadvantage.

Unfortunately this also means that alpha is handled incorrectly with our
own color management, but alpha isn't so important and can be fixed
later. (0.0 and 1.0 are unchanged by the transfer function, so it
"mostly" works.)

Fixes #1530.
2015-01-28 13:36:07 +01:00
Diogo Franco (Kovensky) 631c256819 player: demote matroska ordered chapter scanning messages to Verbose
Causes a lot of terminal spam on large folders and is not actually
useful except maybe for debugging.
2015-01-28 11:43:48 +09:00
wm4 b473477fc5 vf_ilpack: remove this filter
This was apparently useful for correct interlaced scaling (although I
don't know anyone who used this). It was rarely used (if at all), had an
inconvenient output format (packed YUV), and now has a better solution
in libavfilter (using the libavfilter "scale" filter via vf_lavfi).
There is no reason to keep this filter any longer.
2015-01-27 19:13:51 +01:00
wm4 86bba0dc5b vf_divtc: remove this filter
Better solutions are available in vf_vapoursynth and vf_lavfi. The only
user I know who used this is now using vf_vapoursynth.
2015-01-27 19:10:13 +01:00
wm4 97f32fdb23 vf_phase: remove this filter
If you really want it, it's in libavfilter and can be used via vf_lavfi.
2015-01-27 19:06:59 +01:00
wm4 82e3d06f09 vf_swapuv: remove this filter
It's entirely useless. I left it in for a while, because the analog TV
code had a transitional bug that could switch chroma planes, but it was
fixed long ago. It's also available in libavfilter.
2015-01-27 19:04:02 +01:00
wm4 c92f4a1126 vf_softpulldown: remove this filter
Apparently it was completely broken and essentially did nothing. This
was broken sometime in early mpv or mplayer2 times.

Get rid of it. If you _really_ need it, wait until FFmpeg ports it from
MPlayer, which will happen very soon.
2015-01-27 18:58:16 +01:00
wm4 69e5dd9bce vf_pullup: remove builtin implementation
Now it requires libavfilter. The wrapper is left in place, so FFmpeg
users will not notice any change. On Libav, the filter stops working.
2015-01-27 18:53:28 +01:00
Ben Boeckel 2bbad06bfc ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAIL
The macro actually returns the *available* space in the array, not how
much is actually filled in.
2015-01-27 18:09:36 +01:00
wm4 acb40644db vo_opengl: change the way unaligned chroma size is handled
This deals with subsampled YUV video that has odd sizes, for example a
5x5 image with 4:2:0 subsampling.

It would be easy to handle if we actually passed separate texture
coordinates for each plane to the shader, but as of now the luma
coordinates are implicitly rescaled to chroma one. If luma and chroma
sizes don't match up, and this is not handled, you'd get a chroma shift
by 1 pixel.

The existing hack worked, but broke separable scaling. This was exposed
by a recent commit which switched to GL_NEAREST sampling for FBOs. The
rendering was accidentally scaled by 1 pixel, because the FBO size used
the original video size, while textures_sizes[0] was set to the padded
texture size (i.e. one pixel larger).

It could be fixed by setting the padded texture size only on the first
shader. But somehow that is annoying, so do something else. Don't pad
textures anymore, and rescale the chroma coordinates in the shader
instead.

Seems like this somehow doesn't work with rectangle textures (and
introduces a chroma shift), but since it's only used when doing VDA
hardware decoding, and the bug occurs only with unaligned video sizes, I
don't care much.

Fixes #1523.
2015-01-27 18:09:03 +01:00
Martin Herkt f6e05b14b2 manpage: fix rst2pdf build
Uhhh… What???
2015-01-27 08:46:46 +01:00
wm4 00b2611352 command: export more details about file seekability
If a file is unseekable (consider e.g. a http server without resume
functionality), but the stream cache is active, the player will enable
seeking anyway. Until know, client API user couldn't know that this
happens, and it has implications on how well seeking will work. So add a
property which exports whether this situation applies.

Fixes #1522.
2015-01-26 13:46:33 +01:00
wm4 792db4eee3 player: fix framestep over timeline segment boundaries
This was subtly broken by commit a937ba20. Instead of framestepping over
the timeline segment boundary, it would just unpause playback, because
seeking now resets mpctx->step_frames. This was especially apparent when
doing something like "mpv *.jpg --merge-files".

Fix by restoring the step_frames field specifically if the seek is done
for switching segment boundaries. Hopefully the number fields which need
such an exception on seeking won't grow and turn this code into a mess.
2015-01-26 12:29:27 +01:00
wm4 751830da32 vo: handle very long frame durations with smoothmotion enabled
With mf://, rather long frame durations are common. By default, one
frame takes 1 second. This causes the if branch changed with this commit
to always being taken, which in turn leads to the player not being woken
up correctly. (As a consequence, it "freezes" by waiting for events that
never come, and moving the mouse cursor over the window will wake it up
again and advance video.)

Obviously, the code should account for how long the video frame takes.
The code is probably still not fully correct, but for now this fixes the
issue at hand.

Fixes #1521.
2015-01-26 12:06:45 +01:00
wm4 9b8d3acc8b options: list correct default value for --screenshot-template
Make the default value part of the option metadata, instead of doing
this in the screenshot code. Makes more sense with --list-options and
the command.c option metadata properties.
2015-01-26 11:38:23 +01:00
wm4 96f7c96da0 msg: add --log-file option
This allows getting the log at all with --no-terminal and without having
to retrieve log messages manually with the client API. The log level is
hardcoded to -v. A higher log level would lead to too much log output
(huge file sizes and latency issues due to waiting on the disk), and
isn't too useful in general anyway. For debugging, the terminal can be
used instead.
2015-01-26 11:31:02 +01:00
wm4 637e3e975c manpage: document 'A' key
Of course this was forgotten in commit 189087c.
2015-01-26 10:01:17 +01:00
Diogo Franco (Kovensky) 484e9f8090 manpage: fix typo 2015-01-26 15:15:42 +09:00
wm4 06b1a2f145 manpage: fix smoothmotion-threshold value range 2015-01-26 07:05:59 +01:00
wm4 4a06a66501 vo_opengl: drop sRGB framebuffer detection
We've stopped using them some time ago (we're doing things manually
instead).
2015-01-26 06:12:35 +01:00
wm4 f033eaff9b options: make --hls-bitrate=max the default
The previous default ("no") seemed to be equivalent to "min" in practice
(though it might depend on the website, which is even worse).

Better just select the best stream by default.
2015-01-26 03:58:13 +01:00
wm4 78f1f2017c manpage: describe some more config directory artifacts 2015-01-26 03:20:35 +01:00
wm4 189087c2ed input.conf: bind 'A' to cycling aspect ratios
Apparently broken files are popular enough that this is still needed.
It's relatively often asked on the IRC channel, and I also found it on
the archwiki mpv page.

The list of aspect ratios is taken from the archwiki page, with "16:10"
removed (because I doubt there are actually files with this aspect
ratio).
2015-01-26 03:03:19 +01:00
wm4 f47b14b717 video/out: cosmetics: rename VO_EVENT_ICC_PROFILE_PATH_CHANGED
Remove the "PATH" bit, because VOCTRL_GET_ICC_PROFILE returns an in-
memory profile, and not a path. (This was changed a while ago.)
2015-01-26 02:21:00 +01:00
wm4 df3e6b549c vo_opengl, x11: implement icc-profile-auto
This queries the _ICC_PROFILE property on the root window. It also tries
to reload the ICC when it changes, or if the mpv window changes the
monitor. (If multiple monitors are covered, mpv will randomly select one
of them.)

The official spec is a dead link on freedesktop.org, so don't blame me
for any bugs.

Note that this assumes that Xinerama screen numbers match the way mpv
enumerates the xrandr monitors. Although there is some chance that this
matches, it most likely doesn't, and we actually have to do complicated
things to map the screen numbers. If it turns out that this is required,
I will fix it as soon as someone with a suitable setup for testing the
fix reports it.
2015-01-26 02:18:47 +01:00
wm4 73d5e396fe vo_opengl: minor changes to ICC update code
Merge update_icc_profile() into get_and_update_icc_profile() - there's
no reason anymore to keep them separate. The former is only called by
the latter, and the separation of responsibilities between them is
blurry a best.

Query the ICC profile only if the corresponding feature is actually
enabled. Additionally, change the error behavior of this code. Make
loading failure non-fatal, and distinguish between runtime error and
unimplemented functionality.

Fix a memory leak in gl_lcms.c (although the changes in vo_opengl.c
already take care of this, it's just logical and cleaner).
2015-01-26 02:11:14 +01:00
wm4 9fc15e5e1c vo_opengl: update a comment
We don't use the hwdec-provided video texture for screenshots anymore.
2015-01-26 02:06:18 +01:00
wm4 dc1793048f vo_opengl: make "mitchell" the hq default filter for downscaling
Seems like several people agree that it's a good filter for downscaling.

Setting this option by default may also prevent people from accidentally
using an unsuitable filter for downscaling by setting "scale" and
without being aware of the impliciations (maybe). On the other hand,
this change is not strictly backwards compatible for the same reasons.

Also, allow disabling this option with scale-down="" (before this, not
setting it was the only way to do this - not possible anymore if it's
set by default). This is what the change in handle_scaler_opt() does.
2015-01-26 02:03:44 +01:00
wm4 639e2bd12f vo_opengl: simplify radius initialization
Somehow, the default radius for filters with variable radius was set in
mp_init_filter(). gl_video.c used NAN as default value for the radius,
which would make the filter use the default radius. Simplify this, and
set the default radius directly in the gl_video options. It also makes
the options easier to understand, because the default value listed in
--vo=opengl:help actually shows the default value.

Remove the function can_use_filter_kernel(), because it doesn't set a
radius if none is set. The function is worthless anyway (something about
making filter_kernels.c reusable to other VOs, and trying to deal with
the possibility that it could provide filters not supported by
vo_opengl.)
2015-01-26 01:56:19 +01:00
wm4 6945369e9c vo_opengl: fancy-downscale affects luma-scaler only 2015-01-25 01:35:17 +01:00
Ben Boeckel b1d47786d8 ao_pulse: plug a memory leak 2015-01-25 01:26:11 +01:00
wm4 9cba451949 lua: do not use math.pow()
It's the first thing that breaks with Lua 5.3. I don't know if there
are other failures because I don't care enough.
2015-01-25 01:23:29 +01:00
wm4 99c856d3cd vo: fix redraw logic
It actually can and does happen that you want to redraw, even if no
image was queued yet.

Broken by commit 28582322.
Fixes #1510.
2015-01-25 00:52:44 +01:00
wm4 0e69c1c5af input: fix dangling pointer
Removes undefined behavior that showed up as crap when running with -v.
2015-01-25 00:37:31 +01:00
wm4 d9609c792c options: don't list removed options 2015-01-25 00:36:40 +01:00
wm4 32f726703d vo_opengl: remove remnants of dropped stereo buffer support 2015-01-24 23:29:54 +01:00