Commit Graph

1956 Commits

Author SHA1 Message Date
wm4 8fbc64f74e vf_format: allow forcing aspect ratio
Makes vf_dsize completely useless. Unfortunately, even our "official"
encoding profiles still use it.
2015-04-03 00:14:45 +02:00
wm4 8585845c64 vf_format: allow forcing display size 2015-04-03 00:13:41 +02:00
wm4 3d17b12d9c vo_opengl: remove chroma-location suboption
Terribly obscure, and vf_format can do this for all VOs.
2015-04-03 00:12:32 +02:00
wm4 28fa17dac6 vf_format: allow forcing rotation flags 2015-04-03 00:12:30 +02:00
wm4 14a530f474 vf_format: allow forcing stereo mode parameters 2015-04-03 00:11:10 +02:00
wm4 5a2825ec35 video: cleanup stereo mode parsing
Use OPT_CHOICE_C() instead of the custom parser. The functionality is
pretty much equivalent.

(On a side note, it seems --video-stereo-mode can't be removed, because
it controls whether to "reduce" stereo video to mono, which is also the
default. In fact I'm not sure how this should be handled at all.)
2015-04-02 23:54:08 +02:00
Dan Oscarsson 33d587ffa9 vdpau: fix preemption handling
Signed-off-by: wm4 <wm4@nowhere>
2015-03-31 14:48:34 +02:00
wm4 8f0f73e591 video/out: remove unused colorspace reporting
Rarely used and essentially useless. The only VO for which this was
implemented correctly and for which this did anything was vo_xv, but you
shouldn't use vo_xv anyway (plus it support BT.601 only, plus a vendor
specific extension for BT.709, whose presence this function essentially
reported - use xvinfo instead).
2015-03-31 00:09:03 +02:00
wm4 27715b7dd1 video: move colorspace overrides to vf_format, simplify
Remove the colorspace-related top-level options, add them to vf_format.
They are rather obscure and not needed often, so it's better to get them
out of the way. In particular, this gets rid of the semi-complicated
logic in command.c (most of which was needed for OSD display and the
direct feedback from the VO). It removes the duplicated color-related
name mappings.

This removes the ability to write the colormatrix and related
properties. Since filters can be changed at runtime, there's no loss of
functionality, except that you can't cycle automatically through the
color constants anymore (but who needs to do this).

This also changes the type of the mp_csp_names and related variables, so
they can directly be used with OPT_CHOICE. This probably ended up a bit
awkward, for the sake of not adding a new option type which would have
used the previous format.
2015-03-31 00:09:03 +02:00
wm4 273afdc3a4 vf_format: don't crash if nonsense parameters are passed
It was "by design" possible to make mpv crash if the parameters didn't
make enough sense, like "format=rgb24:yuv420p". While forcing the format
has some minor (rather questionable) use for debugging, allowing it to
crash is just stupid.
2015-03-31 00:09:03 +02:00
wm4 1164dc572c vf_format: by default, pass through video without change
Instead of forcing a useless format (packed YUV??) by default.

Also cleanup.
2015-03-31 00:09:03 +02:00
wm4 205a2ef169 csputils: unify names for colorspace/etc. names 2015-03-31 00:09:03 +02:00
wm4 8fff125422 RPI support
This requires FFmpeg git master for accelerated hardware decoding.
Keep in mind that FFmpeg must be compiled with --enable-mmal. Libav
will also work.

Most things work. Screenshots don't work with accelerated/opaque
decoding (except using full window screenshot mode). Subtitles are
very slow - even simple but huge overlays can cause frame drops.

This always uses fullscreen mode. It uses dispmanx and mmal directly,
and there are no window managers or anything on this level.

vo_opengl also kind of works, but is pretty useless and slow. It can't
use opaque hardware decoding (copy back can be used by forcing the
option --vd=lavc:h264_mmal). Keep in mind that the dispmanx backend
is preferred over the X11 ones in case you're trying on X11; but X11
is even more useless on RPI.

This doesn't correctly reject extended h264 profiles and thus doesn't
fallback to software decoding. The hw supports only up to the high
profile, and will e.g. return garbage for Hi10P video.

This sets a precedent of enabling hw decoding by default, but only
if RPI support is compiled (which most hopefully it will be disabled
on desktop Linux platforms). While it's more or less required to use
hw decoding on the weak RPI, it causes more problems than it solves
on real platforms (Linux has the Intel GPU problem, OSX still has
some cases with broken decoding.) So I can live with this compromise
of having different defaults depending on the platform.

Raspberry Pi 2 is required. This wasn't tested on the original RPI,
though at least decoding itself seems to work (but full playback was
not tested).
2015-03-29 16:09:56 +02:00
Niklas Haas 634b4afa2b vo_opengl: treat non-blended subtitles as sRGB
Currently, the code just skipped CMS completely. This commit treats them
as sRGB by default, instead.

