Commit Graph

40313 Commits

Author SHA1 Message Date
Niklas Haas 6c250505fe vo_opengl: unroll ewa_lanczos to avoid looping and unnecessary samples
This speeds up performance by a factor of something like 10%,
since it omits unnecessary checks.

This will also make adding anti-ringing easier.
2015-01-22 19:29:23 +01:00
Niklas Haas f5e48f0235 vo_opengl: clean up ewa_lanczos code
This fixes compatibility with GLES 2.0 and makes the code a bit neater
in general. It also properly forces indirect scaling for subsampled
video regardless of the lscale setting.
2015-01-22 19:29:23 +01:00
wm4 571fe8f729 vo_opengl: guarantee correct reinitialization on setting options
At least the scale_sep_fbo could have been uninitialized or initialized
incorrectly when switching between scalers (e.g. from bilinear to
lanczos). Calling check_resize() should take care of this.
2015-01-22 19:25:16 +01:00
wm4 a8f565008b vo_opengl: don't reset unused GL_PACK_... state 2015-01-22 18:54:05 +01:00
wm4 5bb24980ae vo_opengl: simplify screenshot code
Instead of reading back the image from textures, keep a reference to the
original image, and return that.

The main reason this was done this way was that originally, images
weren't refcounted, and would be deallocated or overwritten as soon as
the VO's draw call returned. But now there isn't really a good reason
for this anymore. One possibly _could_ argue that it was better because
other code could reuse the image sooner (e.g. for the cache), but on the
other hand, the VO runs already on a different thread, and filtering and
decoding each run on other threads too, so this argument probably
wouldn't hold up.
2015-01-22 18:31:10 +01:00
wm4 16cc429eb8 vo_vdpau: don't render to an output surface if it could be busy
There was a case when we could have rendered to an output surface while
it's still used for display. Not sure why the API doesn't do this
automatically.
2015-01-22 18:18:23 +01:00
wm4 74581a6106 video: handle hwdec screenshots differently
Instead of converting the hw surface to an image in the VO, provide a
generic way to convet hw surfaces, and use this in the screenshot code.

It's all relatively straightforward, except vdpau is being terrible. It
needs a huge chunk of new code, because copying back is not simple.
2015-01-22 18:18:23 +01:00
wm4 e9ac3fc3a1 mp_image_pool: allow passing pool=NULL in more places
It's convenient.
2015-01-22 17:37:40 +01:00
wm4 aae9af348e video: have a generic context struct for hwdec backends
Before this commit, each hw backend had their own specific struct types
for context, and some, like VDA, had none at all. Add a context struct
(mp_hwdec_ctx) that provides a somewhat generic way to pass the hwdec
context around. Some things get slightly better, some slightly more
verbose.

mp_hwdec_info is still around; it's still needed, but is reduced to its
role of handling delayed loading of the hwdec backend.
2015-01-22 15:32:23 +01:00
Stefano Pigozzi 29cf62d201 cocoa: remove support for systems without gl3.h header 2015-01-22 08:27:03 +01:00
Niklas Haas edc100eee0
vo_opengl: make the default radius 3.0 and simplify scaler documentation
This also fixes the maximum range to 16.0, which was previously set to
32.0 and incorrectly documented as 8.0. 16 taps should be more than
anybody will ever need, but it's the highest radius that's supported by
all affected filters.
2015-01-21 23:08:41 +01:00
wm4 e7171892e7 manpage: vo_opengl: change scaler descriptions and recommendations
Based on suggestions by lachs0r.
2015-01-21 22:22:42 +01:00
wm4 b2149f7fe1 vaapi: minor simplification 2015-01-21 22:12:30 +01:00
wm4 a1ed13869c video: remove vfcap.h
And remove all uses of the VFCAP_CSP_SUPPORTED* constants. This is
supposed to reduce conversions if many filters are used (with many
incompatible pixel formats), and also for preferring the VO's natively
supported pixel formats (as opposed to conversion).

This is worthless by now. Not only do the main VOs not use software
conversion, but also the way vf_lavfi and libavfilter work mostly break
the way the old MPlayer mechanism worked. Other important filters like
vf_vapoursynth do not support "proper" format negotation either.

Part of this was already removed with the vf_scale cleanup from today.