This also refactors much of the color management code to make it more
generalized and re-usable.
2015-03-27 12:31:08 +01:00
Niklas Haas a60e725113 vo_opengl: add FBOTEX_FUZZY alias
Minor reusability factor
2015-03-26 00:04:08 +01:00
Niklas Haas 6e1c950069 vo_opengl: simplify sampler prelude
This moves common re-definitions to a custom function and also shortens the
names to make stuff less verbose in general.
2015-03-26 00:04:08 +01:00
Niklas Haas 987197be46 vo_opengl: reset surfaces on equalizer updates
This makes the VO more responsive to equalizer changes (eg. brightness)
when interpolation is used.
2015-03-26 00:04:08 +01:00
Niklas Haas dfbe1832ee vo_opengl: increase shader cache size
This is a minor precaution, because in some cases the number of shader
programs can already hit 10. (chroma merging + separated cscale/scale +
+ sub blending (interpolated) + sub blending (non-interpolated)
+ output (interpolated) + output (non-interpolated) + OSD)
2015-03-26 00:04:08 +01:00
Niklas Haas 8c43e12b20 vo_opengl: draw subtitles directly onto the video
This has a number of user-visible changes:

1. A new flag blend-subtitles (default on for opengl-hq) to control this
   behavior.

2. The OSD itself will not be color managed or affected by
   gamma controls. To get subtitle CMS/gamma, blend-subtitles must be
   used.

3. When enabled, this will make subtitles be cleanly interpolated by
   :interpolation, and also dithered etc. (just like the normal output).

Signed-off-by: wm4 <wm4@nowhere>
2015-03-26 00:04:03 +01:00
Niklas Haas a67494e86b vo_opengl: set cscale=spline36 as default for opengl-hq
Bilinear scaling is not a suitable default for something named "hq"; the
whole reason this was done in the past was because cscale used to be
obscenely slow. This is no longer the case, with cscale being nearly
free.
2015-03-25 22:40:19 +01:00
Niklas Haas 62d3c95367
vo_opengl: correct OSD PTS when using interpolation 2015-03-25 22:40:10 +01:00
wm4 72308256e4 vf_vapoursynth: handle approximate EOF draining
Handling this perfectly with VapourSynth is probably not possible: you
either need to tell it the total number of input frames in advance, or
deliver an infinite stream. With playback, EOF can happen at an
unpredictable point, for which the VapourSynth API has no mechanism at
all. We handle EOF by returning an error to the filter, which will the
filter return all pending frame callbacks.

We still can try to handle it approximately: if the filter requests a
frame past EOF, then send it an error. This seems to work relatively
well with filters which don't request future frames.
2015-03-25 14:33:20 +01:00
wm4 45ff6cef62 vo_opengl: minor simplification
We don't need alternative function names in the GL loader anymore.
2015-03-25 12:40:45 +01:00
wm4 6d9f15a8ab vo_opengl: check extensions properly
With the previous commit, we have no need anymore to check a part of an
extension string (for ignoring a prefix). So check the extension string
properly, instead of just using the broken old strstr() method, which
could accidentally ignore prefixes or suffixes. Do this by extending
the check to whether the extension name is properly delimited by spaces
or string start/end.
2015-03-25 12:36:36 +01:00
wm4 85c21ae409 vo_opengl: cleanup swap_control extension loading
Instead of somehow looking for the substring "_swap_control" and trying
to several arbitrary function names, do it cleanly. The old approach has
the problem that it's not very exact, and may even load a pointer to a
function which doesn't exist. (Some GL implementations like Mesa return
function pointers even the functions which don't exist, and calling them
crashes.)

I couldn't find any evidence that glXSwapInterval, wglSwapIntervalSGI,
or wglSwapInterval actually exist, so don't include them. They were
carried over from MPlayer times.

To make diagnostics easier, print a warning in verbose mode if the
function could not be loaded.
2015-03-25 12:29:19 +01:00
wm4 cdf9abd872 vo_opengl: drop support for old framebuffer extension
Drop support for GL_EXT_framebuffer_object. It has 2 problems: semantics
might be slightly different from the "proper" GL_ARB_framebuffer_object
extension (but is likely completely untested), and also our extension
loader is too dumb to load the same group of function pointers
represented by different extensions only once.
2015-03-25 12:00:57 +01:00
Jari Vetoniemi 3f4e154ec6 vo_wayland: fix null dereference
If compositor sends configure event before back_buffer is allocated, it
will cause null dereference.
2015-03-23 21:53:32 +01:00
Jari Vetoniemi 3a6ade7a84 vo_opengl: do not block on wayland
When not receiving frame callbacks, we should not draw anything to avoid
blocking the OpenGL renderer. We do this by extending gl context api, by
introducing new optional function 'is_active', that indicates whether
OpenGL renderers should draw or not.

This fixes issue #249.
2015-03-23 21:53:32 +01:00
Jari Vetoniemi c10fb4ce9f vo_wayland: define opaque region
This allows compositor to optimize rendering, as it will know mpv is not
transparent.
2015-03-23 21:53:32 +01:00
Jari Vetoniemi 3714430cdf vo_wayland: share frame callbacks.
Define frame callback logic in wayland_common.c
As this should be used by opengl renderer as well.