While I'm touching every single VO, also fix the query_format argument
(it's not a FourCC anymore).
2015-01-21 22:08:24 +01:00
wm4 2a691d1ede video: try to keep implied alpha when using conversion filters
Don't just discard alpha. This probably does the right thing, in the
rare situations when alpha matters at all.
2015-01-21 21:49:15 +01:00
wm4 3f49c60762 vo_direct3d: unify d3d "reset" and uninit paths
I'm still not sure how exactly handling of "lost" devices is supposed
to be handled. In theory, you only have to "reset" the device, instead
of recreating _everything_. But as it is, the code for proper uninit
and for handling the reset is exactly the same, so move it into a
function to reduce code duplication and the danger of potential bugs.
2015-01-21 21:12:18 +01:00
wm4 39231e5dfd vo_direct3d: disable shaders if unavailable
Apparently, extremely crappy graphics drivers don't allow you to use
shaders. Simply disable use of shaders if this happens, and use the
"old" method instead.

One unexpectedly tricky thing is that you need a d3d_device to create
a shader, which in turn requires a window, so the initialization order
changes.
2015-01-21 21:06:56 +01:00
wm4 e34957940b vo_opengl: cleanups after vo_opengl_old removal
Don't load all the legacy functions (including ancient extensions).
Slightly simplify function loader and context creation, now that legacy
GL doesn't need to be handled. Remove the code for drawing OSD in legacy
mode.

Remove all the header hacks, which were meant for ancient OpenGL headers
which didn't even support things like OpenGL 1.3. Instead, adjust the
GLX check to make sure we get both OpenGL 3x and 2.1 symbols. For win32
and OSX, we assume that the user has the latest headers anyway. For
wayland, we hope that things somehow go right.
2015-01-21 20:32:42 +01:00
wm4 c15697477f vo: never autoselect vo_null
Same deal as with commit d44b4ccb.
2015-01-21 19:39:58 +01:00
wm4 c0077ac936 ao_alsa: reinitialize if device got broken
Apparently, physically disconnecting the audio device (consider USB
audio) breaks the ALSA device handle forever. It will signal ENODEV.
Fortunately, it's easy for us to handle this, and we can just use
existing mechanisms that will make the playback core close and reopen
the AO. Whether the immediate reopening will actually succeeds really is
ALSA's problem, though.
2015-01-21 19:38:18 +01:00
wm4 a0caadd512 vo_opengl: handle grayscale input better, add YA16 support
Simply clamp off the U/V components in the colormatrix, instead of doing
something special in the shader.

Also, since YA8/YA16 gave a plane_bits value of 16/32, and a colormatrix
calculation overflowed with 32, add a component_bits field to the image
format descriptor, which for YA8/YA16 returns 8/16 (the wrong value had
no bad consequences otherwise).
2015-01-21 19:29:18 +01:00
wm4 30ca30c0a1 vf_scale: replace ancient fallback image format selection
If video output and VO don't support the same format, a conversion
filter needs to be insert. Since a VO can support multiple formats, and
the filter chain also can deal with multiple formats, you basically have
to pick from a huge matrix of possible conversions.

The old MPlayer code had a quite naive algorithm: it first checked
whether any conversion from the list of preferred conversions matched,
and if not, it was falling back on checking a hardcoded list of output
formats (more or less sorted by quality). This had some unintended side-
effects, like not using obvious "replacement" formats, selecting the
wrong colorspace, selecting a bit depth that is too high or too low, and
more.

Use avcodec_find_best_pix_fmt_of_list() provided by FFmpeg instead. This
function was made for this purpose, and should select the "best" format.

Libav provides a similar function, but with a different name - there is
a function with the same name in FFmpeg, but it has different semantics
(I'm not sure if Libav or FFmpeg fucked up here).

This also removes handling of VFCAP_CSP_SUPPORTED vs.
VFCAP_CSP_SUPPORTED_BY_HW, which has no meaning anymore, except possibly
for filter chains with multiple scale filters.

Fixes #1494.
2015-01-21 18:33:47 +01:00
wm4 303924c343 stream: reject overly long URLs 2015-01-21 12:11:37 +01:00
wm4 d558accaa6 stream_lavf: escape disallowed characters in http URLs
In my opinion, libavformat should be doing this. But a patch handling a
very safe case rejected, so I suppose we have to do it manually. (This
patch was only escaping spaces, which can never work because they break
the basic syntax of the HTTP protocol.)

This commit attempts to do 2 things:
- Try to guess whether libavformat will use the URL for http. This is
  not always trivial, because some protocols will recursively pass part
  of the user URL to http in some way.
- Try to fix invalid URLs. We fix only the simplest case: only
  characters that are never valid are escaped. This excludes invalid
  escape codes, which happen with freestanding '%' characters.

Fixes #1495.
2015-01-21 12:10:49 +01:00
wm4 724f722d7f vo_opengl_old: remove this VO
At this point, there is probably no hardware left that doesn't do
OpenGL 2.1, and at the same time is fast enough to handle video.
2015-01-20 21:15:04 +01:00
wm4 21322a016e client API: check locale, and reject anything other than "C" locale
Sigh...

The C locale system is incredibly shitty, and if used, breaks basic
string functions. The locale can change the decimal mark from "." to
",", which affects conversion between floats and strings: snprintf() and
strtod() respect the locale decimal mark, and change behavior. (What's
even better, the behavior of these functions can change asynchronously,
if setlocale() is called after threads were started.)

So just check the locale in the client API, and refuse to work if it's
wrong. This also makes the lib print to stderr, which I consider the
lesser evil in this specific situation.
2015-01-20 21:10:44 +01:00
wm4 9f63b9f673 vo_opengl: fix typo 2015-01-20 20:36:57 +01:00
wm4 5a93dd6245 build: reduce worst case with mismatching FFmpeg pkg-config files
Handles mismatching libavfilter/libavdevice and libavcodec slightly
better.

libavfilter and libavdevice are optional, and thus are checked
separately and at a later point of the build. But if a user system has
at least 2 FFmpeg installations, and one of them lacks libavfilter or
libavdevice, the build script will pick up the libavfilter/libavdevice
package of the "other" FFmpeg installation. The moment waf picks these
up, all include paths will start pointing at the "wrong" FFmpeg, and the
FFmpeg API checks done earlier might be wrong too, leading to obscure
and hard to explain compilation failures.

Just moving the libavfilter/libavdevice checks before the FFmpeg API
checks somewhat deals with this issue. Certainly not a proper solution,
but since the change is harmless, and there is no proper solution, and
the change doesn't actually add anything new, why not.
2015-01-20 15:53:40 +01:00
wm4 061d9b1afe README: extend dependecy list, link Windows compilation docs
Also, fix vo.rst, don't want to waste a separate commit on this.
2015-01-20 15:23:21 +01:00
wm4 6b24cb2756 win32: remove check for SetPriorityClass()
This function is always available, which is reflected by the fact that
the configure check doesn't actually bother to check for its existence.
Instead, MinGW and Cygwin imply it. The check was probably "needed" when
the priority code was still in a separate source file.

Remove the check, and use _WIN32 for testing for the win32 API (in a
bunch of other places too).
2015-01-20 15:18:51 +01:00
wm4 6f5e5e6a9e vo_opengl: remove cscale-down suboption
For an explanation see the additions to the manpage.
2015-01-20 14:33:53 +01:00
wm4 be02ebfcba audio: don't force any parameters if spdif is used
The existing code only ignored --audio-channels, but not --audio-rate or
--audio-format if spdif passthrough is used. Setting these makes no
sense.
2015-01-20 14:33:08 +01:00
wm4 1e6b4d31aa ao_coreaudio: reset possibly random errno value
In general, you need to check errno when using strtol(), but as far as I
know, strtol() won't reset errno on success. This has to be done
manually. The code could have failed sporadically if strtol() succeeded,
and errno was already set to one of the checked values.

(This strtol() still isn't fully error checked, but I don't know if it's
intentional, e.g. for parsing a numeric prefix only.)
2015-01-20 14:32:01 +01:00
wm4 d44b4ccba1 ao: never autoselect ao_null
Before this commit, ao_null was used as last fallback. This doesn't make
too much sense. Why would you decode audio just to discard it? Let audio
initialization fail instead. This also handles the weird but possible
corner-case that ao_null might fail initializing, in which case e.g.
ao_pcm could be autoselected. (This happened once, and had to be fixed
manually.)
2015-01-20 14:28:34 +01:00
wm4 3c2ca0cecc ao: refactor --audio-device selection code
This removes the slightly duplicated code for picking the required AO
driver if --audio-device forces one. Now --audio-device reuses the same
code as --ao for this.

As a consequence, ao_alloc_pb() and ao_create() can be merged into
ao_init(). Although the ao_init() argument list, which is already pretty
big, grows by one, it's better than having all these similar sounding
functions around.

Actually, I just wanted to do the change the following commit will do,
but I found this code was more of a mess than it had to be.
2015-01-20 14:25:47 +01:00
wm4 84928b049d vo: restore framedrop
Fix inverted condition in commit 234d6329.
2015-01-20 09:11:14 +01:00
wm4 7a7d8d50e2 dvd: try to improve seeking
libdvdnav is garbage. Seeking by time is incredibly inexact, which is in
part due to the fact that it does not use the DVD seek tables. Instead,
it assumes CBR for certain ranges within the DVD, which makes especially
small seeks unreliable.

I have no good fix for this, other than hacking libdvdnav (I'd rather
prefer to remove mpv DVD support completely than doing this). So here's
a shitty hack that tries to workaround these problems. A basic
observation is that seeking in VLC seems to work quite well; however it
seems to be based on seeking by blocks (unless there is a subtle "trick"
I didn't see in the source code). mpv usually seeks by timestamps, so
this is not an option for us. However, we can pretend we are doing this
in the DVD layer.

The previous commit added a way to pass through relative seeks. This
commit uses the relative seek. STREAM_CTRL_SEEK_TO_TIME is backwards
compatible (there's still dvdread and bluray), so most code is about
extracing the relative seek information and turning it into a block
seek.

(Another way would have been using SEEK_FACTOR stuff, but that would
probably make for a less reliable way to handle this situation.)

Additionally, if a hr-seek is done, add an offset by 10 seconds. As long
as the error done by libdvdnav is not worse, this should help with hr-
seeks - although it makes them much slower.
2015-01-19 21:30:05 +01:00
wm4 966f0a41a4 demux_disc: pass seek flags to stream layer
Pass through the seek flags to the stream layer. The STREAM_CTRL
semantics become a bit awkward, but that's still the least awkward
part about optical disc media.

Make demux_disc.c request relative seeks. Now the player will use
relative seeks if the user sends relative seek commands, and the
demuxer announces it wants these by setting rel_seeks to true. This
change probably changes seek behavior for dvd, dvdnav, bluray, cdda,
and possibly makes seeking useless if the demuxer-cache is set to
a high value.

Will be used in the next commit. (Split to make reverting the next
commit easier.)
2015-01-19 21:26:48 +01:00
wm4 e972ff4857 client API: minor cleanup
Try not to put "everything" into mpv_wait_event: move out the code for
generating log message events.
2015-01-19 21:26:42 +01:00
wm4 64f72687ce client API: notify API user on event queue overflow
Before this, we merely printed a message to the terminal. Now the API
user can determine this properly. This might be important for API users
which somehow maintain complex state, which all has to be invalidated if
(state-changing) events are missing due to an overflow.

This also forces the client API user to empty the event queue, which is
good, because otherwise the event queue would reach the "filled up"
state immediately again due to further asynchronous events being added
to the queue.

Also add some minor improvements to mpv_wait_event() documentation, and
some other minor cosmetic changes.
2015-01-19 21:26:42 +01:00
Hiltjo Posthuma ffaf4af230 win32: use monotonic clock on windows if possible 2015-01-19 19:01:08 +01:00
wm4 513344648f player: mention mpv encoding support for transcoding in desync. warning 2015-01-19 18:04:45 +01:00
wm4 234d632920 video: fix waiting for last frame/format reconfig
We still need to send the VO a duration in these cases. Disabling
framedrop has logically absolutely nothing to do with these cases; it
was overlooked in commit 918b06c4.

So we always send the frame duration (or a guess for it), and check
whether framedropping is actually enabled in the VO code. (It would
be cleaner to send framedrop as a flag, but I don't care about that
right now.)
2015-01-19 18:02:31 +01:00
wm4 616cfb90c1 stream_dvb: silence bogus compiler warning
This complains within dvb_strtok_r() that savePtr is uninitialized.
There doesn't seem to be any code path where this can happen though, so
it's probably a false positive. Silence it anyway.
2015-01-19 17:58:37 +01:00
wm4 46a3974200 vo_opengl: remove 1D texture usage
Broke operation with GLSL.

Since 1D texture usage was apparently (and mysteriously) good for speed,
it might be added back, but it's unknown how to do so in a clean way.
2015-01-18 16:28:41 +01:00
wm4 9eca8b49db x11: fix initial state for --on-all-workspaces 2015-01-17 19:26:39 +01:00
wm4 78e3821bd5 cocoa: fix fullscreen handling
Fixes #1483, if it even compiles.
2015-01-17 02:45:17 +01:00
wm4 eb5a83e1c1 x11: add --on-all-workspaces option and property
Fixes #1469.
2015-01-16 23:38:47 +01:00
wm4 5649658c4e x11: minor cleanup
No reason for these functions to exist separately...
2015-01-16 23:09:06 +01:00
wm4 fc524e8a07 command: unify handling of fullscreen and other VO flags
The "ontop" and "border" properties already used a common
mp_property_vo_flag() function, and the corresponding VOCTRLs used the
same conventions. "fullscreen" is pretty similar, but was handled
slightly similar. Change how VOCTRL_FULLSCREEN behaves, and use the same
helper function for "fullscreen" as the other flags.
2015-01-16 23:07:13 +01:00