Preferably drawing should be skipped entierly when no frame callbacks
are received. However, for now only swap buffers is skipped.
2015-03-23 21:53:32 +01:00
wm4 e52f7d3da8 mp_image: reject 0-sized images
Like FFmpeg/Libav do. It seems not all code can actually deal with this
situation, so it's better to shift the special-cases to code which needs
it (possibly OSD code; screenshots of 0x0 windows would just fail).
2015-03-23 18:38:19 +01:00
Niklas Haas cfb5e0cea6 vo_opengl: fix XYZ input gamma
This seems to have been a mistranslation from the original code, which
multiplied the gamma by 2.6 (*not* the color itself).
2015-03-23 18:36:48 +01:00
wm4 a09e5dd891 vo_vdpau: remove some minor code duplication
The way-too-big API call for clearing the screen can be easily shared
between two completely different codepaths.
2015-03-23 18:15:40 +01:00
wm4 7363b0439f vo_vdpau: check vdpau API return value 2015-03-23 18:12:05 +01:00
wm4 180e35a175 vdpau: remove dead assignment
I guess we don't really care whether this particular function succeeds.
If it fails, it must be completely broken anyway and it would not matter
much to us.
2015-03-23 18:09:40 +01:00
wm4 9d84b2c07d vo_opengl: remove dead assignment 2015-03-23 18:04:56 +01:00
wm4 167b75c50c vo_opengl_cb: don't render OSD while VO is not created
Unlike other VOs, this rendered OSD even while no VO was created
(because the renderer lives as long as the API user wants). Change this,
and refactor the code so that the OSD object is accessible only while
the VO is created.

(There is a short time where the OSD can still be accessed even after VO
destruction - this is not a race condition, though it's inelegant and
unfortunately unavoidable.)
2015-03-23 16:32:59 +01:00
wm4 67bdad9a43 vo_opengl: move OSD rendering to separate function
Also reindent the few lines that call into the actual renderer to remove
the "draw_osd" goto.
2015-03-23 16:28:33 +01:00
wm4 612b8a8ab3 vo_opengl: fix video equalizer gamma controls
It was ignored.
2015-03-22 13:28:47 +01:00
wm4 6f5db977c0 vo_opengl: fix background color option
gl_video_set_options() didn't update it, so the default value set on
initialization was used. Fix by always setting the clear color before
the clear command; it's slightly easier to follow too.
2015-03-21 17:32:59 +01:00
wm4 d790dbc3b5 vo_opengl: fix bicubic_fast scaler 2015-03-21 17:29:34 +01:00
wm4 72e67064a3 vd_lavc: less confusing message when hardware decoding won't work
Codecs for hardware acceleration are not blacklisted, but whitelisted.
Also, if this emssage is printed, the codec might not have any hardware
acceleration support in the first place.
2015-03-20 22:14:14 +01:00
wm4 fe0c37b007 player: better handling of video with no timestamps
Trying to handle such video is almost worthless, but it was requested by
at least 2 users.

If there are no timestamps, enable byte seeking by setting
ts_resets_possible. Use the video FPS (wherever it comes from) and the
audio samplerate for timing. The latter was already done by making the
first packet emit DTS=0; remove this again and do it "properly" in a
higher level.
2015-03-20 22:08:12 +01:00
wm4 29083ae31b vo_xv: remove pointless cast 2015-03-20 00:46:56 +01:00
wm4 25c8bf8754 vf_expand: fix memory leak on memory allocation failure
Isn't it ironic.
2015-03-20 00:38:29 +01:00
wm4 6b53897d75 mp_image: do not assume trailing stride padding exists
Normally, the size of an mage plane is assumed to be stride*height. But
in theory, if stride is larger than width*bpp, the last line might not
be padded, simply because it's not necessary. FFmpeg's or mpv's image
allocators always guarantee that this padding exists (it wastes some
insignificant memory for avoiding such subtle issues), but some other
libraries might not.

I suspect one such case might be Xv via vo_xv (see #1698), although my X
server appears to provide full padding. In any case, it can't harm.
2015-03-20 00:34:15 +01:00
wm4 5f2a8474ae video: uninline memcpy_pic functions
There's literally no reason why these functions have to be inline (they
might be performance critical, but then the function call overhead isn't
going to matter at all).

Uninline them and move them to mp_image.c. Drop the header file and fix
all uses of it.
2015-03-20 00:21:23 +01:00
wm4 145922a070 video: replace pointless macro
Some old absurdity.
2015-03-20 00:12:03 +01:00
wm4 713a8c1a89 mp_image: remove unneeded things
(But I'd really prefer removing our own refcounting mechanism fully.)
2015-03-20 00:09:18 +01:00
wm4 47c131bb0c player: warn against non-monotonic video PTS only once
For some reason there were two points in the code where it warned
against non-monotonic video PTS. The one in video.c triggered on PTS
going backwards or making large jumps forwards, while dec_video.c
triggered on PTS going backwards or PTS not changing. Merge them into a
single check, which warns against all cases.
2015-03-18 22:26:49 +01:00